Skip to content

Commit 9457715

Browse files
Emil-JuhlEmil-Juhl
authored andcommitted
pm: add inequally sized primary and secondary partitions
The default configuration of MCUboot is intended to swap between two application images. Hence it makes sense that the sizes of both the primary and secondary partition are equal. In the B&O use case, however, the secondary partition is only used to store the net-core image, while the primary partition is used to store the app-core image. In this case it makes sense to allow inequal sizes as the net-core only has 256kB flash while the default equally sized partitions typically left around 450kB for the secondary image as well. This is implemented as two Kconfigs. One to allow inequal sizes and one to specify the size of the secondary partition. The primary partition will eat up all residual space.
1 parent 766be5d commit 9457715

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

boot/zephyr/Kconfig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,21 @@ config SINGLE_APPLICATION_SLOT
6767
uploading a new application overwrites the one that previously
6868
occupied the area.
6969

70+
config PM_PARTITION_SIZE_MCUBOOT_INEQUAL_PRIMARY_SECONDARY
71+
bool "Accept inequally sized primary and secondary partitions"
72+
default n
73+
help
74+
The primary partition is used for app-core
75+
image and the secondary partition is used
76+
for net-core image.
77+
78+
config PM_PARTITION_SIZE_MCUBOOT_SECONDARY
79+
hex "Size of the secondary mcuboot partition"
80+
default 0x40000
81+
depends on PM_PARTITION_SIZE_MCUBOOT_INEQUAL_PRIMARY_SECONDARY
82+
help
83+
The secondary mcuboot partition is used for net-core image
84+
7085
config MCUBOOT_SERIAL_MCUMGR_SIMPLE_IMAGE_INDEX
7186
bool "mcumgr:image_upload assumes n=1+image*2+slot"
7287
default n

boot/zephyr/pm.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@ mcuboot_primary:
1717
# slot configuration.
1818
#if !defined(CONFIG_SINGLE_APPLICATION_SLOT) && !defined(CONFIG_BOOT_DIRECT_XIP)
1919
mcuboot_secondary:
20+
#if defined(CONFIG_PM_PARTITION_SIZE_MCUBOOT_INEQUAL_PRIMARY_SECONDARY) && defined(CONFIG_PM_PARTITION_SIZE_MCUBOOT_SECONDARY)
21+
size: CONFIG_PM_PARTITION_SIZE_MCUBOOT_SECONDARY
22+
#else
2023
share_size: [mcuboot_primary]
24+
#endif /* defined(CONFIG_PM_PARTITION_SIZE_MCUBOOT_INEQUAL_PRIMARY_SECONDARY) && defined(CONFIG_PM_PARTITION_SIZE_MCUBOOT_SECONDARY) */
2125
#if defined(CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY)
2226
region: external_flash
2327
placement:
@@ -44,7 +48,11 @@ mcuboot_secondary_pad:
4448
align: {start: CONFIG_FPROTECT_BLOCK_SIZE}
4549

4650
mcuboot_secondary_app:
51+
#if defined(CONFIG_PM_PARTITION_SIZE_MCUBOOT_INEQUAL_PRIMARY_SECONDARY) && defined(CONFIG_PM_PARTITION_SIZE_MCUBOOT_SECONDARY)
52+
size: CONFIG_PM_PARTITION_SIZE_MCUBOOT_SECONDARY
53+
#else
4754
share_size: mcuboot_primary_app
55+
#endif /* defined(CONFIG_PM_PARTITION_SIZE_MCUBOOT_INEQUAL_PRIMARY_SECONDARY) && defined(CONFIG_PM_PARTITION_SIZE_MCUBOOT_SECONDARY) */
4856
placement:
4957
after: mcuboot_secondary_pad
5058

0 commit comments

Comments
 (0)