1 /* 2 * Copyright (c) 2020 Raspberry Pi (Trading) Ltd. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 #ifndef _BOOT_STAGE2_CONFIG_H 8 #define _BOOT_STAGE2_CONFIG_H 9 10 // NOTE THIS HEADER IS INCLUDED FROM ASSEMBLY 11 12 #include "pico.h" 13 14 // PICO_CONFIG: PICO_BUILD_BOOT_STAGE2_NAME, The name of the boot stage 2 if selected by the build, group=boot_stage2 15 #ifdef PICO_BUILD_BOOT_STAGE2_NAME 16 #define _BOOT_STAGE2_SELECTED 17 #else 18 // check that multiple boot stage 2 options haven't been set... 19 20 // PICO_CONFIG: PICO_BOOT_STAGE2_CHOOSE_IS25LP080, Select boot2_is25lp080 as the boot stage 2 when no boot stage 2 selection is made by the CMake build, type=bool, default=0, group=boot_stage2 21 #ifndef PICO_BOOT_STAGE2_CHOOSE_IS25LP080 22 #define PICO_BOOT_STAGE2_CHOOSE_IS25LP080 0 23 #elif PICO_BOOT_STAGE2_CHOOSE_IS25LP080 24 #ifdef _BOOT_STAGE2_SELECTED 25 #error multiple boot stage 2 options chosen 26 #endif 27 #define _BOOT_STAGE2_SELECTED 28 #endif 29 // PICO_CONFIG: PICO_BOOT_STAGE2_CHOOSE_W25Q080, Select boot2_w25q080 as the boot stage 2 when no boot stage 2 selection is made by the CMake build, type=bool, default=0, group=boot_stage2 30 #ifndef PICO_BOOT_STAGE2_CHOOSE_W25Q080 31 #define PICO_BOOT_STAGE2_CHOOSE_W25Q080 0 32 #elif PICO_BOOT_STAGE2_CHOOSE_W25Q080 33 #ifdef _BOOT_STAGE2_SELECTED 34 #error multiple boot stage 2 options chosen 35 #endif 36 #define _BOOT_STAGE2_SELECTED 37 #endif 38 // PICO_CONFIG: PICO_BOOT_STAGE2_CHOOSE_W25X10CL, Select boot2_w25x10cl as the boot stage 2 when no boot stage 2 selection is made by the CMake build, type=bool, default=0, group=boot_stage2 39 #ifndef PICO_BOOT_STAGE2_CHOOSE_W25X10CL 40 #define PICO_BOOT_STAGE2_CHOOSE_W25X10CL 0 41 #elif PICO_BOOT_STAGE2_CHOOSE_W25X10CL 42 #ifdef _BOOT_STAGE2_SELECTED 43 #error multiple boot stage 2 options chosen 44 #endif 45 #define _BOOT_STAGE2_SELECTED 46 #endif 47 // PICO_CONFIG: PICO_BOOT_STAGE2_CHOOSE_AT25SF128A, Select boot2_at25sf128a as the boot stage 2 when no boot stage 2 selection is made by the CMake build, type=bool, default=0, group=boot_stage2 48 #ifndef PICO_BOOT_STAGE2_CHOOSE_AT25SF128A 49 #define PICO_BOOT_STAGE2_CHOOSE_AT25SF128A 0 50 #elif PICO_BOOT_STAGE2_CHOOSE_AT25SF128A 51 #ifdef _BOOT_STAGE2_SELECTED 52 #error multiple boot stage 2 options chosen 53 #endif 54 #define _BOOT_STAGE2_SELECTED 55 #endif 56 57 // PICO_CONFIG: PICO_BOOT_STAGE2_CHOOSE_GENERIC_03H, Select boot2_generic_03h as the boot stage 2 when no boot stage 2 selection is made by the CMake build, type=bool, default=1, group=boot_stage2 58 #if defined(PICO_BOOT_STAGE2_CHOOSE_GENERIC_03H) && PICO_BOOT_STAGE2_CHOOSE_GENERIC_03H 59 #ifdef _BOOT_STAGE2_SELECTED 60 #error multiple boot stage 2 options chosen 61 #endif 62 #define _BOOT_STAGE2_SELECTED 63 #endif 64 65 #endif // PICO_BUILD_BOOT_STAGE2_NAME 66 67 #ifdef PICO_BUILD_BOOT_STAGE2_NAME 68 // boot stage 2 is configured by cmake, so use the name specified there 69 #define PICO_BOOT_STAGE2_NAME PICO_BUILD_BOOT_STAGE2_NAME 70 #else 71 // boot stage 2 is selected by board config header, so we have to do some work 72 #if PICO_BOOT_STAGE2_CHOOSE_IS25LP080 73 #define _BOOT_STAGE2 boot2_is25lp080 74 #elif PICO_BOOT_STAGE2_CHOOSE_W25Q080 75 #define _BOOT_STAGE2 boot2_w25q080 76 #elif PICO_BOOT_STAGE2_CHOOSE_W25X10CL 77 #define _BOOT_STAGE2 boot2_w25x10cl 78 #elif PICO_BOOT_STAGE2_CHOOSE_AT25SF128A 79 #define _BOOT_STAGE2 boot2_at25sf128a 80 #elif !defined(PICO_BOOT_STAGE2_CHOOSE_GENERIC_03H) || PICO_BOOT_STAGE2_CHOOSE_GENERIC_03H 81 #undef PICO_BOOT_STAGE2_CHOOSE_GENERIC_03H 82 #define PICO_BOOT_STAGE2_CHOOSE_GENERIC_03H 1 83 #define _BOOT_STAGE2 boot2_generic_03h 84 #else 85 #error no boot stage 2 is defined by PICO_BOOT_STAGE2_CHOOSE_ macro 86 #endif 87 // we can't include cdefs in assembly, so define our own, but avoid conflict with real ones for c inclusion 88 #define PICO_BOOT_STAGE2_NAME __PICO_XSTRING(_BOOT_STAGE2) 89 #define PICO_BOOT_STAGE2_ASM __PICO_XSTRING(__PICO_CONCAT1(_BOOT_STAGE2,.S)) 90 #endif 91 #endif 92