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.
Can someone help me work this out?

