- A map is of somewhat limited use when most of the functions are invisible to you. However, there is a utility "avr-nm" (display name list) that sort-of shows the info you want. Here's (edited) output from "avr-nm -S blink.elf" using the basic blink code as an example. The second column is length:
000002fc 00000054 T delay
00000400 00000096 T digitalWrite
0000008b 00000014 T digital_pin_to_bit_mask_PGM
00000077 00000014 T digital_pin_to_port_PGM
0000009f 00000014 T digital_pin_to_timer_PGM
0000057a W exit
00000350 00000074 T init
0080010a 00000004 b intFunc
00800100 00000002 D ledPin
0000010a 0000002e T loop
00000144 0000000e T main
000003c4 0000003c T pinMode
00000072 00000005 T port_to_input_PGM
00000068 00000005 T port_to_mode_PGM
0000006d 00000005 T port_to_output_PGM
0080011e 00000080 B rx_buffer
0080011a 00000002 B rx_buffer_head
0080011c 00000002 B rx_buffer_tail
00000496 00000010 T serialWrite
00000138 0000000c T setup
00800112 00000004 B timer0_clock_cycles
00800116 00000004 B timer0_millis
0080010e 00000004 B timer0_overflow_count
- New algorithms envoked in 14 let the linker omit code that used to be included. Unfortunate, that was expected to REPLACE the previous library-based omit-code techniques, and it doesn't quite. (so you see above that blink includes some serial code even though it doesn't use it.) It's easy enough to get the old code back (in addition to the new code), and ardunio-15 will contain the patch. Giving (for blink):
text data bss dec hex filename
1090 2 4 1096 448 Blink.elf [arduino-0011]
1122 2 8 1132 46c Blink.elf [arduino-0012]
1218 8 148 1374 55e Blink.elf [arduino-0013]
1406 8 150 1564 61c Blink.elf [arduino-0014]
952 2 12 966 3c6 Blink.elf [arduino-0014 with patch]
An empty sketch is down to about 500 bytes with 14+patch. Note that the size is also dependent on compiler version; there was a significant jump in the size of code produced going between ardunio 11 and 12 with no obvious cause. The gains in patched 14 are due to being able to leave code out, not due to smaller code
The compiler writers (NOT the arduino team) can change their minds at any moment, resulting in significant changes in behavior; compiler writers do that ![]()
- The size of a small sketch is irrelevant. This is a microcontrolller, and you're not sharing system resources with other users or other tasks. Either your sketch fits, or it doesn't fit. There is no advantage to having 12k of program memory free vs having 2k free. There's also no used optimizing the size of "empty" sketches, because empty sketches aren't interesting. The "real" measure of how well things are working is the slope of the line:
y = mx + b
codesize = ( compilerefficiency * sourcesize ) + overhead
That means, when you double the size of your sketch, the amount of memory consumed in the AVR does NOT double. It's not like a basic stamp where nearly ALL of the overhead is "hidden" where you can't see it.