ports: Always include debug information in the ELF.

For bare metal ARM & xtensa targets, passing -g will make the ELF file
larger but doesn't change the binary size.  However, this means tools like
gdb, addr2line, etc can extract source-level information from the ELF.

Also standardise -ggdb to -g, these produce the exact same ELF file on
arm-none-eabi-gcc and will use DWARF format for all these ports.
This commit is contained in:
Angus Gratton
2022-07-28 17:56:27 +10:00
committed by Damien George
parent 3c32ca6e77
commit fdfe4eca74
8 changed files with 16 additions and 9 deletions

View File

@@ -124,7 +124,7 @@ endif
CFLAGS += $(CFLAGS_MCU_$(MCU_SERIES))
CFLAGS += $(INC) -Wall -Werror -g -ansi -std=c11 -nostdlib $(COPT) $(NRF_DEFINES) $(CFLAGS_MOD) $(CFLAGS_EXTRA)
CFLAGS += $(INC) -Wall -Werror -ansi -std=c11 -nostdlib $(COPT) $(NRF_DEFINES) $(CFLAGS_MOD) $(CFLAGS_EXTRA)
CFLAGS += -fno-strict-aliasing
CFLAGS += -Iboards/$(BOARD)
CFLAGS += -DNRF5_HAL_H='<$(MCU_VARIANT)_hal.h>'
@@ -138,9 +138,10 @@ LDFLAGS += -Wl,'--defsym=_fs_size=$(FS_SIZE)'
endif
#Debugging/Optimization
CFLAGS += -g # always include debug info in the ELF
ifeq ($(DEBUG), 1)
#ASMFLAGS += -g -gtabs+
CFLAGS += -O0 -ggdb
CFLAGS += -O0
LDFLAGS += -O0
else
CFLAGS += -Os -DNDEBUG