From b8c17354e4c32c8ccc4bc046156c399330d448b2 Mon Sep 17 00:00:00 2001 From: graham sanderson Date: Sat, 30 Jan 2021 20:09:09 -0600 Subject: [PATCH] Fix dependency on boot_stage2 so that changes actually cause update of .S and relink of main application elf --- src/rp2_common/boot_stage2/CMakeLists.txt | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/rp2_common/boot_stage2/CMakeLists.txt b/src/rp2_common/boot_stage2/CMakeLists.txt index 47fa125..454e11c 100644 --- a/src/rp2_common/boot_stage2/CMakeLists.txt +++ b/src/rp2_common/boot_stage2/CMakeLists.txt @@ -31,26 +31,24 @@ function(pico_define_boot_stage2 NAME SOURCES) target_link_libraries(${NAME} hardware_regs) target_link_options(${NAME} PRIVATE "LINKER:--script=${PICO_BOOT_STAGE2_DIR}/boot_stage2.ld") set_target_properties(${NAME} PROPERTIES LINK_DEPENDS ${PICO_BOOT_STAGE2_DIR}/boot_stage2.ld) - + pico_add_dis_output(${NAME}) pico_add_map_output(${NAME}) set(ORIGINAL_BIN ${CMAKE_CURRENT_BINARY_DIR}/${NAME}.bin) set(PADDED_CHECKSUMMED_ASM ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_padded_checksummed.S) - - add_custom_target(${NAME}_bin DEPENDS ${ORIGINAL_BIN}) - add_dependencies(${NAME}_bin ${NAME}) - - add_custom_command(OUTPUT ${ORIGINAL_BIN} COMMAND ${CMAKE_OBJCOPY} -Obinary $ ${ORIGINAL_BIN}) - + find_package (Python3 REQUIRED COMPONENTS Interpreter) - add_custom_command(OUTPUT ${PADDED_CHECKSUMMED_ASM} - COMMAND ${Python3_EXECUTABLE} ${PICO_BOOT_STAGE2_DIR}/pad_checksum -s 0xffffffff ${ORIGINAL_BIN} ${PADDED_CHECKSUMMED_ASM} - ) + + add_custom_target(${NAME}_bin DEPENDS ${ORIGINAL_BIN}) + add_custom_command(OUTPUT ${ORIGINAL_BIN} DEPENDS ${NAME} COMMAND ${CMAKE_OBJCOPY} -Obinary $ ${ORIGINAL_BIN}) add_custom_target(${NAME}_padded_checksummed_asm DEPENDS ${PADDED_CHECKSUMMED_ASM}) - add_dependencies(${NAME}_padded_checksummed_asm ${NAME}_bin) - + add_custom_command(OUTPUT ${PADDED_CHECKSUMMED_ASM} DEPENDS ${ORIGINAL_BIN} + COMMAND ${Python3_EXECUTABLE} ${PICO_BOOT_STAGE2_DIR}/pad_checksum -s 0xffffffff ${ORIGINAL_BIN} ${PADDED_CHECKSUMMED_ASM} + ) + + add_library(${NAME}_library INTERFACE) add_dependencies(${NAME}_library ${NAME}_padded_checksummed_asm) # not strictly (or indeed actually) a link library, but this avoids dependency cycle