Relates to: Thingy91 nRF9160 SDK v2.6.1
I am having trouble successfully extending the size of the tfm partition. I took a sample static partition file from nrf\boards\arm\thingy91_nrf9160\thingy91_pm_static.yml. I was successful in building and flashing with this static partition file.
app: {address: 0x18000, size: 0x5b000} mcuboot: address: 0x0 placement: before: [mcuboot_primary] size: 0xc000 mcuboot_pad: address: 0xc000 placement: align: {start: 0x1000} before: [mcuboot_primary_app] size: 0x200 mcuboot_primary: address: 0xc000 size: 0x69000 span: [tfm, mcuboot_pad, app] mcuboot_primary_app: address: 0xc200 size: 0x68e00 span: [app, tfm] mcuboot_scratch: address: 0xde000 placement: after: [app] align: {start: 0x1000} size: 0x1e000 mcuboot_secondary: address: 0x75000 placement: after: [mcuboot_primary] align: {start: 0x1000} share_size: [mcuboot_primary] size: 0x69000 EMPTY_0: address: 0xfc000 size: 0x2000 settings_storage: address: 0xfe000 placement: after: [mcuboot_scratch] size: 0x2000 nonsecure_storage: address: 0xfe000 size: 0x2000 span: [settings_storage] tfm_secure: address: 0xc000 size: 0xc000 span: [mcuboot_pad, tfm] tfm_nonsecure: address: 0x18000 size: 0x5b000 span: [app] tfm: address: 0xc200 size: 0xbe00
I attempted to expand the size of the tfm partition for debugging the project after configuring the project with the following configurations.
CONFIG_DEBUG_OPTIMIZATIONS=y
CONFIG_SIZE_OPTIMIZATIONS=n
# modified the addres based on the tfm address plus size app: {address: 0x24000, size: 0x5b000} mcuboot: address: 0x0 placement: before: [mcuboot_primary] size: 0xc000 mcuboot_pad: address: 0xc000 placement: align: {start: 0x1000} before: [mcuboot_primary_app] size: 0x200 mcuboot_primary: address: 0xc000 size: 0x75000 span: [tfm, mcuboot_pad, app] mcuboot_primary_app: address: 0xc200 # modified the size based on app and tfm sizes size: 0x74e00 span: [app, tfm] mcuboot_scratch: # modified based on mcuboot_secondary address plus size address: 0xe2000 placement: after: [app] align: {start: 0x1000} size: 0x1e000 mcuboot_secondary: # modified based on tfm_nonsecure (includes the previous padding of 0x2000) address: 0x81000 placement: after: [mcuboot_primary] align: {start: 0x1000} share_size: [mcuboot_primary] # Reduced in size to fit into 0x100000 of primary flash size: 0x61000 EMPTY_0: # modified based on mcuboot_scratch address plus size address: 0xfe000 size: 0x0 settings_storage: # modified based on EMPTY_0 address plus size address: 0xfe000 placement: after: [mcuboot_scratch] size: 0x2000 nonsecure_storage: # modified based on EMPTY_0 address plus size address: 0xfe000 size: 0x2000 span: [settings_storage] tfm_secure: address: 0xc000 # modified to be the sum of the sizes of mcuboot_pad and tfm size: 0x17e00 span: [mcuboot_pad, tfm] tfm_nonsecure: # modified to be the address plus the size of tfm_secure address: 0x23e00 size: 0x5b00 span: [app] tfm: address: 0xc200 # modified from size 0xbe00 size: 0x17c00
My build configuration is as follows.
When building, I get the following error related to the static partition. #error "TF-M non-secure start address is not aligned to SPU HW requirements"
Note that I intended to set the tfm_nonsecure start address to 0x24000. After reading related threads RE: "Partition alignment error" after upgrading the SDK from v2.2.0 to v2.5.0
I attempted different starting addresses: 0x24000, 0x23e00, 0x24200. Changing to these starting addresses did not seem to fix the issue.
What might be a solution here?