!!!Partition alignment error!!!

Dear Nordic Engineers

I used gd25lq32e to replace mx25r6435 and it is a 32Mbit Flash, when I add it to the Devicetree of Lwmwm(NCS 2.6.1), the build will report the following log:

!!!Partition alignment error!!!
The non-secure start address in pm_static.yml or generated partition.yml is: 0x1be00
which is not aligned with the SPU HW requirements.
Refer to the documentation section 'TF-M partition alignment requirements'
for more information.

'
18 | #pragma message \
| ^~~~~~~
E:/NCS/v2.6.1/nrf/modules/trusted-firmware-m/tfm_boards/common/assert.c:27:2: error: #error "TF-M non-secure start address is not aligned to SPU HW requirements"
27 | #error "TF-M non-secure start address is not aligned to SPU HW requirements"
| ^~~~~
ninja: build stopped: subcommand failed.

I tried to set CONFIG_PM_PARTITION_SIZE_TFM=0x8000, but it didn't work.

This is my partitions.yml, please give me some good suggestions.

EMPTY_0:
  address: 0xf2000
  end_address: 0xf8000
  placement:
    after:
    - settings_storage
  region: flash_primary
  size: 0x6000
EMPTY_tfm_ps:
  address: 0xfc000
  end_address: 0x100000
  region: flash_primary
  size: 0x4000
app:
  address: 0x1be00
  end_address: 0xe8000
  region: flash_primary
  size: 0xcc200
external_flash:
  address: 0x4d4200
  end_address: 0x400000
  region: external_flash
  size: -0xd4200
fmfu_storage:
  address: 0xd4200
  align: 0x10000
  device: DT_CHOSEN(nordic_pm_ext_flash)
  end_address: 0x4d4200
  placement:
    before:
    - end
  region: external_flash
  size: 0x400000
mcuboot:
  address: 0x0
  end_address: 0x13e00
  placement:
    before:
    - mcuboot_primary
  region: flash_primary
  size: 0x13e00
mcuboot_pad:
  address: 0x13e00
  end_address: 0x14000
  placement:
    before:
    - mcuboot_primary_app
  region: flash_primary
  size: 0x200
mcuboot_primary:
  address: 0x13e00
  end_address: 0xe8000
  orig_span: &id001
  - app
  - mcuboot_pad
  - tfm
  region: flash_primary
  size: 0xd4200
  span: *id001
mcuboot_primary_app:
  address: 0x14000
  end_address: 0xe8000
  orig_span: &id002
  - app
  - tfm
  region: flash_primary
  size: 0xd4000
  span: *id002
mcuboot_secondary:
  address: 0x0
  device: DT_CHOSEN(nordic_pm_ext_flash)
  end_address: 0xd4200
  placement:
    align:
      start: 0x4
  region: external_flash
  share_size:
  - mcuboot_primary
  size: 0xd4200
mcuboot_sram:
  address: 0x20000000
  end_address: 0x20016000
  orig_span: &id003
  - tfm_sram
  region: sram_primary
  size: 0x16000
  span: *id003
nonsecure_storage:
  address: 0xe8000
  end_address: 0xf2000
  orig_span: &id004
  - settings_storage
  - nvs_storage
  region: flash_primary
  size: 0xa000
  span: *id004
nrf_modem_lib_ctrl:
  address: 0x20016000
  end_address: 0x200164e8
  inside:
  - sram_nonsecure
  placement:
    after:
    - tfm_sram
    - start
  region: sram_primary
  size: 0x4e8
nrf_modem_lib_rx:
  address: 0x20018568
  end_address: 0x2001a568
  inside:
  - sram_nonsecure
  placement:
    after:
    - nrf_modem_lib_tx
  region: sram_primary
  size: 0x2000
nrf_modem_lib_sram:
  address: 0x20016000
  end_address: 0x2001a568
  orig_span: &id005
  - nrf_modem_lib_ctrl
  - nrf_modem_lib_tx
  - nrf_modem_lib_rx
  region: sram_primary
  size: 0x4568
  span: *id005
nrf_modem_lib_tx:
  address: 0x200164e8
  end_address: 0x20018568
  inside:
  - sram_nonsecure
  placement:
    after:
    - nrf_modem_lib_ctrl
  region: sram_primary
  size: 0x2080
