Skip to content

Commit 2544f08

Browse files
authored
Merge pull request #1442 from NickeZ/nickez/ble-objcopy-here
da14531: Use binary file as source instead of object file
2 parents 9bb4822 + 6c621ad commit 2544f08

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed
Binary file not shown.

src/CMakeLists.txt

+17-1
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,23 @@ if(CMAKE_CROSSCOMPILING)
576576
target_compile_definitions(factory-setup.elf PRIVATE PRODUCT_BITBOX02_FACTORYSETUP "APP_BTC=0" "APP_LTC=0" "APP_ETH=0" "APP_U2F=0")
577577
target_sources(factory-setup.elf PRIVATE ${PLATFORM-BITBOX02-SOURCES})
578578
target_link_libraries(factory-setup.elf PRIVATE rtt)
579-
target_link_libraries(factory-setup.elf PRIVATE ${CMAKE_SOURCE_DIR}/bitbox-da14531-firmware.o)
579+
580+
# Copy the binary file to the output directory because the symbol names in
581+
# the object file depend on the path to the binary file
582+
add_custom_command(
583+
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/bitbox-da14531-firmware.o
584+
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/bitbox-da14531-firmware.bin ${CMAKE_CURRENT_BINARY_DIR}
585+
COMMAND ${CMAKE_OBJCOPY} -Ibinary -Oelf32-littlearm --rename-section .data=.rodata,alloc,load,readonly,data,contents bitbox-da14531-firmware.bin bitbox-da14531-firmware.o
586+
DEPENDS ${CMAKE_SOURCE_DIR}/bitbox-da14531-firmware.bin
587+
COMMENT "Convert da14531 firmware to object file using ${CMAKE_OBJCOPY}")
588+
589+
add_custom_target(
590+
da14531-firmware-object
591+
DEPENDS bitbox-da14531-firmware.o
592+
)
593+
add_dependencies(factory-setup.elf da14531-firmware-object)
594+
595+
target_link_libraries(factory-setup.elf PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/bitbox-da14531-firmware.o)
580596

581597

582598
foreach(name ${BOOTLOADERS} ${FIRMWARES})

0 commit comments

Comments
 (0)