v2.0.0
config.h
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/config.h"
13
14// PICO_CONFIG: PICO_BUILD_BOOT_STAGE2_NAME, Name of the boot stage 2 if selected in the build system, 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 #error "IS25LP080 boot2 is broken (FIXME)"
74 #define _BOOT_STAGE2 boot2_is25lp080
75 #elif PICO_BOOT_STAGE2_CHOOSE_W25Q080
76 #define _BOOT_STAGE2 boot2_w25q080
77 #elif PICO_BOOT_STAGE2_CHOOSE_W25X10CL
78 #error "W25X10CL boot2 is broken (FIXME)"
79 #define _BOOT_STAGE2 boot2_w25x10cl
80 #elif PICO_BOOT_STAGE2_CHOOSE_AT25SF128A
81 #error "AT25SF128A boot2 is broken (FIXME)"
82 #define _BOOT_STAGE2 boot2_at25sf128a
83 #elif !defined(PICO_BOOT_STAGE2_CHOOSE_GENERIC_03H) || PICO_BOOT_STAGE2_CHOOSE_GENERIC_03H
84 #undef PICO_BOOT_STAGE2_CHOOSE_GENERIC_03H
85 #define PICO_BOOT_STAGE2_CHOOSE_GENERIC_03H 1
86 #define _BOOT_STAGE2 boot2_generic_03h
87 #else
88 #error no boot stage 2 is defined by PICO_BOOT_STAGE2_CHOOSE_ macro
89 #endif
90 // we can't include cdefs in assembly, so define our own, but avoid conflict with real ones for c inclusion
91 #define _PICO__STRING(x) #x
92 #define _PICO__XSTRING(x) _PICO__STRING(x)
93 #define _PICO__CONCAT1(x, y) x ## y
94 #define PICO_BOOT_STAGE2_NAME _PICO__XSTRING(_BOOT_STAGE2)
95 #define PICO_BOOT_STAGE2_ASM _PICO__XSTRING(_PICO__CONCAT1(_BOOT_STAGE2,.S))
96#endif
97#endif