Skip to content

Commit cb306a5

Browse files
committed
Merge pull request #231 from oliviermartin/om/makefile-debug
Update GNU Makefiles to generate DEBUG binaries
2 parents 249f016 + 0596567 commit cb306a5

15 files changed

+105
-15
lines changed

workspace_tools/export/codesourcery_lpc1768.tmpl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ LINKER_SCRIPT = {{linker_script}}
1313
###############################################################################
1414
CC = $(GCC_BIN)arm-none-eabi-gcc
1515
CPP = $(GCC_BIN)arm-none-eabi-g++
16-
CC_FLAGS = -c -Os -fno-common -fmessage-length=0 -Wall -fno-exceptions -mcpu=cortex-m3 -mthumb -ffunction-sections -fdata-sections
16+
CC_FLAGS = -c -g -fno-common -fmessage-length=0 -Wall -fno-exceptions -mcpu=cortex-m3 -mthumb -ffunction-sections -fdata-sections
1717
ONLY_C_FLAGS = -std=gnu99
1818
ONLY_CPP_FLAGS = -std=gnu++98
1919
CC_SYMBOLS = {% for s in symbols %}-D{{s}} {% endfor %}
@@ -27,6 +27,12 @@ LD_SYS_LIBS = -lstdc++ -lsupc++ -lm -lc -lgcc
2727

2828
OBJCOPY = $(GCC_BIN)arm-none-eabi-objcopy
2929

30+
ifeq ($(DEBUG), 1)
31+
CC_FLAGS += -DDEBUG -O0
32+
else
33+
CC_FLAGS += -DNDEBUG -Os
34+
endif
35+
3036
all: $(PROJECT).bin
3137

3238
clean:

workspace_tools/export/gcc_arm_disco_f051r8.tmpl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,20 @@ OBJDUMP = $(GCC_BIN)arm-none-eabi-objdump
2020
SIZE = $(GCC_BIN)arm-none-eabi-size
2121

2222
CPU = -mcpu=cortex-m0 -mthumb
23-
CC_FLAGS = $(CPU) -c -Os -fno-common -fmessage-length=0 -Wall -fno-exceptions -ffunction-sections -fdata-sections -g
23+
CC_FLAGS = $(CPU) -c -g -fno-common -fmessage-length=0 -Wall -fno-exceptions -ffunction-sections -fdata-sections
2424
CC_SYMBOLS = {% for s in symbols %}-D{{s}} {% endfor %}
2525

2626
LD_FLAGS = -mcpu=cortex-m0 -mthumb -Wl,--gc-sections --specs=nano.specs
2727
#LD_FLAGS += -u _printf_float -u _scanf_float
2828
LD_FLAGS += -Wl,-Map=$(PROJECT).map,--cref
2929
LD_SYS_LIBS = -lstdc++ -lsupc++ -lm -lc -lgcc -lnosys
3030

31+
ifeq ($(DEBUG), 1)
32+
CC_FLAGS += -DDEBUG -O0
33+
else
34+
CC_FLAGS += -DNDEBUG -Os
35+
endif
36+
3137
all: $(PROJECT).bin $(PROJECT).hex size
3238

3339
clean:

workspace_tools/export/gcc_arm_disco_f100rb.tmpl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,19 @@ OBJDUMP = $(GCC_BIN)arm-none-eabi-objdump
2020
SIZE = $(GCC_BIN)arm-none-eabi-size
2121

2222
CPU = -mcpu=cortex-m3 -mthumb
23-
CC_FLAGS = $(CPU) -c -Os -fno-common -fmessage-length=0 -Wall -fno-exceptions -ffunction-sections -fdata-sections
23+
CC_FLAGS = $(CPU) -c -g -fno-common -fmessage-length=0 -Wall -fno-exceptions -ffunction-sections -fdata-sections
2424
CC_SYMBOLS = {% for s in symbols %}-D{{s}} {% endfor %}
2525

2626
LD_FLAGS = -mcpu=cortex-m3 -mthumb -Wl,--gc-sections --specs=nano.specs
2727
LD_FLAGS += -Wl,-Map=$(PROJECT).map,--cref
2828
LD_SYS_LIBS = -lstdc++ -lsupc++ -lm -lc -lgcc -lnosys
2929

