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 // Note we put at most 4 pieces of binary info in the reset section because that's how much spare space we had 11 // (picked the most common ones)... if there is a link failure because of .reset section overflow then move 12 // more out. 13 #define reset_section_attr __attribute__((section(".reset"))) 14 15 #if !PICO_NO_FLASH 16 #ifndef PICO_NO_BI_BINARY_SIZE 17 extern char __flash_binary_end; 18 bi_decl_with_attr(bi_binary_end((uintptr_t)&__flash_binary_end), reset_section_attr) 19 #endif 20 #endif 21 22 #if !PICO_NO_BI_PROGRAM_BUILD_DATE 23 #ifndef PICO_PROGRAM_BUILD_DATE 24 #define PICO_PROGRAM_BUILD_DATE __DATE__ 25 #endif 26 bi_decl_with_attr(bi_program_build_date_string(PICO_PROGRAM_BUILD_DATE), reset_section_attr); 27 #endif 28 29 #if !PICO_NO_BI_PROGRAM_NAME 30 #if !defined(PICO_PROGRAM_NAME) && defined(PICO_TARGET_NAME) 31 #define PICO_PROGRAM_NAME PICO_TARGET_NAME 32 #endif 33 #ifdef PICO_PROGRAM_NAME 34 bi_decl_with_attr(bi_program_name(PICO_PROGRAM_NAME), reset_section_attr) 35 #endif 36 #endif 37 38 #if !PICO_NO_BI_PICO_BOARD 39 #ifdef PICO_BOARD 40 bi_decl(bi_string(BINARY_INFO_TAG_RASPBERRY_PI, BINARY_INFO_ID_RP_PICO_BOARD, PICO_BOARD)) 41 #endif 42 #endif 43 44 #if !PICO_NO_BI_SDK_VERSION 45 #ifdef PICO_SDK_VERSION_STRING 46 bi_decl_with_attr(bi_string(BINARY_INFO_TAG_RASPBERRY_PI, BINARY_INFO_ID_RP_SDK_VERSION, PICO_SDK_VERSION_STRING),reset_section_attr) 47 #endif 48 #endif 49 50 #if !PICO_NO_BI_PROGRAM_VERSION_STRING 51 #ifdef PICO_PROGRAM_VERSION_STRING 52 bi_decl(bi_program_version_string(PICO_PROGRAM_VERSION_STRING)) 53 #endif 54 #endif 55 56 57 #if !PICO_NO_BI_PROGRAM_DESCRIPTION 58 #ifdef PICO_PROGRAM_DESCRIPTION 59 bi_decl(bi_program_description(PICO_PROGRAM_DESCRIPTION)) 60 #endif 61 #endif 62 63 #if !PICO_NO_BI_PROGRAM_URL 64 #ifdef PICO_PROGRAM_URL 65 bi_decl(bi_program_url(PICO_PROGRAM_URL)) 66 #endif 67 #endif 68 69 #if !PICO_NO_BUILD_TYPE_FEATURE 70 #ifdef PICO_CMAKE_BUILD_TYPE 71 bi_decl(bi_program_build_attribute(PICO_CMAKE_BUILD_TYPE)) 72 #else 73 #ifndef NDEBUG 74 bi_decl(bi_program_build_attribute("Debug")) 75 #else 76 bi_decl(bi_program_build_attribute("Release")) 77 #endif 78 #endif 79 80 #if PICO_DEOPTIMIZED_DEBUG 81 bi_decl(bi_program_build_attribute("All optimization disabled")) 82 #endif 83 #endif 84 85 #endif