Using CONFIG_DEBUG_OPTIMIZATIONS with Thingy:91 and Asset Tracker v2

I'm getting started with the nRF Connect SDK v2.6 and the Asset Tracker v2 application on a Thingy:91.
I can build and flash the unmodified app, and it pushes sensor data to nRF Cloud, using both `overlay-debug.conf` and `overlay-low-power.conf`.
When I set CONFIG_DEBUG_OPTIMIZATIONS=y for the debug conf the build fails with memory problems when building TFM:
[20/461] Performing build step for 'tfm'
[170/174] Linking C executable bin/tfm_s.axf
/usr/local/zephyr-sdk-0.16.4/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld: address 0x1a460 of bin/tfm_s.axf section `.TFM_UNPRIV_CODE' is not within region `FLASH'
/usr/local/zephyr-sdk-0.16.4/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld: bin/tfm_s.axf section `.psa_interface_thread_fn_call' will not fit in region `FLASH'
/usr/local/zephyr-sdk-0.16.4/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'
/usr/local/zephyr-sdk-0.16.4/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld: address 0x1a460 of bin/tfm_s.axf section `.TFM_UNPRIV_CODE' is not within region `FLASH'
/usr/local/zephyr-sdk-0.16.4/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'
/usr/local/zephyr-sdk-0.16.4/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld: region `FLASH' overflowed by 32136 bytes
Memory region    Used Size       Region Size   %age Used
            FLASH:      80776 B              48640 B       166.07%
               RAM: 1.     8540 B                 32 KB         56.58%
collect2: error: ld returned 1 exit status
How can I increase the partition size for TFM ? 
Thanks
  • Hello,

    Håkon is out of office, so I will look into your ticket. Please note that I will be out of office as well from tomorrow, due to public holidays here in Norway. We will be back on April 2nd. I am sorry for the inconvenience.

    What do you mean by "implement the two stage build with west build"? And what is "awk" and "sed"? 

    If you are talking about having two different build configurations, you can use different sets of .conf files. Alternatively, you can include configs in your west build command. E.g. if you want to add a config like:

    CONFIG_BT=y

    You can use the build command:

    west build -b <board> -d <build_dir> -- -DCONFIG_BT=y

    For several sets of build commands, please see the ncs\nrf\applications\matter_weather_station as an example. It has prj.conf and prj_release.conf. So you can build with one or the other. By changing the name of the build folder, you can have many concurrent builds in your application.

    Best regards,

    Edvin

Related