add boot2 info to binary info

This commit is contained in:
graham sanderson 2021-02-18 18:40:11 -06:00
parent 4639e75d0d
commit 4b7ffd71f0
3 changed files with 16 additions and 2 deletions

View File

@ -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 *

View File

@ -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)

View File

@ -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