diff --git a/src/common/pico_binary_info/include/pico/binary_info/structure.h b/src/common/pico_binary_info/include/pico/binary_info/structure.h index 2e261b2..49d2fd6 100644 --- a/src/common/pico_binary_info/include/pico/binary_info/structure.h +++ b/src/common/pico_binary_info/include/pico/binary_info/structure.h @@ -54,6 +54,7 @@ typedef struct _binary_info_core binary_info_t; #define BINARY_INFO_ID_RP_PROGRAM_BUILD_ATTRIBUTE 0x4275f0d3 #define BINARY_INFO_ID_RP_SDK_VERSION 0x5360b3ab #define BINARY_INFO_ID_RP_PICO_BOARD 0xb63cffbb +#define BINARY_INFO_ID_RP_BOOT2_NAME 0x7f8882e1 #if PICO_ON_DEVICE #define bi_ptr_of(x) x * diff --git a/src/rp2_common/boot_stage2/CMakeLists.txt b/src/rp2_common/boot_stage2/CMakeLists.txt index 454e11c..4eda064 100644 --- a/src/rp2_common/boot_stage2/CMakeLists.txt +++ b/src/rp2_common/boot_stage2/CMakeLists.txt @@ -12,11 +12,12 @@ endif() # needed by function below set(PICO_BOOT_STAGE2_DIR "${CMAKE_CURRENT_LIST_DIR}" CACHE INTERNAL "") +# by convention the first source file name without extension is used for the binary info name function(pico_define_boot_stage2 NAME SOURCES) add_executable(${NAME} ${SOURCES} ) - + # todo bit of an abstraction failure - revisit for Clang support anyway if (CMAKE_C_COMPILER_ID STREQUAL "Clang") target_link_options(${NAME} PRIVATE "-nostdlib") @@ -53,6 +54,12 @@ function(pico_define_boot_stage2 NAME SOURCES) add_dependencies(${NAME}_library ${NAME}_padded_checksummed_asm) # not strictly (or indeed actually) a link library, but this avoids dependency cycle target_link_libraries(${NAME}_library INTERFACE ${PADDED_CHECKSUMMED_ASM}) + + list(GET SOURCES 0 FIRST_SOURCE) + get_filename_component(BOOT2_BI_NAME ${FIRST_SOURCE} NAME_WE) + + target_compile_definitions(${NAME}_library INTERFACE + -DPICO_BOOT2_NAME="${BOOT2_BI_NAME}") endfunction() macro(pico_set_boot_stage2 TARGET NAME) diff --git a/src/rp2_common/pico_standard_link/binary_info.c b/src/rp2_common/pico_standard_link/binary_info.c index 9a879c7..6559b06 100644 --- a/src/rp2_common/pico_standard_link/binary_info.c +++ b/src/rp2_common/pico_standard_link/binary_info.c @@ -66,7 +66,13 @@ bi_decl(bi_program_url(PICO_PROGRAM_URL)) #endif #endif -#if !PICO_NO_BUILD_TYPE_FEATURE +#if !PICO_NO_BI_BOOT2_NAME +#ifdef PICO_BOOT2_NAME +bi_decl(bi_string(BINARY_INFO_TAG_RASPBERRY_PI, BINARY_INFO_ID_RP_BOOT2_NAME, PICO_BOOT2_NAME)) +#endif +#endif + +#if !PICO_NO_BI_BUILD_TYPE #ifdef PICO_CMAKE_BUILD_TYPE bi_decl(bi_program_build_attribute(PICO_CMAKE_BUILD_TYPE)) #else