Profiling
Updated 272 Days AgoPublic

TF-M memory usage in GNU ARM compiler

TF-M build system uses the linker option "-Wl,--print-memory-usage" when the GNUARM compiler is selected. This option prints the used size, total size and percentage of used memory per each memory regions. This is useful on embedded targets to have a quick view of amount of free memory. The format of the output has one headline and one line per region. It is both human readable and easily parsable by tools.

More information about this linker option can be found in here.

An example of TF-M output can be found below, when TF-M is compiled with:

  • Musca A (" -DTARGET_PLATFORM=MUSCA_A ")
  • GNUARM (" -DCOMPILER=GNUARM ")
  • Default configuration (" -DPROJ_CONFIG='readlink -f ../ConfigDefault.cmake' ")
  • TF-M master branch, commit SHA → 9da91f3017f8f9b4e32e511d3b0cfba1b0fdd86e
$> cmake -G"Unix Makefiles" -DPROJ_CONFIG=`readlink -f ../ConfigDefault.cmake` -DTARGET_PLATFORM=MUSCA_A -DCOMPILER=GNUARM ../; make
...
[ 76%] Linking C executable mcuboot.axf
Memory region         Used Size  Region Size  %age Used
           FLASH:       51188 B       128 KB     39.05%
        CODE_RAM:       50288 B       128 KB     38.37%
             RAM:       23008 B       128 KB     17.55%
[ 76%] Built target mcuboot
...
Scanning dependencies of target tfm_s
[ 99%] Linking C executable tfm_s.axf
Memory region         Used Size  Region Size  %age Used
           FLASH:      181436 B     521344 B     34.80%
             RAM:       48332 B        64 KB     73.75%
         VENEERS:         608 B        896 B     67.86%
[ 99%] Built target tfm_s
Scanning dependencies of target tfm_ns
[100%] Linking C executable tfm_ns.axf
Memory region         Used Size  Region Size  %age Used
           FLASH:       34420 B       382 KB      8.80%
             RAM:       14304 B        64 KB     21.83%
**[INFO]** Image version number set to 0.0.0+1
**[INFO]** Writing load address from the macro in flash_layout.h to the image header.. 0x10020000 (dec. 268566528)
[100%] Built target tfm_ns
Last Author
mmorenobarm
Projects
Subscribers
None