Skip to content

Commit 7361d3d

Browse files
carlescufiAnas Nashif
authored andcommitted
config: bootloader: Add support for MCUboot
Add a new Kconfig option, BOOTLOADER_MCUBOOT, that automatically sets the required options necessary to make the resulting image bootable by the MCUboot open source bootloader. This includes the text section offset and the vector relay table for Cortex-M0, and in the future it might also add the DTS overlay required to link at slot0 offset in flash. Signed-off-by: Carles Cufi <[email protected]>
1 parent b8173d9 commit 7361d3d

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

arch/arm/core/cortex_m/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ config SW_VECTOR_RELAY
194194
bool
195195
prompt "Enable Cortex-M0 Vector Table soft relay"
196196
default n
197+
default y if BOOTLOADER_MCUBOOT
197198
depends on CPU_CORTEX_M0 && !CPU_CORTEX_M0_HAS_VECTOR_TABLE_REMAP
198199
help
199200
Add Cortex-M0 Vector Table relay handler and relay vector table, to

misc/Kconfig

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,16 @@ endif
4444
config TEXT_SECTION_OFFSET
4545
hex "TEXT section offset"
4646
default 0
47+
default 0x200 if BOOTLOADER_MCUBOOT
4748
help
48-
This sets and offset before the text section and allows booting images
49-
with custom headers that are inserted at the beginning of the image.
49+
If the application is built for chain-loading by a bootloader this
50+
variable is required to be set to value that leaves sufficient
51+
space between the beginning of the image and the start of the .text
52+
section to store an image header or any other metadata.
53+
In the particular case of the MCUboot bootloader this reserves enough
54+
space to store the image header, which should also meet vector table
55+
alignment requirements on most ARM targets, although some targets
56+
may require smaller or larger values.
5057

5158
config HAVE_CUSTOM_LINKER_SCRIPT
5259
prompt "Custom linker scripts provided"
@@ -273,6 +280,16 @@ config BOOTLOADER_SRAM_SIZE
273280
This option specifies the amount of SRAM (measure in kB) reserved for
274281
when Zephyr is to act as a bootloader.
275282

283+
config BOOTLOADER_MCUBOOT
284+
bool
285+
prompt "MCUboot bootloader support"
286+
default n
287+
help
288+
This option signifies that the target uses MCUboot as a bootloader,
289+
or in other words that the image is to be chain-loaded by MCUboot.
290+
This sets several required options in order for the image generated
291+
to be bootable using the MCUboot open source bootloader.
292+
276293
config BOOTLOADER_KEXEC
277294
bool
278295
prompt "Boot using Linux kexec() system call"

0 commit comments

Comments
 (0)