Avr-gcc 7.1, Win10.
When compiling a simple LED blinker C code using avr-gcc, it outputs:
Invoking the avr-gcc is done by hand using:
avr-gcc -g -Os -mmcu=attiny13a -c "Attiny_blink_01.c"
avr-gcc -g -mmcu=attiny13a -o "Attiny_blink_01.elf" "Attiny_blink_01.o"
avr-objcopy -j .text -j .data -O ihex "Attiny_blink_01.elf" "Attiny_blink_01.hex"
avr-size --format=avr --mcu=attiny13a "Attiny_blink_01.elf"
Why does AVR-GCC indicate that there is a "bootloader"? Does it "add" something to the code at compile time besides the blinker?
Why does AVR-GCC indicate that there is a "bootloader"?
It doesn't. What it shows is the cumulated memory consumption of these three sections. So when there is no bootloader, then the contribution of the .bootloader
section is zero.
The mentioned output sections all contribute to the consumed flash size, and therfore when you are interested in the consumed flash size, all mentioned sections have to be considered.
Apart from that, the output is from avr-size
and not form the compiler.
For a documentation of memory sections, see for example https://avrdudes.github.io/avr-libc/avr-libc-user-manual/mem_sections.html
Contrary to what has been claimed in a comment, .bootloader
is not part of the default linker scripts. When there is code in this section, it will be treated like an orphan section.
avr-size is showing .bootloader
because it is hard coded knowledge in avr-size.
Also notice that the used options for avr-size
like --mcu
are from a private patch that never made it into the official Binutils code base. When you want to display usage of statically allocated memory, you can use the official
$ avr-objdump -P mem-usage <elf-file>
instead.