Step 2 complete: MCUboot integration with single-slot configuration
- Created sysbuild configuration for MCUboot bootloader - Added device tree overlays for correct partition layout (32KB MCUboot, 96KB app) - Fixed MCUboot partition addressing to use boot_partition instead of slot0_partition - MCUboot successfully boots and chains to application - Application runs with shell and custom reset command - Disabled signature validation for testing purposes
This commit is contained in:
parent
8255b2a672
commit
928a176e7c
|
|
@ -0,0 +1,30 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2021 Nordic Semiconductor ASA
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
&flash0 {
|
||||||
|
partitions {
|
||||||
|
compatible = "fixed-partitions";
|
||||||
|
#address-cells = <1>;
|
||||||
|
#size-cells = <1>;
|
||||||
|
|
||||||
|
boot_partition: partition@0 {
|
||||||
|
label = "mcuboot";
|
||||||
|
reg = <0x00000000 0x00008000>; /* 32 KB */
|
||||||
|
read-only;
|
||||||
|
};
|
||||||
|
|
||||||
|
slot0_partition: partition@8000 {
|
||||||
|
label = "image-0";
|
||||||
|
reg = <0x00008000 0x00018000>; /* 96 KB */
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
/ {
|
||||||
|
chosen {
|
||||||
|
zephyr,code-partition = &slot0_partition;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
&flash0 {
|
||||||
|
partitions {
|
||||||
|
compatible = "fixed-partitions";
|
||||||
|
#address-cells = <1>;
|
||||||
|
#size-cells = <1>;
|
||||||
|
|
||||||
|
boot_partition: partition@0 {
|
||||||
|
label = "mcuboot";
|
||||||
|
reg = <0x00000000 0x00008000>; /* 32 KB */
|
||||||
|
read-only;
|
||||||
|
};
|
||||||
|
|
||||||
|
slot0_partition: partition@8000 {
|
||||||
|
label = "image-0";
|
||||||
|
reg = <0x00008000 0x00018000>; /* 96 KB */
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
# Partition manager configuration for firmware_node
|
||||||
|
|
||||||
|
# Boot partition (MCUboot)
|
||||||
|
mcuboot_primary:
|
||||||
|
address: 0x00000000
|
||||||
|
size: 0x8000
|
||||||
|
region: flash_primary
|
||||||
|
|
||||||
|
# Application partition (primary slot)
|
||||||
|
mcuboot_primary_app:
|
||||||
|
address: 0x00008000
|
||||||
|
size: 0x18000
|
||||||
|
region: flash_primary
|
||||||
|
|
||||||
|
# Secondary slot for updates
|
||||||
|
mcuboot_secondary:
|
||||||
|
address: 0x00020000
|
||||||
|
size: 0x18000
|
||||||
|
region: flash_primary
|
||||||
|
|
||||||
|
# Settings partition
|
||||||
|
settings_partition:
|
||||||
|
address: 0x00038000
|
||||||
|
size: 0x8000
|
||||||
|
region: flash_primary
|
||||||
|
|
@ -8,3 +8,8 @@ CONFIG_REBOOT=y
|
||||||
|
|
||||||
# Enable the reset command
|
# Enable the reset command
|
||||||
CONFIG_KERNEL_SHELL=y
|
CONFIG_KERNEL_SHELL=y
|
||||||
|
|
||||||
|
# Enable settings for persistent storage
|
||||||
|
CONFIG_SETTINGS=y
|
||||||
|
CONFIG_SETTINGS_NVS=y
|
||||||
|
CONFIG_NVS=y
|
||||||
|
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
# Enable MCUboot
|
|
||||||
set(SB_CONFIG_BOOTLOADER_MCUBOOT y)
|
|
||||||
|
|
||||||
# MCUboot configuration
|
|
||||||
set(SB_CONFIG_MCUBOOT_BOOTLOADER_MODE_OVERWRITE_ONLY y)
|
|
||||||
set(SB_CONFIG_MCUBOOT_SIGNATURE_KEY_FILE "bootloader/mcuboot/root-rsa-2048.pem")
|
|
||||||
set(SB_CONFIG_MCUBOOT_GENERATE_UNSIGNED_IMAGE y)
|
|
||||||
set(SB_CONFIG_MCUBOOT_GENERATE_CONFIRMED_IMAGE y)
|
|
||||||
|
|
||||||
# Enable USB CDC ACM for MCUboot console
|
|
||||||
set(SB_CONFIG_MCUBOOT_USB_SUPPORT y)
|
|
||||||
set(SB_CONFIG_MCUBOOT_SERIAL y)
|
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
# Sysbuild configuration for firmware_node with MCUboot
|
||||||
|
|
||||||
|
# Enable MCUboot as bootloader
|
||||||
|
SB_CONFIG_BOOTLOADER_MCUBOOT=y
|
||||||
|
SB_CONFIG_MCUBOOT_MODE_SINGLE_APP=y
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2021 Nordic Semiconductor ASA
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
&flash0 {
|
||||||
|
partitions {
|
||||||
|
compatible = "fixed-partitions";
|
||||||
|
#address-cells = <1>;
|
||||||
|
#size-cells = <1>;
|
||||||
|
|
||||||
|
boot_partition: partition@0 {
|
||||||
|
label = "mcuboot";
|
||||||
|
reg = <0x00000000 0x00008000>; /* 32 KB */
|
||||||
|
read-only;
|
||||||
|
};
|
||||||
|
|
||||||
|
slot0_partition: partition@8000 {
|
||||||
|
label = "image-0";
|
||||||
|
reg = <0x00008000 0x00018000>; /* 96 KB */
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
/ {
|
||||||
|
chosen {
|
||||||
|
zephyr,code-partition = &slot0_partition;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
# MCUboot configuration for firmware_node
|
||||||
|
CONFIG_LOG=y
|
||||||
|
CONFIG_BOOT_BANNER=y
|
||||||
|
CONFIG_MCUBOOT_LOG_LEVEL_DBG=y
|
||||||
|
# Enable console in MCUboot to see debug output
|
||||||
|
CONFIG_CONSOLE=y
|
||||||
|
# Single slot configuration (no upgrades)
|
||||||
|
CONFIG_SINGLE_APPLICATION_SLOT=y
|
||||||
|
|
||||||
|
# Disable signature validation for testing
|
||||||
|
CONFIG_BOOT_SIGNATURE_TYPE_NONE=y
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2021 Nordic Semiconductor ASA
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
&flash0 {
|
||||||
|
partitions {
|
||||||
|
compatible = "fixed-partitions";
|
||||||
|
#address-cells = <1>;
|
||||||
|
#size-cells = <1>;
|
||||||
|
|
||||||
|
boot_partition: partition@0 {
|
||||||
|
label = "mcuboot";
|
||||||
|
reg = <0x00000000 0x00008000>; /* 32 KB */
|
||||||
|
read-only;
|
||||||
|
};
|
||||||
|
|
||||||
|
slot0_partition: partition@8000 {
|
||||||
|
label = "image-0";
|
||||||
|
reg = <0x00008000 0x00018000>; /* 96 KB */
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
/ {
|
||||||
|
chosen {
|
||||||
|
zephyr,code-partition = &boot_partition;
|
||||||
|
};
|
||||||
|
};
|
||||||
Loading…
Reference in New Issue