Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
By default LTO (Link Time Optimization) of AVR GCC is enabled. On
atmega328p this remove most of the debugging data from the ELF file.
As a result avr-gdb can not be used fully.
For example lets take the simple Hello World application:
following output shows that nither Print.c nither the test_app.cpp
are writen in the ELF file as a referance to the source code for
debugging porpose (the code is compiled with -g):
As a result this ELF file can not be used by GDB. It can not find the
source code of the currently executed code.
When we disable the LTO the output is:
Now all source files are depicted by the ELF file. As a result avr-gdb
can use this ELF file for debugging. It depict the current source line.
Also the size of the .text section (Flash memory) is not optimiezed.
With LTO the simple Helloe World take 20264 bytes (.text). While the
build without LTO generate 3860 bytes (.text) for atmega328p.
This patch allow disabling of LTO by setting LTO=n. While keeping
LTO on by default.
Signed-off-by: Ivo Shopov ivoshopov@gmail.com