I'm trying to debug on the Thingy:53 platform using an Nordic DK as the J-Link intermediate. However, with NCS 2.6.1, adding `CONFIG_DEBUG=y` to the project configuration causes the network core binary to be way too big for flash (see output below). If I create an empty application with nothing in the configuration except `CONFIG_DEBUG=y`, then build for the Thingy:53 (or nRF5340-DK) board using NCS toolkit and SDK 2.6.1, the size of the flash image for the `tfm` component is ~64388/48640 B, 132.38% (see output below; without debug enabled it uses 65%). On NCS 2.5.2 and previous, it's still large (47944/48640 B, 98.57%) but it at least didn't cause any problems.
I tried to disable debugging on the network core by adding `CONFIG_DEBUG=n` to `child_image/empty_network_core.conf` (this is still a parent-child image, not using sysbuild) but this does not seem to work, maybe because this is triggering other flags as well. I've tried unsuccessfully to find a way to enable debugging only for the application core, there doesn't seem to be an obvious way to do this.
This raises two questions:
- How do I get around this? Even a blank application generates too much code to store in the 48KB TFM partition on the network core with debugging enabled. I really only care about debugging the application core.
- Even if I enable debugging on the application core only, does this imply debugging will no longer work on the application core with newer NCS versions? It doesn't matter to me, the network core doesn't run code I ever care to debug, but it's maybe problematic for others.
[165/169] Linking C executable bin/tfm_s.axf FAILED: bin/tfm_s.axf : && /opt/nordic/ncs/toolchains/580e4ef81c/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc -mcpu=cortex-m33+nofp -g -mcpu=cortex-m33+nofp --entry=Reset_Handler -specs=nano.specs -Wl,-check-sections -Wl,-fatal-warnings -Wl,--gc-sections -Wl,--no-wchar-size-warning -Wl,--print-memory-usage -Wl,-Map=/Users/awertz/Google/Personal/nordic/fricsense/blank/build/tfm/bin/tfm_s.map -mfloat-abi=soft -Wl,--cmse-implib,--out-implib=/Users/awertz/Google/Personal/nordic/fricsense/blank/build/tfm/secure_fw/s_veneers.o -T /Users/awertz/Google/Personal/nordic/fricsense/blank/build/tfm/platform/target/nrf5340/nrf_common/CMakeFiles/tfm_s_scatter.dir/./__/__/__/__/common/gcc/tfm_common_s.ld secure_fw/CMakeFiles/tfm_s.dir/partitions/ns_agent_tz/psa_api_veneers_v80m.o secure_fw/CMakeFiles/tfm_s.dir/__/platform/ext/target/nordic_nrf/common/core/startup.o secure_fw/CMakeFiles/tfm_s.dir/__/platform/ext/target/nordic_nrf/common/core/startup_nrf5340.o secure_fw/CMakeFiles/tfm_s.dir/__/platform/ext/common/faults.o secure_fw/CMakeFiles/tfm_s.dir/__/generated/secure_fw/partitions/crypto/auto_generated/load_info_tfm_crypto.o secure_fw/CMakeFiles/tfm_s.dir/__/generated/secure_fw/partitions/platform/auto_generated/load_info_tfm_platform.o secure_fw/CMakeFiles/tfm_s.dir/partitions/ns_agent_tz/load_info_ns_agent_tz.o secure_fw/CMakeFiles/tfm_s.dir/__/platform/ext/common/syscalls_stub.o -o bin/tfm_s.axf platform/libplatform_s.a secure_fw/partitions/lib/runtime/libtfm_sprt.a secure_fw/spm/libtfm_spm.a secure_fw/partitions/crypto/libtfm_psa_rot_partition_crypto.a platform/libplatform_crypto_keys.a secure_fw/partitions/crypto/mbedcrypto/nrf_security_src/libcrypto_service_mbedcrypto.a secure_fw/partitions/platform/libtfm_psa_rot_partition_platform.a platform/libplatform_s.a secure_fw/partitions/lib/runtime/libtfm_sprt.a secure_fw/spm/libtfm_spm.a secure_fw/partitions/crypto/libtfm_psa_rot_partition_crypto.a platform/libplatform_crypto_keys.a secure_fw/partitions/crypto/mbedcrypto/nrf_security_src/libcrypto_service_mbedcrypto.a secure_fw/partitions/platform/libtfm_psa_rot_partition_platform.a platform/libplatform_s.a secure_fw/partitions/lib/runtime/libtfm_sprt.a secure_fw/spm/libtfm_spm.a secure_fw/partitions/crypto/libtfm_psa_rot_partition_crypto.a platform/libplatform_crypto_keys.a secure_fw/partitions/crypto/mbedcrypto/nrf_security_src/libcrypto_service_mbedcrypto.a secure_fw/partitions/platform/libtfm_psa_rot_partition_platform.a /opt/nordic/ncs/v2.6.1/nrfxlib/crypto/nrf_cc312_platform/lib/cortex-m33/soft-float/no-interrupts/libnrf_cc312_platform_0.9.19.a /opt/nordic/ncs/v2.6.1/nrfxlib/crypto/nrf_oberon/lib/cortex-m33/soft-float/liboberon_mbedtls_3.0.14.a secure_fw/partitions/crypto/mbedcrypto/nrf_security_src/libmbedcrypto_base.a /opt/nordic/ncs/v2.6.1/nrfxlib/crypto/nrf_oberon/lib/cortex-m33/soft-float/liboberon_3.0.14.a && : /opt/nordic/ncs/toolchains/580e4ef81c/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld: address 0x1d460 of bin/tfm_s.axf section `.TFM_UNPRIV_CODE' is not within region `FLASH' /opt/nordic/ncs/toolchains/580e4ef81c/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld: address 0x1fc40 of bin/tfm_s.axf section `.gnu.sgstubs' is not within region `FLASH' /opt/nordic/ncs/toolchains/580e4ef81c/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld: bin/tfm_s.axf section `.TFM_DATA' will not fit in region `FLASH' /opt/nordic/ncs/toolchains/580e4ef81c/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld: address 0x1d460 of bin/tfm_s.axf section `.TFM_UNPRIV_CODE' is not within region `FLASH' /opt/nordic/ncs/toolchains/580e4ef81c/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld: address 0x1fc40 of bin/tfm_s.axf section `.gnu.sgstubs' is not within region `FLASH' /opt/nordic/ncs/toolchains/580e4ef81c/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld: region `FLASH' overflowed by 15748 bytes Memory region Used Size Region Size %age Used FLASH: 64388 B 48640 B 132.38% RAM: 14564 B 32 KB 44.45% collect2: error: ld returned 1 exit status ninja: build stopped: subcommand failed.