Display Memory(RAM) usage after compile(verify) for M0(Zero)

Hi, does anyone know if it is possible configuring the IDE to display RAM Memory usage after compilation for the M0(Zero, SAMD21). Like it is done for ESP8266 and AVR based boards.

For AVR boards you get a message like this after compilation:
Global variables use 188 bytes (9%) of dynamic memory, leaving 1860 bytes for local variables. Maximum is 2048 bytes.

For ESP8266 boards it looks like this:
Minimum Memory Usage: 32100 bytes (39% of a 81920 byte maximum)

I have seen previous posts showing how to get this info during runtime by using methods given at:

But, it would be much more convenient having it displayed after compilation, together with program memory usage(which is displayed for all boards).

It looks like the version of "size" used for AVR has a special output mode that isn't present for the ARM version:

avr-size[color=red] -C [/color]--mcu=atmega328 *.elf
AVR Memory Usage
----------------
Device: atmega328
Program:   10296 bytes (31.4% Full)
(.text + .data + .bootloader)
Data:       2052 bytes (100.2% Full)
(.data + .bss + .noinit)

BillW-MacOSX-2<10269> /Applications/arduino/Arduino-1.8.2.app/Contents/Java/portable/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin/arm-none-eabi-size -C *.elf
[color=red]arm-none-eabi-size: invalid option -- C[/color]
Usage: /Applications/arduino/Arduino-1.8.2.app/Contents/Java/portable/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin/arm-none-eabi-size [option(s)] [file(s)]
  :
 The options are:
  -A|-B     --format={sysv|berkeley}  Select output style (default is berkeley)

Hi, I found a way to do it. Requires editing the "platform.txt" file. I added following to my "platform.txt" file:

recipe.hooks.linking.postlink.1.pattern="{compiler.path}\arm-none-eabi-size.exe" "{build.path}\{build.project_name}.elf"

For my Arduino IDE, the "platform.txt" file is located:
C:\Portable\Arduino-183A\portable\packages\arduino\hardware\samd\1.6.15\platform.txt

This works for Arduino IDE and Micro Visual. Following is and example of what is displayed after compile(verify):

   text	   data	    bss	    dec	    hex
  10840	    272	   1936	  13048	   32f8

Where:

  • text = Program FLASH memory

  • data = Is used for initialized data. This is best explained by adding the following (global/extern) variable to a program. It will increase ‘data’ by 4 bytes: int32_t myVar = 0x12345678;
    It counts for RAM and FLASH. The linker allocates the data in FLASH which then is copied from ROM to RAM in the startup code.

  • bss: The ‘bss’ contains all the uninitalized data. This is what ends up in RAM.

  • dec: Is the sum of text, data and bss.