30+
ifeq ($(DEBUG), 1)
31+
CC_FLAGS += -DDEBUG -O0
32+
else
33+
CC_FLAGS += -DNDEBUG -Os
34+
endif
35+
3036
all: $(PROJECT).bin $(PROJECT).hex size
3137

3238
clean:

workspace_tools/export/gcc_arm_disco_f407vg.tmpl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,19 @@ OBJDUMP = $(GCC_BIN)arm-none-eabi-objdump
2020
SIZE = $(GCC_BIN)arm-none-eabi-size
2121

2222
CPU = -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=softfp
23-
CC_FLAGS = $(CPU) -c -Os -fno-common -fmessage-length=0 -Wall -fno-exceptions -ffunction-sections -fdata-sections -g3
23+
CC_FLAGS = $(CPU) -c -g3 -fno-common -fmessage-length=0 -Wall -fno-exceptions -ffunction-sections -fdata-sections
2424
CC_SYMBOLS = {% for s in symbols %}-D{{s}} {% endfor %}
2525

2626
LD_FLAGS = -mcpu=cortex-m4 -mthumb -Wl,--gc-sections --specs=nano.specs -u _printf_float -u _scanf_float
2727
LD_FLAGS += -Wl,-Map=$(PROJECT).map,--cref
2828
LD_SYS_LIBS = -lstdc++ -lsupc++ -lm -lc -lgcc -lnosys
2929

30+
ifeq ($(DEBUG), 1)
31+
CC_FLAGS += -DDEBUG -O0
32+
else
33+
CC_FLAGS += -DNDEBUG -Os
34+
endif
35+
3036
all: $(PROJECT).bin $(PROJECT).hex size
3137

3238
clean:

workspace_tools/export/gcc_arm_k20d5m.tmpl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,18 @@ LD = $(GCC_BIN)arm-none-eabi-gcc
1818
OBJCOPY = $(GCC_BIN)arm-none-eabi-objcopy
1919

2020
CPU = -mcpu=cortex-m4 -mthumb
21-
CC_FLAGS = $(CPU) -c -Os -fno-common -fmessage-length=0 -Wall -fno-exceptions -ffunction-sections -fdata-sections
21+
CC_FLAGS = $(CPU) -c -g -fno-common -fmessage-length=0 -Wall -fno-exceptions -ffunction-sections -fdata-sections
2222
CC_SYMBOLS = {% for s in symbols %}-D{{s}} {% endfor %}
2323

2424
LD_FLAGS = -mcpu=cortex-m4 -mthumb -Wl,--gc-sections --specs=nano.specs -u _printf_float -u _scanf_float
2525
LD_SYS_LIBS = -lstdc++ -lsupc++ -lm -lc -lgcc -lnosys
2626

27+
ifeq ($(DEBUG), 1)
28+
CC_FLAGS += -DDEBUG -O0
29+
else
30+
CC_FLAGS += -DNDEBUG -Os
31+
endif
32+
2733
all: $(PROJECT).bin
2834

2935
clean:

workspace_tools/export/gcc_arm_kl05z.tmpl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,18 @@ LD = $(GCC_BIN)arm-none-eabi-gcc
1818
OBJCOPY = $(GCC_BIN)arm-none-eabi-objcopy
1919

2020
CPU = -mcpu=cortex-m0plus -mthumb
21-
CC_FLAGS = $(CPU) -c -Os -fno-common -fmessage-length=0 -Wall -fno-exceptions -ffunction-sections -fdata-sections
21+
CC_FLAGS = $(CPU) -c -g -fno-common -fmessage-length=0 -Wall -fno-exceptions -ffunction-sections -fdata-sections
2222
CC_SYMBOLS = {% for s in symbols %}-D{{s}} {% endfor %}
2323

2424
LD_FLAGS = -mcpu=cortex-m0plus -mthumb -Wl,--gc-sections --specs=nano.specs -u _printf_float -u _scanf_float
2525
LD_SYS_LIBS = -lstdc++ -lsupc++ -lm -lc -lgcc -lnosys
2626

