We are trying to upgrade our SDK from 2.1.2 to 2.2.0 then 2.30 but we have encountered a very hard to track down bug.
I cannot share the actual app code but the core is very similar to the nrf asset tracker v2 (uses mcuboot).
What's wrong:
- The app builds and runs great on SDK 2.1.2
- The app builds but does not run on SDK 2.2.0 or SDK. 2.3.0. We get an endless loop (mcuboot runs fine and can be interrupted for serial recovery) but the app crashes silently before it can print or debug anything.
What we tried:
I followed all the update notes from this thread: devzone.nordicsemi.com/.../problems-migrating-nrf5340-project-from-sdk-1-9-1-to-2-3-0
We still have a silent boot loop....
After a TON of digging and debugging I tracked it down to a section of code. We use FCB settings storage and if we comment out the line
/ { chosen { zephyr,settings-partition=&storage_partition; }; };
int soc_secure_mem_read(void *dst, void *src, size_t len
)
)tfm_platform_mem_read(dst, (uintptr_t)src, len, &result
);
returns
# Settings - Used to store real-time device configuration to flash. CONFIG_FCB=y CONFIG_SETTINGS=y CONFIG_SETTINGS_FCB=y # Flash - Used in FOTA, settings and storage CONFIG_FLASH=y CONFIG_FLASH_PAGE_LAYOUT=y CONFIG_FLASH_MAP=y CONFIG_STREAM_FLASH=y CONFIG_MPU_ALLOW_FLASH_WRITE=y # MCUBOOT CONFIG_BOOTLOADER_MCUBOOT=y CONFIG_IMG_MANAGER=y CONFIG_MCUBOOT_IMG_MANAGER=y CONFIG_IMG_ERASE_PROGRESSIVELY=y CONFIG_SECURE_BOOT=y CONFIG_BUILD_S1_VARIANT=y
&flash0 { partitions { compatible = "fixed-partitions"; #address-cells = <1>; #size-cells = <1>; boot_partition: partition@0 { label = "mcuboot"; reg = <0x00000000 0x10000>; }; slot0_partition: partition@10000 { label = "image-0"; }; slot0_ns_partition: partition@50000 { label = "image-0-nonsecure"; }; slot1_partition: partition@80000 { label = "image-1"; }; slot1_ns_partition: partition@c0000 { label = "image-1-nonsecure"; }; scratch_partition: partition@f0000 { label = "image-scratch"; reg = <0x000f0000 0xa000>; }; storage_partition: partition@fa000 { label = "storage"; reg = <0x000fa000 0x00006000>; }; }; };
I'm guessing that there must be some kind of update to TFM or to the FCB flash region that we are no longer compatible with. Any help would be greatly appreciated. Thank you.