From cd71c8953ef14e77e639d0e06af6920384cb8311 Mon Sep 17 00:00:00 2001 From: Graham Sanderson Date: Mon, 19 Aug 2024 12:47:29 -0500 Subject: [PATCH] Fix missing Binary Info for boot_stage2 (#1844) * fix boot stage2 not showing up in binary info; sync rp2040 and rp230 bs2 CMakeLists.txt --- src/rp2040/boot_stage2/CMakeLists.txt | 2 +- src/rp2350/boot_stage2/CMakeLists.txt | 9 +++++---- .../pico_standard_binary_info/standard_binary_info.c | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/rp2040/boot_stage2/CMakeLists.txt b/src/rp2040/boot_stage2/CMakeLists.txt index c5768785b..650be0afb 100644 --- a/src/rp2040/boot_stage2/CMakeLists.txt +++ b/src/rp2040/boot_stage2/CMakeLists.txt @@ -30,7 +30,7 @@ pico_register_common_scope_var(PICO_DEFAULT_BOOT_STAGE2_FILE) # needed by function below set(PICO_BOOT_STAGE2_DIR "${CMAKE_CURRENT_LIST_DIR}" CACHE INTERNAL "") -add_library(boot_stage2_headers INTERFACE) +pico_add_library(boot_stage2_headers) target_include_directories(boot_stage2_headers SYSTEM INTERFACE ${CMAKE_CURRENT_LIST_DIR}/include) # by convention the first source file name without extension is used for the binary info name diff --git a/src/rp2350/boot_stage2/CMakeLists.txt b/src/rp2350/boot_stage2/CMakeLists.txt index bf41eb233..499ed28f0 100644 --- a/src/rp2350/boot_stage2/CMakeLists.txt +++ b/src/rp2350/boot_stage2/CMakeLists.txt @@ -40,9 +40,9 @@ function(pico_define_boot_stage2 NAME SOURCES) ) # todo bit of an abstraction failure - revisit for Clang support anyway - if (CMAKE_C_COMPILER_ID STREQUAL "Clang") + if (PICO_C_COMPILER_IS_CLANG) target_link_options(${NAME} PRIVATE "-nostdlib") - else () + elseif (PICO_C_COMPILER_IS_GNU) target_link_options(${NAME} PRIVATE "--specs=nosys.specs") target_link_options(${NAME} PRIVATE "-nostartfiles") endif () @@ -63,12 +63,13 @@ function(pico_define_boot_stage2 NAME SOURCES) find_package (Python3 REQUIRED COMPONENTS Interpreter) add_custom_target(${NAME}_bin DEPENDS ${ORIGINAL_BIN}) - add_custom_command(OUTPUT ${ORIGINAL_BIN} DEPENDS ${NAME} COMMAND ${CMAKE_OBJCOPY} -Obinary $ ${ORIGINAL_BIN}) + add_custom_command(OUTPUT ${ORIGINAL_BIN} DEPENDS ${NAME} COMMAND ${CMAKE_OBJCOPY} -Obinary $ ${ORIGINAL_BIN} + VERBATIM) add_custom_target(${NAME}_padded_checksummed_asm DEPENDS ${PADDED_CHECKSUMMED_ASM}) add_custom_command(OUTPUT ${PADDED_CHECKSUMMED_ASM} DEPENDS ${ORIGINAL_BIN} COMMAND ${Python3_EXECUTABLE} ${PICO_BOOT_STAGE2_DIR}/pad_checksum -s 0xffffffff -a $ ${ORIGINAL_BIN} ${PADDED_CHECKSUMMED_ASM} - ) + VERBATIM) add_library(${NAME}_library INTERFACE) add_dependencies(${NAME}_library ${NAME}_padded_checksummed_asm) diff --git a/src/rp2_common/pico_standard_binary_info/standard_binary_info.c b/src/rp2_common/pico_standard_binary_info/standard_binary_info.c index 2ebc33805..c950f8db1 100644 --- a/src/rp2_common/pico_standard_binary_info/standard_binary_info.c +++ b/src/rp2_common/pico_standard_binary_info/standard_binary_info.c @@ -7,7 +7,7 @@ #if !PICO_NO_BINARY_INFO && !PICO_NO_PROGRAM_INFO #include "pico/binary_info.h" -#if LIB_PICO_BOOT_STAGE2_HEADERS && !PICO_NO_FLASH +#if LIB_BOOT_STAGE2_HEADERS && !PICO_NO_FLASH #include "boot_stage2/config.h" #endif