27+
ifeq ($(DEBUG), 1)
28+
CC_FLAGS += -DDEBUG -O0
29+
else
30+
CC_FLAGS += -DNDEBUG -Os
31+
endif
32+
2733
all: $(PROJECT).bin
2834

2935
clean:

workspace_tools/export/gcc_arm_kl25z.tmpl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,18 @@ LD = $(GCC_BIN)arm-none-eabi-gcc
1818
OBJCOPY = $(GCC_BIN)arm-none-eabi-objcopy
1919

2020
CPU = -mcpu=cortex-m0plus -mthumb
21-
CC_FLAGS = $(CPU) -c -Os -fno-common -fmessage-length=0 -Wall -fno-exceptions -ffunction-sections -fdata-sections
21+
CC_FLAGS = $(CPU) -c -g -fno-common -fmessage-length=0 -Wall -fno-exceptions -ffunction-sections -fdata-sections
2222
CC_SYMBOLS = {% for s in symbols %}-D{{s}} {% endfor %}
2323

2424
LD_FLAGS = -mcpu=cortex-m0plus -mthumb -Wl,--gc-sections --specs=nano.specs -u _printf_float -u _scanf_float
2525
LD_SYS_LIBS = -lstdc++ -lsupc++ -lm -lc -lgcc -lnosys
2626

27+
ifeq ($(DEBUG), 1)
28+
CC_FLAGS += -DDEBUG -O0
29+
else
30+
CC_FLAGS += -DNDEBUG -Os
31+
endif
32+
2733
all: $(PROJECT).bin
2834

2935
clean:

workspace_tools/export/gcc_arm_kl46z.tmpl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,18 @@ LD = $(GCC_BIN)arm-none-eabi-gcc
1818
OBJCOPY = $(GCC_BIN)arm-none-eabi-objcopy
1919

2020
CPU = -mcpu=cortex-m0plus -mthumb
21-
CC_FLAGS = $(CPU) -c -Os -fno-common -fmessage-length=0 -Wall -fno-exceptions -ffunction-sections -fdata-sections
21+
CC_FLAGS = $(CPU) -c -g -fno-common -fmessage-length=0 -Wall -fno-exceptions -ffunction-sections -fdata-sections
2222
CC_SYMBOLS = {% for s in symbols %}-D{{s}} {% endfor %}
2323

2424
LD_FLAGS = -mcpu=cortex-m0plus -mthumb -Wl,--gc-sections --specs=nano.specs -u _printf_float -u _scanf_float
2525
LD_SYS_LIBS = -lstdc++ -lsupc++ -lm -lc -lgcc -lnosys
2626

27+
ifeq ($(DEBUG), 1)
28+
CC_FLAGS += -DDEBUG -O0
29+
else
30+
CC_FLAGS += -DNDEBUG -Os
31+
endif
32+
2733
all: $(PROJECT).bin
2834

2935
clean:

workspace_tools/export/gcc_arm_lpc1114.tmpl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,19 @@ OBJDUMP = $(GCC_BIN)arm-none-eabi-objdump
2020
SIZE = $(GCC_BIN)arm-none-eabi-size
2121

2222
CPU = -mcpu=cortex-m0 -mthumb
23-
CC_FLAGS = $(CPU) -c -Os -fno-common -fmessage-length=0 -Wall -fno-exceptions -ffunction-sections -fdata-sections
23+
CC_FLAGS = $(CPU) -c -g -fno-common -fmessage-length=0 -Wall -fno-exceptions -ffunction-sections -fdata-sections
2424
CC_SYMBOLS = {% for s in symbols %}-D{{s}} {% endfor %}
2525

2626
LD_FLAGS = -mcpu=cortex-m0 -mthumb -Wl,--gc-sections --specs=nano.specs
2727
LD_FLAGS += -Wl,-Map=$(PROJECT).map,--cref
2828
LD_SYS_LIBS = -lstdc++ -lsupc++ -lm -lc -lgcc -lnosys
2929

