-
Notifications
You must be signed in to change notification settings - Fork 450
Description
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:
- [AUTODETECTED] CURRENT_OS = LINUX
- [AUTODETECTED] ARDUINO_DIR = /usr/share/arduino
- [AUTODETECTED] PYTHON_CMD = /usr/bin/python3
- [USER] ARDMK_DIR = /home/tomh/git/pico/ropemaker/fw/Arduino-Makefile
- [AUTODETECTED] ARDUINO_VERSION = 1819
- [DEFAULT] ARCHITECTURE = avr
- [DEFAULT] ARDMK_VENDOR = arduino
- [AUTODETECTED] ARDUINO_PREFERENCES_PATH = /home/tomh/.arduino15/preferences.txt
- [AUTODETECTED] ARDUINO_SKETCHBOOK = /home/tomh/Arduino (from arduino preferences file)
- [COMPUTED] ARDUINO_VAR_PATH = /usr/share/arduino/hardware/arduino/avr/variants (from ARDUINO_DIR)
- [COMPUTED] BOARDS_TXT = /usr/share/arduino/hardware/arduino/avr/boards.txt (from ARDUINO_DIR)
- [BUNDLED] AVR_TOOLS_DIR = /usr/share/arduino/hardware/tools/avr (in Arduino distribution)
- [COMPUTED] ARDUINO_LIB_PATH = /usr/share/arduino/libraries (from ARDUINO_DIR)
- [COMPUTED] ARDUINO_PLATFORM_LIB_PATH = /usr/share/arduino/hardware/arduino/avr/libraries (from ARDUINO_DIR)
- [DEFAULT] USER_LIB_PATH = /home/tomh/Arduino/libraries (in user sketchbook)
- [DEFAULT] PRE_BUILD_HOOK = pre-build-hook.sh
- [USER] BOARD_SUB = atmega328old
- [USER] BOARD_TAG = nano
- [COMPUTED] CORE = arduino (from build.core)
- [COMPUTED] VARIANT = eightanaloginputs (from build.variant)
- [COMPUTED] BOARD = AVR_NANO (from build.board)
- [COMPUTED] OBJDIR = build-nano-atmega328old (from BOARD_TAG)
- [COMPUTED] ARDUINO_CORE_PATH = /usr/share/arduino/hardware/arduino/avr/cores/arduino (from ARDUINO_DIR, BOARD_TAG and boards.txt)
- [COMPUTED] RESET_CMD = /usr/bin/python3 /home/tomh/git/pico/ropemaker/fw/Arduino-Makefile/bin/ard-reset-arduino (from PYTHON_CMD, ARD_RESET_OPTS and MONITOR_PORT)
- [ASSUMED] MONITOR_BAUDRATE = 9600
- [USER] OPTIMIZATION_LEVEL = g
- [DEFAULT] MCU_FLAG_NAME = mmcu
- [DEFAULT] CFLAGS_STD = -std=gnu11
- [DEFAULT] CXXFLAGS_STD = -std=gnu++11
- [COMPUTED] DEVICE_PATH = /dev/ttyUSB1 (from MONITOR_PORT)
- [DEFAULT] FORCE_MONITOR_PORT =
- [AUTODETECTED] Size utility: AVR-aware for enhanced output
- [COMPUTED] BOOTLOADER_PARENT = /usr/share/arduino/hardware/arduino/avr/bootloaders (from ARDUINO_DIR)
- [COMPUTED] ARDMK_VERSION = 1.6
- [COMPUTED] CC_VERSION = 5.4.0 (avr-gcc)
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