nvs_storage:
  address: 0xe8000
  end_address: 0xf0000
  inside:
  - nonsecure_storage
  placement:
    align:
      start: 0x8000
    before:
    - settings_storage
  region: flash_primary
  size: 0x8000
otp:
  address: 0xff8108
  end_address: 0xff83fc
  region: otp
  size: 0x2f4
settings_storage:
  address: 0xf0000
  end_address: 0xf2000
  inside:
  - nonsecure_storage
  placement:
    align:
      start: 0x8000
    before:
    - end
  region: flash_primary
  size: 0x2000
sram_nonsecure:
  address: 0x20016000
  end_address: 0x20040000
  orig_span: &id006
  - sram_primary
  - nrf_modem_lib_ctrl
  - nrf_modem_lib_tx
  - nrf_modem_lib_rx
  region: sram_primary
  size: 0x2a000
  span: *id006
sram_primary:
  address: 0x2001a568
  end_address: 0x20040000
  region: sram_primary
  size: 0x25a98
sram_secure:
  address: 0x20000000
  end_address: 0x20016000
  orig_span: &id007
  - tfm_sram
  region: sram_primary
  size: 0x16000
  span: *id007
tfm:
  address: 0x14000
  end_address: 0x1be00
  inside:
  - mcuboot_primary_app
  placement:
    before:
    - app
  region: flash_primary
  size: 0x7e00
tfm_its:
  address: 0xf8000
  end_address: 0xfa000
  region: flash_primary
  size: 0x2000
tfm_nonsecure:
  address: 0x1be00
  end_address: 0xe8000
  orig_span: &id008
  - app
  region: flash_primary
  size: 0xcc200
  span: *id008
tfm_otp_nv_counters:
  address: 0xfa000
  end_address: 0xfc000
  region: flash_primary
  size: 0x2000
tfm_secure:
  address: 0x13e00
  end_address: 0x1be00
  orig_span: &id009
  - mcuboot_pad
  - tfm
  region: flash_primary
  size: 0x8000
  span: *id009
tfm_sram:
  address: 0x20000000
  end_address: 0x20016000
  inside:
  - sram_secure
  placement:
    after:
    - start
  region: sram_primary
  size: 0x16000
tfm_storage:
  address: 0xf8000
  end_address: 0x100000
  region: flash_primary
  size: 0x8000
  span:
  - EMPTY_tfm_ps
  - tfm_its
  - tfm_otp_nv_counters

Best regards,

Hannibal

  • Hi Andreas

    I tried to set 

    CONFIG_NRF_SPU_FLASH_REGION_SIZE=0x8000 and set pm_static.yml as same as you gave me the description of the document:
    tfm_secure:
      address: 0x14000
      size: 0x8000
      span: 
      - mcuboot_pad
      - tfm
    
    mcuboot_pad:
      address: 0x14000
      size: 0x0
    
    tfm:
      address: 0x14000
      size: 0x8000
    
    tfm_nonsecure:
      address: 0x1C000
      span:
      - app
      size: 0x8000
    
    app:
      address: 0x1C000
      size: 0x8000
    But, it still didn't have any improvement.  The build still failed because of  [!!!Partition alignment error!!!].
    !!!Partition alignment error!!!
    The non-secure start address in pm_static.yml or generated partition.yml is: 0x1c000
    which is not aligned with the SPU HW requirements.
    Refer to the documentation section 'TF-M partition alignment requirements'
    for more information.
    
       '
       18 | #pragma message \
          |         ^~~~~~~
    E:/NCS/v2.6.1/nrf/modules/trusted-firmware-m/tfm_boards/common/assert.c:27:2: error: #error "TF-M non-secure start address is not aligned to SPU HW requirements"
       27 | #error "TF-M non-secure start address is not aligned to SPU HW requirements"
          |  ^~~~~
    ninja: build stopped: subcommand failed.
     
    I'm about to go crazy over this issue, can you help me try it out? I use the above .conf and overlay to port to the lwmwm_client (NCS V2.6.0) and it will recur this problem.
    Best regards,
    Hannibal
Related