30+
ifeq ($(DEBUG), 1)
31+
CC_FLAGS += -DDEBUG -O0
32+
else
33+
CC_FLAGS += -DNDEBUG -Os
34+
endif
35+
3036
all: $(PROJECT).bin $(PROJECT).hex size
3137

3238
clean:

workspace_tools/export/gcc_arm_lpc11u24.tmpl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,18 @@ LD = $(GCC_BIN)arm-none-eabi-gcc
1818
OBJCOPY = $(GCC_BIN)arm-none-eabi-objcopy
1919

2020
CPU = -mcpu=cortex-m0 -mthumb
21-
CC_FLAGS = $(CPU) -c -Os -fno-common -fmessage-length=0 -Wall -fno-exceptions -ffunction-sections -fdata-sections
21+
CC_FLAGS = $(CPU) -c -g -fno-common -fmessage-length=0 -Wall -fno-exceptions -ffunction-sections -fdata-sections
2222
CC_SYMBOLS = {% for s in symbols %}-D{{s}} {% endfor %}
2323

2424
LD_FLAGS = -mcpu=cortex-m0 -mthumb -Wl,--gc-sections --specs=nano.specs
2525
LD_SYS_LIBS = -lstdc++ -lsupc++ -lm -lc -lgcc -lnosys
2626

27+
ifeq ($(DEBUG), 1)
28+
CC_FLAGS += -DDEBUG -O0
29+
else
30+
CC_FLAGS += -DNDEBUG -Os
31+
endif
32+
2733
all: $(PROJECT).bin
2834

2935
clean:

workspace_tools/export/gcc_arm_lpc11u35_401.tmpl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,19 @@ OBJDUMP = $(GCC_BIN)arm-none-eabi-objdump
2020
SIZE = $(GCC_BIN)arm-none-eabi-size
2121

2222
CPU = -mcpu=cortex-m0 -mthumb
23-
CC_FLAGS = $(CPU) -c -Os -fno-common -fmessage-length=0 -Wall -fno-exceptions -ffunction-sections -fdata-sections
23+
CC_FLAGS = $(CPU) -c -g -fno-common -fmessage-length=0 -Wall -fno-exceptions -ffunction-sections -fdata-sections
2424
CC_SYMBOLS = {% for s in symbols %}-D{{s}} {% endfor %}
2525

2626
LD_FLAGS = -mcpu=cortex-m0 -mthumb -Wl,--gc-sections --specs=nano.specs
2727
LD_FLAGS += -Wl,-Map=$(PROJECT).map,--cref
2828
LD_SYS_LIBS = -lstdc++ -lsupc++ -lm -lc -lgcc -lnosys
2929

30+
ifeq ($(DEBUG), 1)
31+
CC_FLAGS += -DDEBUG -O0
32+
else
33+
CC_FLAGS += -DNDEBUG -Os
34+
endif
35+
3036
all: $(PROJECT).bin $(PROJECT).hex size
3137

3238
clean:

workspace_tools/export/gcc_arm_lpc11u35_501.tmpl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,19 @@ OBJDUMP = $(GCC_BIN)arm-none-eabi-objdump
2020
SIZE = $(GCC_BIN)arm-none-eabi-size
2121

2222
CPU = -mcpu=cortex-m0 -mthumb
23-
CC_FLAGS = $(CPU) -c -Os -fno-common -fmessage-length=0 -Wall -fno-exceptions -ffunction-sections -fdata-sections
23+
CC_FLAGS = $(CPU) -c -g -fno-common -fmessage-length=0 -Wall -fno-exceptions -ffunction-sections -fdata-sections
2424
CC_SYMBOLS = {% for s in symbols %}-D{{s}} {% endfor %}
2525

2626
LD_FLAGS = -mcpu=cortex-m0 -mthumb -Wl,--gc-sections --specs=nano.specs
2727
LD_FLAGS += -Wl,-Map=$(PROJECT).map,--cref
2828
LD_SYS_LIBS = -lstdc++ -lsupc++ -lm -lc -lgcc -lnosys
2929

30+
ifeq ($(DEBUG), 1)
31+
CC_FLAGS += -DDEBUG -O0
32+
else
33+
CC_FLAGS += -DNDEBUG -Os
34+
endif
35+
3036
all: $(PROJECT).bin $(PROJECT).hex size
3137

