Possible Output bug for v1.6.9 and 1.6.10

Hello all,

So as a part of the documentation for a sketch, I like to include the compiled size (program size and memory usage) and recently I tried to make a sketch for the Due and the 101 and when it is compiled, It does not include how much memory was used. For example, with an Uno, it would say something like:

Sketch uses 444 bytes (1%) of program storage space. Maximum is 32,256 bytes. Global variables use 9 bytes (0%) of dynamic memory, leaving 2,039 bytes for local variables. Maximum is 2,048 bytes. 

but when compiling for a Due or a 101, it only lists how big the sketch is, like below (the same sketch compiled for the 101):

Sketch uses 16,784 bytes (10%) of program storage space. Maximum is 155,648 bytes. 

Is this a bug or a feature? Any information is helpful.

TL;DR
I was curious - I have the same behavior with 32 bit boards, it does not display the info and unfortunately this seems to come possibly from the toolset and the way the platform.txt and boards.txt file are built

Recipes to compute binary sketch size

At the end of the build the Arduino IDE shows the final binary sketch size to the user. The size is calculated using the recipe recipe.size.pattern. The output of the command executed using the recipe is parsed through the regular expression set in the property recipe.size.regex. The regular expression must match the sketch size.



IF YOU WANT TO EXPLORE



you can get the info from command line (at least on a Mac that's how I would do it)

For example I opened Blink.ino from the examples, I set the IDE preferences to be verbose for compile so that I can see where is the temp directory for my sketch

Look for something like this in the compiler output log (many similar lines)

[color=green]/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/[/color]avr-gcc-ar" rcs  "[color=blue]/var/folders/xk/mwl4yt3j5rsgdmgmgjlqsk7w0000gn/T/buildd5ae82e677127ac286f51de66781d807.tmp[/color]/core/core.a" "/var/fol.... 

the green part is where then compilers tools for the platform are

the blue part is your temporary folder for your project --> copy that path

open a Terminal.app and go to the temp folder where your sketch is being built
cd /var/folders/xk/mwl4yt3j5rsgdmgmgjlqsk7w0000gn/T/buildd5ae82e677127ac286f51de66781d807.tmp

there you should see (do a ls) a Blink.ino.elf file

and you can launch the command

[color=green]/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/[/color][b][color=navy]avr-size[/color][/b] -C [color=red]--mcu=atmega328p[/color] Blink.ino.elf 

and you get

AVR Memory Usage ---------------- Device: atmega328p Program:    928 bytes (2.8% Full) (.text + .data + .bootloader) Data:          9 bytes (0.4% Full) (.data + .bss + .noinit) 

in red this is describing your architecture. You can get the list of known architectures with

/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avr-size --mlist 

so this is what the IDE is showing to you

Now if you use a non AVR architecture (ARM for the DUE, Intel for the 101) then the tools are in a different place (when you downloaded the boards) - on my Mac they are in my home directory at

~/Library/Arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin/[color=blue]arm-none-eabi-size[/color] 
~/Library/Arduino15/packages/Intel/tools/arc-elf32/1.6.9+1.0.1/bin/[color=blue]arc-elf32-size[/color] 

the challenge is you run those with the --h option to get the help, is that they have no option to give you all the details, so this could ve why the IDE does not give you the info.

So where do they define the compilation option?

the info is collected in the platform.txt where they define

compiler.size.cmd=arc-elf32-size ... ## Compute size recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "{build.path}/{build.project_name}.elf" recipe.size.regex=^(?:text|ctors|rodata|datas)\s+([0-9]+).* 

whereas for your standard avr platform

compiler.size.cmd=avr-size ... ## Compute size recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "{build.path}/{build.project_name}.elf" recipe.size.regex=^(?:\.text|\.data|\.bootloader)\s+([0-9]+).* recipe.size.regex.data=^(?:\.data|\.bss|\.noinit)\s+([0-9]+).* recipe.size.regex.eeprom=^(?:\.eeprom)\s+([0-9]+).* 

But wait — they don't do a -C with the platform info, they do a -A and then a regex to extract the info. They clearly have more regex for the AVR platform than for the other architecture...

the size expression for the 101 gives

> ~/Library/Arduino15/packages/Intel/tools/arc-elf32/1.6.9+1.0.1/bin/arc-elf32-size -A Blink.ino.elf Blink.ino.elf  : section    size        addr text      13620  1073954816 ctors        12  1073968436 rodata      436  1073968448 datas      3196  2818629632 bss        1916  2818632828 heap        8192  2818634744 stack      2560  2818642936 .comment    149            0 Total      30081 

and for the UNO

/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avr-size -A Blink.ino.elf Blink.ino.elf  : section                    size      addr .data                        0  8388864 .text                      928        0 .bss                          9  8388864 .comment                    17        0 .note.gnu.avr.deviceinfo    64        0 .debug_info                1524        0 .debug_abbrev              1442        0 .debug_line                  26        0 .debug_str                  520        0 Total                      4530 

couldn't they get from the knowledge of the board and this info what you need... probably could...
I guess someone with more info can dig from here or comment but hope this helps you get further info on true memory usage through command line.

Thank you for the help, It seems confusing to me now, but I've got time and I plan on looking into it, maybe this could be an idea for a newer version (adding this feature in automatically) of the IDE.