Debug build

Hello,

I created a copy of the nRF Cloud CoAP Device Message sample application for the Thingy 91 X.  It builds using the default optimization level.  However it fails to build when I select "Optimize for debugging (-Og)".

The tfm_s section is too small for the generated code.

Here is a copy of the build output.

-- Build files have been written to: D:/Work/nrf_cloud_coap_device_message/build/nrf_cloud_coap_device_message/tfm
[17/493] Performing build step for 'tfm'
[149/153] Linking C executable bin\tfm_s.axf
FAILED: bin/tfm_s.axf
cmd.exe /C "cd . && C:\ncs\toolchains\fd21892d0f\opt\zephyr-sdk\arm-zephyr-eabi\bin\arm-zephyr-eabi-gcc.exe -mcpu=cortex-m33 -g -mcpu=cortex-m33 --entry=Reset_Handler -specs=nano.specs -specs=nosys.specs -Wl,-check-sections -Wl,-fatal-warnings -Wl,--gc-sections -Wl,--no-wchar-size-warning -Wl,--print-memory-usage -Wl,-Map=D:/Work/nrf_cloud_coap_device_message/build/nrf_cloud_coap_device_message/tf                                                                                                                                                    fm/bin/tfm_s.map -mfloat-abi=hard -mfpu=fpv5-sp-d16 -Wl,--cmse-implib,--out-implib=D:/Work/nrf_cloud_coap_device_message/build/nrf_cloud_coap_device_message/tfm/secure_fw/s_veneers.o -T D:/Work/nrf_clo                                                                                                                                                    oud_coap_device_message/build/nrf_cloud_coap_device_message/tfm/platform/target/nrf91/nrf_common/CMakeFiles/tfm_s_scatter.dir/./__/__/__/__/generated/platform/ext/common/gcc/tfm_common_s.ld @CMakeFiles                                                                                                                                                    s\tfm_s.rsp -o bin\tfm_s.axf  && cd ."
c:/ncs/toolchains/fd21892d0f/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.exe: address 0x3971b of bin\tfm_s.axf section `.ER_TFM_CODE' is not within region `FLASH'
c:/ncs/toolchains/fd21892d0f/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.exe: address 0x3c520 of bin\tfm_s.axf section `.TFM_UNPRIV_CODE' is not within region `FLASH'
c:/ncs/toolchains/fd21892d0f/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.exe: address 0x3fc40 of bin\tfm_s.axf section `.gnu.sgstubs' is not within region `FLASH'
c:/ncs/toolchains/fd21892d0f/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.exe: bin\tfm_s.axf section `.TFM_DATA' will not fit in region `FLASH'
c:/ncs/toolchains/fd21892d0f/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.exe: address 0x3971b of bin\tfm_s.axf section `.ER_TFM_CODE' is not within region `FLASH'
c:/ncs/toolchains/fd21892d0f/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.exe: address 0x3c520 of bin\tfm_s.axf section `.TFM_UNPRIV_CODE' is not within region `FLASH'
c:/ncs/toolchains/fd21892d0f/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.exe: address 0x3fc40 of bin\tfm_s.axf section `.gnu.sgstubs' is not within region `FLASH'
c:/ncs/toolchains/fd21892d0f/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.exe: region `FLASH' overflowed by 32236 bytes
Memory region         Used Size  Region Size  %age Used
           FLASH:       64492 B      32256 B    199.94%
             RAM:       14560 B        16 KB     88.87%
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

-----------------------------

I tried copying partitions.yml from the build folder to the root folder and modified to increase the tfm section.  Unfortunately the build process does not seem to recognize the memory map.

I tried naming it pm.yml and pm_static.yml.

Neither seem to be accepted.

Here is the options selected for the build configuration.

Here is the generated partitions.yml file.

app:
  address: 0x38000
  end_address: 0x100000
  region: flash_primary
  size: 0xc8000
app_image:
  address: 0x30200
  end_address: 0x100000
  region: flash_primary
  size: 0xcfe00
  span:
  - tfm
  - app
b0:
  address: 0x0
  end_address: 0x8000
  region: flash_primary
  size: 0x8000
b0_container:
  address: 0x0
  end_address: 0x8000
  region: flash_primary
  size: 0x8000
  span:
  - b0
external_flash:
  address: 0x4d2000
  end_address: 0x2000000
  region: external_flash
  size: 0x1b2e000
fmfu_storage:
  address: 0xd0000
  device: DT_CHOSEN(nordic_pm_ext_flash)
  end_address: 0x4d0000
  region: external_flash
  size: 0x400000
mcuboot:
  address: 0x8200
  end_address: 0x1c000
  region: flash_primary
  size: 0x13e00
mcuboot_pad:
  address: 0x30000
  end_address: 0x30200
  region: flash_primary
  size: 0x200
mcuboot_primary:
  address: 0x30000
  end_address: 0x100000
  region: flash_primary
  size: 0xd0000
  span:
  - mcuboot_pad
  - app
  - tfm
mcuboot_primary_app:
  address: 0x30200
  end_address: 0x100000
  region: flash_primary
  size: 0xcfe00
  span:
  - tfm
  - app
mcuboot_secondary:
  address: 0x0
  device: DT_CHOSEN(nordic_pm_ext_flash)
  end_address: 0xd0000
  region: external_flash
  share_size:
  - mcuboot_primary
  size: 0xd0000
mcuboot_sram:
  address: 0x20000000
  end_address: 0x20040000
  orig_span: &id001
  - sram_primary
  - nrf_modem_lib_rx
  - nrf_modem_lib_tx
  - nrf_modem_lib_ctrl
  - tfm_sram
  region: sram_primary
  size: 0x40000
  span: *id001
nrf_modem_lib_ctrl:
  address: 0x20004000
  end_address: 0x200044e8
  inside:
  - sram_nonsecure
  placement:
    after:
    - tfm_sram
    - start
  region: sram_primary
  size: 0x4e8
nrf_modem_lib_rx:
  address: 0x20006568
  end_address: 0x20008568
  inside:
  - sram_nonsecure
  placement:
    after:
    - nrf_modem_lib_tx
  region: sram_primary
  size: 0x2000
nrf_modem_lib_sram:
  address: 0x20004000
  end_address: 0x20008568
  orig_span: &id002
  - nrf_modem_lib_ctrl
  - nrf_modem_lib_tx
  - nrf_modem_lib_rx
  region: sram_primary
  size: 0x4568
  span: *id002
nrf_modem_lib_tx:
  address: 0x200044e8
  end_address: 0x20006568
  inside:
  - sram_nonsecure
  placement:
    after:
    - nrf_modem_lib_ctrl
  region: sram_primary
  size: 0x2080
otp:
  address: 0xff8388
  end_address: 0xff83fc
  region: otp
  size: 0x74
provision:
  address: 0xff8108
  end_address: 0xff8388
  region: otp
  size: 0x280
s0:
  address: 0x8000
  end_address: 0x1c000
  region: flash_primary
  size: 0x14000
  span:
  - mcuboot
  - s0_pad
s0_image:
  address: 0x8200
  end_address: 0x1c000
  region: flash_primary
  size: 0x13e00
  span:
  - mcuboot
s0_pad:
  address: 0x8000
  end_address: 0x8200
  region: flash_primary
  share_size:
  - mcuboot_pad
  size: 0x200
s1:
  address: 0x1c000
  end_address: 0x30000
  region: flash_primary
  size: 0x14000
  span:
  - s1_pad
  - s1_image
s1_image:
  address: 0x1c200
  end_address: 0x30000
  region: flash_primary
  share_size:
  - mcuboot
  size: 0x13e00
s1_pad:
  address: 0x1c000
  end_address: 0x1c200
  region: flash_primary
  share_size:
  - mcuboot_pad
  size: 0x200
settings_storage:
  address: 0x4d0000
  device: DT_CHOSEN(nordic_pm_ext_flash)
  end_address: 0x4d2000
  region: external_flash
  size: 0x2000
sram_nonsecure:
  address: 0x20004000
  end_address: 0x20040000
  orig_span: &id003
  - sram_primary
  - nrf_modem_lib_ctrl
  - nrf_modem_lib_tx
  - nrf_modem_lib_rx
  region: sram_primary
  size: 0x3c000
  span: *id003
sram_primary:
  address: 0x20008568
  end_address: 0x20040000
  region: sram_primary
  size: 0x37a98
sram_secure:
  address: 0x20000000
  end_address: 0x20004000
  orig_span: &id004
  - tfm_sram
  region: sram_primary
  size: 0x4000
  span: *id004
tfm:
  address: 0x30200
  end_address: 0x38000
  region: flash_primary
  size: 0x7e00
tfm_nonsecure:
  address: 0x38000
  end_address: 0x100000
  region: flash_primary
  size: 0xc8000
  span:
  - app
tfm_secure:
  address: 0x30000
  end_address: 0x38000
  region: flash_primary
  size: 0x8000
  span:
  - mcuboot_pad
  - tfm
tfm_sram:
  address: 0x20000000
  end_address: 0x20004000
  inside:
  - sram_secure
  placement:
    after:
    - start
  region: sram_primary
  size: 0x4000

Can someone help me work this out?

Parents Reply Children
No Data
Related