How to find the memory usage Posted by beandigital on 2017-06-14 17:16 Hi I am using the STM32F072 part with system workbench. How do I find out how much of the flash and RAM the program has used? Thanks Jon
Posted by laltmann on 2017-06-14 23:53 You can set the post-build call to output that information to the console in a more readable format. Project Settings -> C/C++ Build -> Settings -> Build Steps tab, look for the post-build steps command. There is already a call to arm-none-eabi-size at the end, if you insert --format=sysv afterwards you should get a nicer printout. My total command looks like: arm-none-eabi-objcopy -O binary "${BuildArtifactFileBaseName}.elf" "${BuildArtifactFileBaseName}.bin" && arm-none-eabi-size --format=sysv "${BuildArtifactFileName}" When the code builds, I get output on the console that has a table with the size in bytes of each section: section size addr .isr_vector 456 2097152 .text 21336 2097616 .itcm_ram 100 2118952 .rodata 304 2119052 .init_array 4 2119356 .fini_array 4 2119360 .data 5704 536870912 .bss 7244 536876616 ._user_heap_stack 1540 536883860 .ARM.attributes 48 0 .debug_info 113664 0 .debug_abbrev 12731 0 .debug_loc 61914 0 .debug_aranges 4976 0 .debug_ranges 4544 0 .debug_macro 171041 0 .debug_line 79704 0 .debug_str 1008400 0 .comment 110 0 .debug_frame 14624 0 Total 1508448
Posted by topknot on 2017-06-18 01:28 As above but with --format=berkeley instead of --format=sysv will give you output that may be more what you had in mind. For example: arm-none-eabi-size --format=berkeley src/*.o libraries/common/*.o text data bss dec hex filename 1503 0 0 1503 5df src/main.o 339 0 0 339 153 libraries/common/assert.o 84 0 0 84 54 libraries/common/compensator.o 516 4 64 584 248 libraries/common/edgetracker.o 328 0 0 328 148 libraries/common/ffcompensator.o 696 0 0 696 2b8 libraries/common/leadcompensator.o 682 49161 168 50011 c35b libraries/common/logger.o