1 /* 2 * Copyright (c) 2020 Raspberry Pi (Trading) Ltd. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 #if !PICO_NO_BINARY_INFO && !PICO_NO_PROGRAM_INFO 8 #include "pico/binary_info.h" 9 10 #if !PICO_NO_FLASH 11 #include "boot_stage2/config.h" 12 #endif 13 14 // Note we put at most 4 pieces of binary info in the reset section because that's how much spare space we had 15 // (picked the most common ones)... if there is a link failure because of .reset section overflow then move 16 // more out. 17 #define reset_section_attr __attribute__((section(".reset"))) 18 19 #if !PICO_NO_FLASH 20 #ifndef PICO_NO_BI_BINARY_SIZE 21 extern char __flash_binary_end; 22 bi_decl_with_attr(bi_binary_end((intptr_t)&__flash_binary_end), reset_section_attr) 23 #endif 24 #endif 25 26 #if !PICO_NO_BI_PROGRAM_BUILD_DATE 27 #ifndef PICO_PROGRAM_BUILD_DATE 28 #define PICO_PROGRAM_BUILD_DATE __DATE__ 29 #endif 30 bi_decl_with_attr(bi_program_build_date_string(PICO_PROGRAM_BUILD_DATE), reset_section_attr); 31 #endif 32 33 #if !PICO_NO_BI_PROGRAM_NAME 34 #if !defined(PICO_PROGRAM_NAME) && defined(PICO_TARGET_NAME) 35 #define PICO_PROGRAM_NAME PICO_TARGET_NAME 36 #endif 37 #ifdef PICO_PROGRAM_NAME 38 bi_decl_with_attr(bi_program_name(PICO_PROGRAM_NAME), reset_section_attr) 39 #endif 40 #endif 41 42 #if !PICO_NO_BI_PICO_BOARD 43 #ifdef PICO_BOARD 44 bi_decl(bi_string(BINARY_INFO_TAG_RASPBERRY_PI, BINARY_INFO_ID_RP_PICO_BOARD, PICO_BOARD)) 45 #endif 46 #endif 47 48 #if !PICO_NO_BI_SDK_VERSION 49 #ifdef PICO_SDK_VERSION_STRING 50 bi_decl_with_attr(bi_string(BINARY_INFO_TAG_RASPBERRY_PI, BINARY_INFO_ID_RP_SDK_VERSION, PICO_SDK_VERSION_STRING),reset_section_attr) 51 #endif 52 #endif 53 54 #if !PICO_NO_BI_PROGRAM_VERSION_STRING 55 #ifdef PICO_PROGRAM_VERSION_STRING 56 bi_decl(bi_program_version_string(PICO_PROGRAM_VERSION_STRING)) 57 #endif 58 #endif 59 60 61 #if !PICO_NO_BI_PROGRAM_DESCRIPTION 62 #ifdef PICO_PROGRAM_DESCRIPTION 63 bi_decl(bi_program_description(PICO_PROGRAM_DESCRIPTION)) 64 #endif 65 #endif 66 67 #if !PICO_NO_BI_PROGRAM_URL 68 #ifdef PICO_PROGRAM_URL 69 bi_decl(bi_program_url(PICO_PROGRAM_URL)) 70 #endif 71 #endif 72 73 #if !PICO_NO_BI_BOOT_STAGE2_NAME 74 #ifdef PICO_BOOT_STAGE2_NAME 75 bi_decl(bi_string(BINARY_INFO_TAG_RASPBERRY_PI, BINARY_INFO_ID_RP_BOOT2_NAME, PICO_BOOT_STAGE2_NAME)) 76 #endif 77 #endif 78 79 #if !PICO_NO_BI_BUILD_TYPE 80 #ifdef PICO_CMAKE_BUILD_TYPE 81 bi_decl(bi_program_build_attribute(PICO_CMAKE_BUILD_TYPE)) 82 #else 83 #ifndef NDEBUG 84 bi_decl(bi_program_build_attribute("Debug")) 85 #else 86 bi_decl(bi_program_build_attribute("Release")) 87 #endif 88 #endif 89 90 #if PICO_DEOPTIMIZED_DEBUG 91 bi_decl(bi_program_build_attribute("All optimization disabled")) 92 #endif 93 #endif 94 95 #endif 96