diff --git a/ports/esp8266/Makefile b/ports/esp8266/Makefile index f70fbd2284..52ba18d7d8 100644 --- a/ports/esp8266/Makefile +++ b/ports/esp8266/Makefile @@ -68,8 +68,8 @@ LIBGCC_FILE_NAME = $(shell $(CC) $(CFLAGS) -print-libgcc-file-name) LIBS += -L$(dir $(LIBGCC_FILE_NAME)) -lgcc # Debugging/Optimization +CFLAGS += -g # always include debug info in the ELF ifeq ($(DEBUG), 1) -CFLAGS += -g COPT = -O0 else CFLAGS += -fdata-sections -ffunction-sections diff --git a/ports/mimxrt/Makefile b/ports/mimxrt/Makefile index de560bdb66..13b766eb3c 100644 --- a/ports/mimxrt/Makefile +++ b/ports/mimxrt/Makefile @@ -297,8 +297,9 @@ SRC_QSTR += \ # Compiler Flags # ============================================================================= +CFLAGS += -g # always include debug info in the ELF ifeq ($(DEBUG),1) -CFLAGS += -Og -ggdb +CFLAGS += -Og else CFLAGS += -Os -DNDEBUG endif diff --git a/ports/minimal/Makefile b/ports/minimal/Makefile index 4a17df6803..169132a1a2 100644 --- a/ports/minimal/Makefile +++ b/ports/minimal/Makefile @@ -34,8 +34,9 @@ endif CSUPEROPT = -Os # save some code space # Tune for Debugging or Optimization +CFLAGS += -g # always include debug info in the ELF ifeq ($(DEBUG), 1) -CFLAGS += -O0 -ggdb +CFLAGS += -O0 else CFLAGS += -Os -DNDEBUG CFLAGS += -fdata-sections -ffunction-sections diff --git a/ports/nrf/Makefile b/ports/nrf/Makefile index 47653ae716..0586524ba6 100644 --- a/ports/nrf/Makefile +++ b/ports/nrf/Makefile @@ -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 diff --git a/ports/renesas-ra/Makefile b/ports/renesas-ra/Makefile index d326c81e78..92d8be0692 100644 --- a/ports/renesas-ra/Makefile +++ b/ports/renesas-ra/Makefile @@ -148,8 +148,9 @@ CFLAGS += -fdata-sections -ffunction-sections LDFLAGS += --gc-sections # Debugging/Optimization +CFLAGS += -g # always include debug info in the ELF ifeq ($(DEBUG), 1) -CFLAGS += -g -DPENDSV_DEBUG +CFLAGS += -DPENDSV_DEBUG #COPT = -Og COPT = -Os # Disable text compression in debug builds diff --git a/ports/samd/Makefile b/ports/samd/Makefile index b3d6d8b228..7091365f49 100644 --- a/ports/samd/Makefile +++ b/ports/samd/Makefile @@ -57,8 +57,9 @@ LDFLAGS += $(LDFLAGS_MOD) LIBS = $(shell $(CC) $(CFLAGS) -print-libgcc-file-name) # Tune for Debugging or Optimization +CFLAGS += -g # always include debug info in the ELF ifeq ($(DEBUG),1) -CFLAGS += -O0 -ggdb +CFLAGS += -O0 else CFLAGS += -Os -DNDEBUG LDFLAGS += --gc-sections diff --git a/ports/stm32/Makefile b/ports/stm32/Makefile index 652dff19fe..657524798c 100644 --- a/ports/stm32/Makefile +++ b/ports/stm32/Makefile @@ -114,8 +114,9 @@ $(BUILD)/stm32_it.o $(BUILD)/pendsv.o: CFLAGS += -fno-lto endif # Debugging/Optimization +CFLAGS += -g # always include debug info in the ELF ifeq ($(DEBUG), 1) -CFLAGS += -g -DPENDSV_DEBUG +CFLAGS += -DPENDSV_DEBUG COPT ?= -Og # Disable text compression in debug builds MICROPY_ROM_TEXT_COMPRESSION = 0 diff --git a/ports/teensy/Makefile b/ports/teensy/Makefile index 745f530d7a..d7161fcbbc 100644 --- a/ports/teensy/Makefile +++ b/ports/teensy/Makefile @@ -105,8 +105,9 @@ LIBS += -L $(dir $(LIBC_FILE_NAME)) -lc LIBS += -L $(dir $(LIBGCC_FILE_NAME)) -lgcc #Debugging/Optimization +CFLAGS += -g # always include debug info in the ELF ifdef DEBUG -CFLAGS += -Og -ggdb +CFLAGS += -Og else CFLAGS += -Os #-DNDEBUG endif