Skip to content

Commit 42a3879

Browse files
committed
da14531: Use binary file as source instead of object file
1 parent 2f3d737 commit 42a3879

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

bitbox-da14531-firmware.bin

24 KB
Binary file not shown.

bitbox-da14531-firmware.o

-24.4 KB
Binary file not shown.

src/CMakeLists.txt

Lines changed: 17 additions & 1 deletion
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")
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)