Hi, I have two firmware images: A and B which I need to make compatible for OTA (DFU over BLE using MCUBoot - the standard process described in the devacademy course). They're both using the same (custom) private key and currently, I am trying to make sure they both share a common pm_static.yml file. From going through some discussions here I've understood that the common practice is to freeze the dynamically generated partitions.yml file into a pm_static.yml when done. But this will not work for me because A and B produce different partitions.yml
Below I have provided their dynamically generated partitions (TLDR: A's app sizes are larger by 0x1000 BUT B has a settings_storage entry that A does not).
A's partitions.yml:
app: address: 0xc200 end_address: 0x46000 region: flash_primary size: 0x39e00 mcuboot: address: 0x0 end_address: 0xc000 placement: before: - mcuboot_primary region: flash_primary size: 0xc000 mcuboot_pad: address: 0xc000 end_address: 0xc200 placement: align: start: 0x1000 before: - mcuboot_primary_app region: flash_primary size: 0x200 mcuboot_primary: address: 0xc000 end_address: 0x46000 orig_span: &id001 - app - mcuboot_pad region: flash_primary sharers: 0x1 size: 0x3a000 span: *id001 mcuboot_primary_app: address: 0xc200 end_address: 0x46000 orig_span: &id002 - app region: flash_primary size: 0x39e00 span: *id002 mcuboot_secondary: address: 0x46000 end_address: 0x80000 placement: after: - mcuboot_primary align: start: 0x1000 align_next: 0x1000 region: flash_primary share_size: - mcuboot_primary size: 0x3a000 sram_primary: address: 0x20000000 end_address: 0x20010000 region: sram_primary size: 0x10000
B's partitions.yml:
app: address: 0xc200 end_address: 0x45000 region: flash_primary size: 0x38e00 mcuboot: address: 0x0 end_address: 0xc000 placement: before: - mcuboot_primary region: flash_primary size: 0xc000 mcuboot_pad: address: 0xc000 end_address: 0xc200 placement: align: start: 0x1000 before: - mcuboot_primary_app region: flash_primary size: 0x200 mcuboot_primary: address: 0xc000 end_address: 0x45000 orig_span: &id001 - app - mcuboot_pad region: flash_primary sharers: 0x1 size: 0x39000 span: *id001 mcuboot_primary_app: address: 0xc200 end_address: 0x45000 orig_span: &id002 - app region: flash_primary size: 0x38e00 span: *id002 mcuboot_secondary: address: 0x45000 end_address: 0x7e000 placement: after: - mcuboot_primary align: start: 0x1000 region: flash_primary share_size: - mcuboot_primary size: 0x39000 settings_storage: address: 0x7e000 end_address: 0x80000 placement: align: start: 0x1000 before: - end region: flash_primary size: 0x2000 sram_primary: address: 0x20000000 end_address: 0x20010000 region: sram_primary size: 0x10000
My goal is to create a single pm_static.yml that both the builds of A and B can use. My approach: take A's app sizes (since they are larger and would accommodate B) and relocate settings_storage by an appropriate amount 0x2000 and making sure there are no gaps:
app:
address: 0xc200
end_address: 0x46000
region: flash_primary
size: 0x39e00
mcuboot:
address: 0x0
end_address: 0xc000
placement:
before:
- mcuboot_primary
region: flash_primary
size: 0xc000
mcuboot_pad:
address: 0xc000
end_address: 0xc200
placement:
align:
start: 0x1000
before:
- mcuboot_primary_app
region: flash_primary
size: 0x200
mcuboot_primary:
address: 0xc000
end_address: 0x46000
orig_span: &id001
- app
- mcuboot_pad
region: flash_primary
sharers: 0x1
size: 0x3a000
span: *id001
mcuboot_primary_app:
address: 0xc200
end_address: 0x46000
orig_span: &id002
- app
region: flash_primary
size: 0x39e00
span: *id002
mcuboot_secondary:
address: 0x46000
end_address: 0x80000
placement:
after:
- mcuboot_primary
align:
start: 0x1000
align_next: 0x1000
region: flash_primary
share_size:
- mcuboot_primary
size: 0x3a000
settings_storage:
address: 0x80000
end_address: 0x82000
placement:
align:
start: 0x1000
before:
- end
region: flash_primary
size: 0x2000
sram_primary:
address: 0x20000000
end_address: 0x20010000
region: sram_primary
size: 0x10000
As you can see: the app sizes are made to match that of A and settings_storage is relocated from (0x7e000 - 0x80000) to (0x80000 - 0x82000). When trying to build, both compile just fine. But B fails to run with the error:
bt_settings: settings_subsys_init failed (err -33)
and the bt module fails to load completely (i do not see any advertising).
My question is: is it possible to change the start and end addresses for the storage_settings like I am attempting to do? Any suggestions are welcome.