3238
clean:

workspace_tools/export/gcc_arm_lpc1768.tmpl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,18 @@ LD = $(GCC_BIN)arm-none-eabi-gcc
1818
OBJCOPY = $(GCC_BIN)arm-none-eabi-objcopy
1919

2020
CPU = -mcpu=cortex-m3 -mthumb
21-
CC_FLAGS = $(CPU) -c -Os -fno-common -fmessage-length=0 -Wall -fno-exceptions -ffunction-sections -fdata-sections
21+
CC_FLAGS = $(CPU) -c -g -fno-common -fmessage-length=0 -Wall -fno-exceptions -ffunction-sections -fdata-sections
2222
CC_SYMBOLS = {% for s in symbols %}-D{{s}} {% endfor %}
2323

2424
LD_FLAGS = -mcpu=cortex-m3 -mthumb -Wl,--gc-sections --specs=nano.specs -u _printf_float -u _scanf_float
2525
LD_SYS_LIBS = -lstdc++ -lsupc++ -lm -lc -lgcc -lnosys
2626

27+
ifeq ($(DEBUG), 1)
28+
CC_FLAGS += -DDEBUG -O0
29+
else
30+
CC_FLAGS += -DNDEBUG -Os
31+
endif
32+
2733
all: $(PROJECT).bin
2834

2935
clean:

workspace_tools/export/gcc_arm_lpc4088.tmpl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,18 @@ LD = $(GCC_BIN)arm-none-eabi-gcc
1818
OBJCOPY = $(GCC_BIN)arm-none-eabi-objcopy
1919

2020
CPU = -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=softfp
21-
CC_FLAGS = $(CPU) -c -Os -fno-common -fmessage-length=0 -Wall -fno-exceptions -ffunction-sections -fdata-sections
21+
CC_FLAGS = $(CPU) -c -g -fno-common -fmessage-length=0 -Wall -fno-exceptions -ffunction-sections -fdata-sections
2222
CC_SYMBOLS = {% for s in symbols %}-D{{s}} {% endfor %}
2323

2424
LD_FLAGS = -mcpu=cortex-m4 -mthumb -Wl,--gc-sections --specs=nano.specs -u _printf_float -u _scanf_float
2525
LD_SYS_LIBS = -lstdc++ -lsupc++ -lm -lc -lgcc -lnosys
2626

27+
ifeq ($(DEBUG), 1)
28+
CC_FLAGS += -DDEBUG -O0
29+
else
30+
CC_FLAGS += -DNDEBUG -Os
31+
endif
32+
2733
all: $(PROJECT).bin
2834

2935
clean:

workspace_tools/export/gcc_arm_stm32f407.tmpl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,19 @@ OBJDUMP = $(GCC_BIN)arm-none-eabi-objdump
2020
SIZE = $(GCC_BIN)arm-none-eabi-size
2121

2222
CPU = -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=softfp
23-
CC_FLAGS = $(CPU) -c -Os -fno-common -fmessage-length=0 -Wall -fno-exceptions -ffunction-sections -fdata-sections
23+
CC_FLAGS = $(CPU) -c -g -fno-common -fmessage-length=0 -Wall -fno-exceptions -ffunction-sections -fdata-sections
2424
CC_SYMBOLS = {% for s in symbols %}-D{{s}} {% endfor %}
2525

2626
LD_FLAGS = -mcpu=cortex-m4 -mthumb -Wl,--gc-sections --specs=nano.specs -u _printf_float -u _scanf_float
2727
LD_FLAGS += -Wl,-Map=$(PROJECT).map,--cref
2828
LD_SYS_LIBS = -lstdc++ -lsupc++ -lm -lc -lgcc -lnosys
2929

30+
ifeq ($(DEBUG), 1)
31+
CC_FLAGS += -DDEBUG -O0
32+
else
33+
CC_FLAGS += -DNDEBUG -Os
34+
endif
35+
3036
all: $(PROJECT).bin $(PROJECT).hex size
3137

3238
clean:

0 commit comments

Comments
 (0)