When built with DEBUG defined, the generated elf file does not contain source file info, as verified with avr-objdump -S ..., at least with the AVR Mega328P target. This makes debugging using the elf file restricted to assembly only.
This is because the linker is not supplied with the -g flag. A fix could be as simple as adding -g to LDFLAGS if DEBUG is defined, but I'm not sure of the consequences for other targets.
When built with DEBUG defined, the generated elf file does not contain source file info, as verified with avr-objdump -S ..., at least with the AVR Mega328P target. This makes debugging using the elf file restricted to assembly only.
This is because the linker is not supplied with the -g flag. A fix could be as simple as adding -g to LDFLAGS if DEBUG is defined, but I'm not sure of the consequences for other targets.
Arduino.mk Configuration:
Makefile:
Want latest version so use submodule from git.
ARDMK_DIR := $(realpath ../Arduino-Makefile)
BOARD_TAG = nano BOARD_SUB = atmega328old
The makefile gets this wrong.
AVRDUDE_CONF = /etc/avrdude.conf
MONITOR_PORT = /dev/ttyUSB1
ISP_PROG = atmelice_isp
CXXFLAGS += -Wextra -Wno-unused-parameter -Wno-pragmas -Wshadow -Wdouble-promotion -fno-common -funsigned-char -funsigned-bitfields CXXFLAGS += -fpack-struct -fshort-enums -Wundef
Debug switch, if not defined DEBUG_FLAGS ignored and optimisation set to 's'.
DEBUG = 1 DEBUG_FLAGS = -DDEBUG -g3 -Og
include $(ARDMK_DIR)/Arduino.mk