From 6d658c20b8c2aecc6a0734846c778d1f7532e67c Mon Sep 17 00:00:00 2001 From: Karl Palsson Date: Thu, 30 Apr 2015 15:32:05 +0000 Subject: [PATCH] make: use shared DEBUG_FLAGS (-gdb3) by default -ggdb3 make slightly bigger .elf files, but allows gdb to understand macros, which libopenocm3 uses somewhat extensively. Make this the default, and pull it up to the common base makefile, so it can be easily substituted. --- lib/Makefile.include | 3 +++ lib/efm32/efm32g/Makefile | 3 ++- lib/efm32/efm32gg/Makefile | 3 ++- lib/efm32/efm32lg/Makefile | 3 ++- lib/efm32/efm32tg/Makefile | 3 ++- lib/lm3s/Makefile | 3 ++- lib/lm4f/Makefile | 3 ++- lib/lpc13xx/Makefile | 3 ++- lib/lpc17xx/Makefile | 3 ++- lib/lpc43xx/m0/Makefile | 3 ++- lib/lpc43xx/m4/Makefile | 3 ++- lib/sam/3a/Makefile | 3 ++- lib/sam/3n/Makefile | 3 ++- lib/sam/3s/Makefile | 3 ++- lib/sam/3u/Makefile | 3 ++- lib/sam/3x/Makefile | 3 ++- lib/stm32/f0/Makefile | 3 ++- lib/stm32/f1/Makefile | 3 ++- lib/stm32/f2/Makefile | 3 ++- lib/stm32/f3/Makefile | 3 ++- lib/stm32/f4/Makefile | 3 ++- lib/stm32/l0/Makefile | 3 ++- lib/stm32/l1/Makefile | 3 ++- lib/vf6xx/Makefile | 3 ++- 24 files changed, 49 insertions(+), 23 deletions(-) diff --git a/lib/Makefile.include b/lib/Makefile.include index 70fdd5c3..657f70ec 100644 --- a/lib/Makefile.include +++ b/lib/Makefile.include @@ -26,6 +26,9 @@ endif # common objects OBJS += vector.o systick.o scb.o nvic.o assert.o sync.o dwt.o +# Slightly bigger .elf files but gains the ability to decode macros +DEBUG_FLAGS ?= -ggdb3 + all: $(SRCLIBDIR)/$(LIBNAME).a $(SRCLIBDIR)/$(LIBNAME).a: $(SRCLIBDIR)/$(LIBNAME).ld $(OBJS) diff --git a/lib/efm32/efm32g/Makefile b/lib/efm32/efm32g/Makefile index 7a644b26..ce28aa6a 100644 --- a/lib/efm32/efm32g/Makefile +++ b/lib/efm32/efm32g/Makefile @@ -26,13 +26,14 @@ PREFIX ?= arm-none-eabi #PREFIX ?= arm-elf CC = $(PREFIX)-gcc AR = $(PREFIX)-ar -CFLAGS = -Os -g \ +CFLAGS = -Os \ -Wall -Wextra -Wimplicit-function-declaration \ -Wredundant-decls -Wmissing-prototypes -Wstrict-prototypes \ -Wundef -Wshadow \ -I../../../include -fno-common \ -mcpu=cortex-m3 $(FP_FLAGS) -mthumb -Wstrict-prototypes \ -ffunction-sections -fdata-sections -MD -D$(FAMILY) +CFLAGS += $(DEBUG_FLAGS) # ARFLAGS = rcsv ARFLAGS = rcs OBJS = diff --git a/lib/efm32/efm32gg/Makefile b/lib/efm32/efm32gg/Makefile index fdfe6e77..04f16d46 100644 --- a/lib/efm32/efm32gg/Makefile +++ b/lib/efm32/efm32gg/Makefile @@ -26,13 +26,14 @@ PREFIX ?= arm-none-eabi #PREFIX ?= arm-elf CC = $(PREFIX)-gcc AR = $(PREFIX)-ar -CFLAGS = -Os -g \ +CFLAGS = -Os \ -Wall -Wextra -Wimplicit-function-declaration \ -Wredundant-decls -Wmissing-prototypes -Wstrict-prototypes \ -Wundef -Wshadow \ -I../../../include -fno-common \ -mcpu=cortex-m3 $(FP_FLAGS) -mthumb -Wstrict-prototypes \ -ffunction-sections -fdata-sections -MD -D$(FAMILY) +CFLAGS += $(DEBUG_FLAGS) # ARFLAGS = rcsv ARFLAGS = rcs OBJS = diff --git a/lib/efm32/efm32lg/Makefile b/lib/efm32/efm32lg/Makefile index 07a8e453..94af24f1 100644 --- a/lib/efm32/efm32lg/Makefile +++ b/lib/efm32/efm32lg/Makefile @@ -26,13 +26,14 @@ PREFIX ?= arm-none-eabi #PREFIX ?= arm-elf CC = $(PREFIX)-gcc AR = $(PREFIX)-ar -CFLAGS = -Os -g \ +CFLAGS = -Os \ -Wall -Wextra -Wimplicit-function-declaration \ -Wredundant-decls -Wmissing-prototypes -Wstrict-prototypes \ -Wundef -Wshadow \ -I../../../include -fno-common \ -mcpu=cortex-m3 $(FP_FLAGS) -mthumb -Wstrict-prototypes \ -ffunction-sections -fdata-sections -MD -D$(FAMILY) +CFLAGS += $(DEBUG_FLAGS) # ARFLAGS = rcsv ARFLAGS = rcs OBJS = diff --git a/lib/efm32/efm32tg/Makefile b/lib/efm32/efm32tg/Makefile index 46de1933..842a3988 100644 --- a/lib/efm32/efm32tg/Makefile +++ b/lib/efm32/efm32tg/Makefile @@ -26,13 +26,14 @@ PREFIX ?= arm-none-eabi #PREFIX ?= arm-elf CC = $(PREFIX)-gcc AR = $(PREFIX)-ar -CFLAGS = -Os -g \ +CFLAGS = -Os \ -Wall -Wextra -Wimplicit-function-declaration \ -Wredundant-decls -Wmissing-prototypes -Wstrict-prototypes \ -Wundef -Wshadow \ -I../../../include -fno-common \ -mcpu=cortex-m3 $(FP_FLAGS) -mthumb -Wstrict-prototypes \ -ffunction-sections -fdata-sections -MD -D$(FAMILY) +CFLAGS += $(DEBUG_FLAGS) # ARFLAGS = rcsv ARFLAGS = rcs OBJS = diff --git a/lib/lm3s/Makefile b/lib/lm3s/Makefile index 353183d1..1e383940 100644 --- a/lib/lm3s/Makefile +++ b/lib/lm3s/Makefile @@ -24,13 +24,14 @@ PREFIX ?= arm-none-eabi CC = $(PREFIX)-gcc AR = $(PREFIX)-ar -CFLAGS = -Os -g \ +CFLAGS = -Os \ -Wall -Wextra -Wimplicit-function-declaration \ -Wredundant-decls -Wmissing-prototypes -Wstrict-prototypes \ -Wundef -Wshadow \ -I../../include -fno-common \ -mcpu=cortex-m3 -mthumb $(FP_FLAGS) -Wstrict-prototypes \ -ffunction-sections -fdata-sections -MD -DLM3S +CFLAGS += $(DEBUG_FLAGS) # ARFLAGS = rcsv ARFLAGS = rcs OBJS = gpio.o vector.o assert.o diff --git a/lib/lm4f/Makefile b/lib/lm4f/Makefile index 6b83b0f0..29872fd5 100644 --- a/lib/lm4f/Makefile +++ b/lib/lm4f/Makefile @@ -26,13 +26,14 @@ PREFIX ?= arm-none-eabi CC = $(PREFIX)-gcc AR = $(PREFIX)-ar -CFLAGS = -Os -g \ +CFLAGS = -Os \ -Wall -Wextra -Wimplicit-function-declaration \ -Wredundant-decls -Wmissing-prototypes -Wstrict-prototypes \ -Wundef -Wshadow \ -I../../include -fno-common \ -mcpu=cortex-m4 -mthumb $(FP_FLAGS) -Wstrict-prototypes \ -ffunction-sections -fdata-sections -MD -DLM4F +CFLAGS += $(DEBUG_FLAGS) # ARFLAGS = rcsv ARFLAGS = rcs OBJS = gpio.o vector.o assert.o systemcontrol.o rcc.o uart.o \ diff --git a/lib/lpc13xx/Makefile b/lib/lpc13xx/Makefile index f396d5b9..5b88784b 100644 --- a/lib/lpc13xx/Makefile +++ b/lib/lpc13xx/Makefile @@ -24,13 +24,14 @@ PREFIX ?= arm-none-eabi CC = $(PREFIX)-gcc AR = $(PREFIX)-ar -CFLAGS = -Os -g \ +CFLAGS = -Os \ -Wall -Wextra -Wimplicit-function-declaration \ -Wredundant-decls -Wmissing-prototypes -Wstrict-prototypes \ -Wundef -Wshadow \ -I../../include -fno-common \ -mcpu=cortex-m3 -mthumb $(FP_FLAGS) -Wstrict-prototypes \ -ffunction-sections -fdata-sections -MD -DLPC13XX +CFLAGS += $(DEBUG_FLAGS) # ARFLAGS = rcsv ARFLAGS = rcs OBJS = gpio.o diff --git a/lib/lpc17xx/Makefile b/lib/lpc17xx/Makefile index 0317f6bc..4b72a60d 100644 --- a/lib/lpc17xx/Makefile +++ b/lib/lpc17xx/Makefile @@ -24,13 +24,14 @@ PREFIX ?= arm-none-eabi CC = $(PREFIX)-gcc AR = $(PREFIX)-ar -CFLAGS = -Os -g \ +CFLAGS = -Os \ -Wall -Wextra -Wimplicit-function-declaration \ -Wredundant-decls -Wmissing-prototypes -Wstrict-prototypes \ -Wundef -Wshadow \ -I../../include -fno-common \ -mcpu=cortex-m3 -mthumb $(FP_FLAGS) -Wstrict-prototypes \ -ffunction-sections -fdata-sections -MD -DLPC17XX +CFLAGS += $(DEBUG_FLAGS) # ARFLAGS = rcsv ARFLAGS = rcs OBJS = gpio.o pwr.o diff --git a/lib/lpc43xx/m0/Makefile b/lib/lpc43xx/m0/Makefile index 65114c2e..a3d6dc36 100644 --- a/lib/lpc43xx/m0/Makefile +++ b/lib/lpc43xx/m0/Makefile @@ -26,9 +26,10 @@ PREFIX ?= arm-none-eabi #PREFIX ?= arm-elf CC = $(PREFIX)-gcc AR = $(PREFIX)-ar -CFLAGS = -O2 -g3 -Wall -Wextra -I../../../include -fno-common \ +CFLAGS = -O2 -Wall -Wextra -I../../../include -fno-common \ -mcpu=cortex-m0 -mthumb -Wstrict-prototypes \ -ffunction-sections -fdata-sections -MD -DLPC43XX -DLPC43XX_M0 +CFLAGS += $(DEBUG_FLAGS) # ARFLAGS = rcsv ARFLAGS = rcs diff --git a/lib/lpc43xx/m4/Makefile b/lib/lpc43xx/m4/Makefile index a3d3b03d..96d1a5bf 100644 --- a/lib/lpc43xx/m4/Makefile +++ b/lib/lpc43xx/m4/Makefile @@ -28,7 +28,7 @@ PREFIX ?= arm-none-eabi CC = $(PREFIX)-gcc AR = $(PREFIX)-ar -CFLAGS = -O2 -g3 \ +CFLAGS = -O2 \ -Wall -Wextra -Wimplicit-function-declaration \ -Wredundant-decls -Wmissing-prototypes -Wstrict-prototypes \ -Wundef -Wshadow \ @@ -36,6 +36,7 @@ CFLAGS = -O2 -g3 \ -mcpu=cortex-m4 -mthumb -Wstrict-prototypes \ -ffunction-sections -fdata-sections -MD \ $(FP_FLAGS) -DLPC43XX -DLPC43XX_M4 +CFLAGS += $(DEBUG_FLAGS) ARFLAGS = rcs diff --git a/lib/sam/3a/Makefile b/lib/sam/3a/Makefile index 219f4953..ebb2c06f 100644 --- a/lib/sam/3a/Makefile +++ b/lib/sam/3a/Makefile @@ -24,9 +24,10 @@ PREFIX ?= arm-none-eabi CC = $(PREFIX)-gcc AR = $(PREFIX)-ar -CFLAGS = -Os -g -Wall -Wextra -I../../../include -fno-common \ +CFLAGS = -Os -Wall -Wextra -I../../../include -fno-common \ -mcpu=cortex-m3 -mthumb $(FP_FLAGS) -Wstrict-prototypes \ -ffunction-sections -fdata-sections -MD -DSAM3A +CFLAGS += $(DEBUG_FLAGS) # ARFLAGS = rcsv ARFLAGS = rcs OBJS = gpio_common_all.o gpio_common_3a3u3x.o pmc.o usart.o diff --git a/lib/sam/3n/Makefile b/lib/sam/3n/Makefile index 87418c12..1886730e 100644 --- a/lib/sam/3n/Makefile +++ b/lib/sam/3n/Makefile @@ -24,9 +24,10 @@ PREFIX ?= arm-none-eabi CC = $(PREFIX)-gcc AR = $(PREFIX)-ar -CFLAGS = -Os -g -Wall -Wextra -I../../../include -fno-common \ +CFLAGS = -Os -Wall -Wextra -I../../../include -fno-common \ -mcpu=cortex-m3 -mthumb $(FP_FLAGS) -Wstrict-prototypes \ -ffunction-sections -fdata-sections -MD -DSAM3N +CFLAGS += $(DEBUG_FLAGS) # ARFLAGS = rcsv ARFLAGS = rcs OBJS = gpio_common_all.o gpio_common_3n3s.o pmc.o usart.o diff --git a/lib/sam/3s/Makefile b/lib/sam/3s/Makefile index 231159cb..b4751a67 100644 --- a/lib/sam/3s/Makefile +++ b/lib/sam/3s/Makefile @@ -25,9 +25,10 @@ PREFIX ?= arm-none-eabi CC = $(PREFIX)-gcc AR = $(PREFIX)-ar -CFLAGS = -Os -g -Wall -Wextra -I../../../include -fno-common \ +CFLAGS = -Os -Wall -Wextra -I../../../include -fno-common \ -mcpu=cortex-m3 -mthumb $(FP_FLAGS) -Wstrict-prototypes \ -ffunction-sections -fdata-sections -MD -DSAM3S +CFLAGS += $(DEBUG_FLAGS) # ARFLAGS = rcsv ARFLAGS = rcs OBJS = gpio_common_all.o gpio_common_3n3s.o pmc.o usart.o diff --git a/lib/sam/3u/Makefile b/lib/sam/3u/Makefile index 1a544dca..fc49836c 100644 --- a/lib/sam/3u/Makefile +++ b/lib/sam/3u/Makefile @@ -25,9 +25,10 @@ PREFIX ?= arm-none-eabi CC = $(PREFIX)-gcc AR = $(PREFIX)-ar -CFLAGS = -Os -g -Wall -Wextra -I../../../include -fno-common \ +CFLAGS = -Os -Wall -Wextra -I../../../include -fno-common \ -mcpu=cortex-m3 -mthumb $(FP_FLAGS) -Wstrict-prototypes \ -ffunction-sections -fdata-sections -MD -DSAM3U +CFLAGS += $(DEBUG_FLAGS) # ARFLAGS = rcsv ARFLAGS = rcs OBJS = gpio_common_all.o gpio_common_3a3u3x.o pmc.o usart.o diff --git a/lib/sam/3x/Makefile b/lib/sam/3x/Makefile index 23ef5892..dbc28221 100644 --- a/lib/sam/3x/Makefile +++ b/lib/sam/3x/Makefile @@ -24,9 +24,10 @@ PREFIX ?= arm-none-eabi CC = $(PREFIX)-gcc AR = $(PREFIX)-ar -CFLAGS = -Os -g -Wall -Wextra -I../../../include -fno-common \ +CFLAGS = -Os -Wall -Wextra -I../../../include -fno-common \ -mcpu=cortex-m3 -mthumb $(FP_FLAGS) -Wstrict-prototypes \ -ffunction-sections -fdata-sections -MD -DSAM3X +CFLAGS += $(DEBUG_FLAGS) # ARFLAGS = rcsv ARFLAGS = rcs OBJS = gpio_common_all.o gpio_common_3a3u3x.o pmc.o usart.o diff --git a/lib/stm32/f0/Makefile b/lib/stm32/f0/Makefile index a9faff72..0378e730 100644 --- a/lib/stm32/f0/Makefile +++ b/lib/stm32/f0/Makefile @@ -24,13 +24,14 @@ PREFIX ?= arm-none-eabi #PREFIX ?= arm-elf CC = $(PREFIX)-gcc AR = $(PREFIX)-ar -CFLAGS = -Os -g \ +CFLAGS = -Os \ -Wall -Wextra -Wimplicit-function-declaration \ -Wredundant-decls -Wmissing-prototypes -Wstrict-prototypes \ -Wundef -Wshadow \ -I../../../include -fno-common \ -mcpu=cortex-m0 $(FP_FLAGS) -mthumb -Wstrict-prototypes \ -ffunction-sections -fdata-sections -MD -DSTM32F0 +CFLAGS += $(DEBUG_FLAGS) ARFLAGS = rcs diff --git a/lib/stm32/f1/Makefile b/lib/stm32/f1/Makefile index 6c8d4ced..a52e50ca 100755 --- a/lib/stm32/f1/Makefile +++ b/lib/stm32/f1/Makefile @@ -24,13 +24,14 @@ PREFIX ?= arm-none-eabi CC = $(PREFIX)-gcc AR = $(PREFIX)-ar -CFLAGS = -Os -g \ +CFLAGS = -Os \ -Wall -Wextra -Wimplicit-function-declaration \ -Wredundant-decls -Wmissing-prototypes -Wstrict-prototypes \ -Wundef -Wshadow \ -I../../../include -fno-common \ -mcpu=cortex-m3 $(FP_FLAGS) -mthumb -Wstrict-prototypes \ -ffunction-sections -fdata-sections -MD -DSTM32F1 +CFLAGS += $(DEBUG_FLAGS) # ARFLAGS = rcsv ARFLAGS = rcs diff --git a/lib/stm32/f2/Makefile b/lib/stm32/f2/Makefile index 74d97e7d..794d162b 100644 --- a/lib/stm32/f2/Makefile +++ b/lib/stm32/f2/Makefile @@ -24,13 +24,14 @@ PREFIX ?= arm-none-eabi CC = $(PREFIX)-gcc AR = $(PREFIX)-ar -CFLAGS = -Os -g \ +CFLAGS = -Os \ -Wall -Wextra -Wimplicit-function-declaration \ -Wredundant-decls -Wmissing-prototypes -Wstrict-prototypes \ -Wundef -Wshadow \ -I../../../include -fno-common \ -mcpu=cortex-m3 -mthumb $(FP_FLAGS) -Wstrict-prototypes \ -ffunction-sections -fdata-sections -MD -DSTM32F2 +CFLAGS += $(DEBUG_FLAGS) # ARFLAGS = rcsv ARFLAGS = rcs diff --git a/lib/stm32/f3/Makefile b/lib/stm32/f3/Makefile index 5ef282ad..a8b1a75e 100644 --- a/lib/stm32/f3/Makefile +++ b/lib/stm32/f3/Makefile @@ -25,13 +25,14 @@ PREFIX ?= arm-none-eabi CC = $(PREFIX)-gcc AR = $(PREFIX)-ar -CFLAGS = -Os -g \ +CFLAGS = -Os \ -Wall -Wextra -Wimplicit-function-declaration \ -Wredundant-decls -Wmissing-prototypes -Wstrict-prototypes \ -Wundef -Wshadow \ -I../../../include -fno-common \ -mcpu=cortex-m4 -mthumb $(FP_FLAGS) -Wstrict-prototypes \ -ffunction-sections -fdata-sections -MD -DSTM32F3 +CFLAGS += $(DEBUG_FLAGS) ARFLAGS = rcs diff --git a/lib/stm32/f4/Makefile b/lib/stm32/f4/Makefile index c25d4d13..a1775c86 100644 --- a/lib/stm32/f4/Makefile +++ b/lib/stm32/f4/Makefile @@ -26,7 +26,7 @@ PREFIX ?= arm-none-eabi CC = $(PREFIX)-gcc AR = $(PREFIX)-ar -CFLAGS = -Os -g \ +CFLAGS = -Os \ -Wall -Wextra -Wimplicit-function-declaration \ -Wredundant-decls -Wmissing-prototypes -Wstrict-prototypes \ -Wundef -Wshadow \ @@ -34,6 +34,7 @@ CFLAGS = -Os -g \ -mcpu=cortex-m4 -mthumb $(FP_FLAGS) \ -Wstrict-prototypes \ -ffunction-sections -fdata-sections -MD -DSTM32F4 +CFLAGS += $(DEBUG_FLAGS) # ARFLAGS = rcsv ARFLAGS = rcs diff --git a/lib/stm32/l0/Makefile b/lib/stm32/l0/Makefile index ae4a4688..1c9c658b 100644 --- a/lib/stm32/l0/Makefile +++ b/lib/stm32/l0/Makefile @@ -24,13 +24,14 @@ PREFIX ?= arm-none-eabi #PREFIX ?= arm-elf CC = $(PREFIX)-gcc AR = $(PREFIX)-ar -CFLAGS = -Os -g \ +CFLAGS = -Os \ -Wall -Wextra -Wimplicit-function-declaration \ -Wredundant-decls -Wmissing-prototypes -Wstrict-prototypes \ -Wundef -Wshadow \ -I../../../include -fno-common \ -mcpu=cortex-m0plus $(FP_FLAGS) -mthumb -Wstrict-prototypes \ -ffunction-sections -fdata-sections -MD -DSTM32L0 +CFLAGS += $(DEBUG_FLAGS) ARFLAGS = rcs diff --git a/lib/stm32/l1/Makefile b/lib/stm32/l1/Makefile index 00f4ba1b..3e719afb 100644 --- a/lib/stm32/l1/Makefile +++ b/lib/stm32/l1/Makefile @@ -24,13 +24,14 @@ PREFIX ?= arm-none-eabi CC = $(PREFIX)-gcc AR = $(PREFIX)-ar -CFLAGS = -Os -g \ +CFLAGS = -Os \ -Wall -Wextra -Wimplicit-function-declaration \ -Wredundant-decls -Wmissing-prototypes -Wstrict-prototypes \ -Wundef -Wshadow \ -I../../../include -fno-common \ -mcpu=cortex-m3 $(FP_FLAGS) -mthumb -Wstrict-prototypes \ -ffunction-sections -fdata-sections -MD -DSTM32L1 +CFLAGS += $(DEBUG_FLAGS) # ARFLAGS = rcsv ARFLAGS = rcs OBJS = crc.o desig.o flash.o rcc.o usart.o dma.o lcd.o diff --git a/lib/vf6xx/Makefile b/lib/vf6xx/Makefile index 78bd424b..78958dd4 100644 --- a/lib/vf6xx/Makefile +++ b/lib/vf6xx/Makefile @@ -26,13 +26,14 @@ PREFIX ?= arm-none-eabi CC = $(PREFIX)-gcc AR = $(PREFIX)-ar -CFLAGS = -Os -g \ +CFLAGS = -Os \ -Wall -Wextra -Wimplicit-function-declaration \ -Wredundant-decls -Wmissing-prototypes -Wstrict-prototypes \ -Wundef -Wshadow \ -I../../include -fno-common \ -mcpu=cortex-m4 -mthumb $(FP_FLAGS) -Wstrict-prototypes \ -ffunction-sections -fdata-sections -MD -DVF6XX +CFLAGS += $(DEBUG_FLAGS) ARFLAGS = rcs OBJS = ccm.o uart.o gpio.o iomuxc.o