From 670689955165fdb336d3da491904b656e5788b43 Mon Sep 17 00:00:00 2001 From: chrysn Date: Fri, 19 Oct 2012 15:18:21 +0200 Subject: [PATCH 1/5] build vector.o on lpc13xx no idea how this ever worked... --- lib/lpc13xx/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/lpc13xx/Makefile b/lib/lpc13xx/Makefile index e1e69f7b..bc7e198d 100644 --- a/lib/lpc13xx/Makefile +++ b/lib/lpc13xx/Makefile @@ -28,7 +28,7 @@ CFLAGS = -Os -g -Wall -Wextra -I../../include -fno-common \ -ffunction-sections -fdata-sections -MD # ARFLAGS = rcsv ARFLAGS = rcs -OBJS = gpio.o assert.o +OBJS = gpio.o assert.o vector.o VPATH += ../cm3 From 75c216582774549aede37db1d5d6b8485acfce17 Mon Sep 17 00:00:00 2001 From: chrysn Date: Fri, 19 Oct 2012 18:56:39 +0200 Subject: [PATCH 2/5] build common .o files everywhere (fixes issue #29) vector.o, nvic.o, scb.o and assert.o are available on every platform, but at least some of them differ between the implementations. they already got built explicityly on some platforms; now adding them to the common Makefile.include. --- lib/Makefile.include | 3 +++ lib/lpc13xx/Makefile | 2 +- lib/lpc17xx/Makefile | 2 +- lib/lpc43xx/Makefile | 3 +-- lib/stm32/f1/Makefile | 6 +++--- lib/stm32/f2/Makefile | 4 ++-- lib/stm32/f4/Makefile | 7 +++---- 7 files changed, 14 insertions(+), 13 deletions(-) diff --git a/lib/Makefile.include b/lib/Makefile.include index 9fbea244..6c25069d 100644 --- a/lib/Makefile.include +++ b/lib/Makefile.include @@ -23,6 +23,9 @@ ifneq ($(V),1) Q := @ endif +# common objects +OBJS += vector.o systick.o scb.o nvic.o assert.o + all: $(SRCLIBDIR)/$(LIBNAME).a $(SRCLIBDIR)/$(LIBNAME).a: $(SRCLIBDIR)/$(LIBNAME).ld $(OBJS) diff --git a/lib/lpc13xx/Makefile b/lib/lpc13xx/Makefile index bc7e198d..dd460b8f 100644 --- a/lib/lpc13xx/Makefile +++ b/lib/lpc13xx/Makefile @@ -28,7 +28,7 @@ CFLAGS = -Os -g -Wall -Wextra -I../../include -fno-common \ -ffunction-sections -fdata-sections -MD # ARFLAGS = rcsv ARFLAGS = rcs -OBJS = gpio.o assert.o vector.o +OBJS = gpio.o VPATH += ../cm3 diff --git a/lib/lpc17xx/Makefile b/lib/lpc17xx/Makefile index d1da64af..f5fa7927 100644 --- a/lib/lpc17xx/Makefile +++ b/lib/lpc17xx/Makefile @@ -28,7 +28,7 @@ CFLAGS = -O0 -g -Wall -Wextra -I../../include -fno-common \ -ffunction-sections -fdata-sections -MD # ARFLAGS = rcsv ARFLAGS = rcs -OBJS = gpio.o vector.o assert.o +OBJS = gpio.o VPATH += ../cm3 diff --git a/lib/lpc43xx/Makefile b/lib/lpc43xx/Makefile index 6e08ea0e..a3a5361f 100644 --- a/lib/lpc43xx/Makefile +++ b/lib/lpc43xx/Makefile @@ -31,8 +31,7 @@ CFLAGS = -O2 -g3 -Wall -Wextra -I../../include -fno-common \ -mfloat-abi=hard -mfpu=fpv4-sp-d16 # ARFLAGS = rcsv ARFLAGS = rcs -OBJS = gpio.o vector.o scu.o i2c.o ssp.o nvic.o systick.o \ - assert.o +OBJS = gpio.o scu.o i2c.o ssp.o VPATH += ../cm3 diff --git a/lib/stm32/f1/Makefile b/lib/stm32/f1/Makefile index a2f7bf28..2bd5ff09 100644 --- a/lib/stm32/f1/Makefile +++ b/lib/stm32/f1/Makefile @@ -28,10 +28,10 @@ CFLAGS = -Os -g -Wall -Wextra -I../../../include -fno-common \ -ffunction-sections -fdata-sections -MD -DSTM32F1 # ARFLAGS = rcsv ARFLAGS = rcs -OBJS = vector.o rcc.o gpio.o usart.o adc.o spi.o flash.o nvic.o \ - rtc.o i2c.o dma.o systick.o exti.o scb.o ethernet.o \ +OBJS = rcc.o gpio.o usart.o adc.o spi.o flash.o \ + rtc.o i2c.o dma.o exti.o ethernet.o \ usb_f103.o usb.o usb_control.o usb_standard.o can.o \ - timer.o usb_f107.o desig.o crc.o assert.o dac.o iwdg.o pwr.o + timer.o usb_f107.o desig.o crc.o dac.o iwdg.o pwr.o VPATH += ../../usb:../:../../cm3 diff --git a/lib/stm32/f2/Makefile b/lib/stm32/f2/Makefile index c127d61f..69521da4 100644 --- a/lib/stm32/f2/Makefile +++ b/lib/stm32/f2/Makefile @@ -28,8 +28,8 @@ CFLAGS = -Os -g -Wall -Wextra -I../../../include -fno-common \ -ffunction-sections -fdata-sections -MD -DSTM32F2 # ARFLAGS = rcsv ARFLAGS = rcs -OBJS = vector.o rcc.o gpio.o usart.o spi.o flash.o nvic.o \ - i2c.o systick.o exti.o scb.o timer.o assert.o +OBJS = rcc.o gpio.o usart.o spi.o flash.o nvic.o \ + i2c.o exti.o timer.o VPATH += ../../usb:../:../../cm3 diff --git a/lib/stm32/f4/Makefile b/lib/stm32/f4/Makefile index fd0b2793..180e537c 100644 --- a/lib/stm32/f4/Makefile +++ b/lib/stm32/f4/Makefile @@ -29,10 +29,9 @@ CFLAGS = -Os -g -Wall -Wextra -I../../../include -fno-common \ -ffunction-sections -fdata-sections -MD -DSTM32F4 # ARFLAGS = rcsv ARFLAGS = rcs -OBJS = vector.o rcc.o gpio.o usart.o spi.o flash.o nvic.o \ - i2c.o systick.o exti.o scb.o pwr.o timer.o \ - usb.o usb_standard.o usb_control.o usb_f107.o \ - assert.o +OBJS = rcc.o gpio.o usart.o spi.o flash.o nvic.o \ + i2c.o exti.o pwr.o timer.o \ + usb.o usb_standard.o usb_control.o usb_f107.o VPATH += ../../usb:../:../../cm3 From 99d7b210323be1d87dd6cc34c9bb5c53e401b5c3 Mon Sep 17 00:00:00 2001 From: chrysn Date: Fri, 19 Oct 2012 19:05:27 +0200 Subject: [PATCH 3/5] define platform specific constants for all chips previously, only stm32 chips passed the information about which chip to build on into the compiler. this information is essential to dispatch, thus defining LPC13XX, LPC17XX, LPC43XX and LM3S in analogy to STM32F1..4. --- examples/lm3s/Makefile.include | 2 +- examples/lpc13xx/Makefile.include | 2 +- examples/lpc17xx/Makefile.include | 2 +- examples/lpc43xx/Makefile.include | 2 +- lib/lm3s/Makefile | 2 +- lib/lpc13xx/Makefile | 2 +- lib/lpc17xx/Makefile | 2 +- lib/lpc43xx/Makefile | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/lm3s/Makefile.include b/examples/lm3s/Makefile.include index f5190638..c9bd33ca 100644 --- a/examples/lm3s/Makefile.include +++ b/examples/lm3s/Makefile.include @@ -37,7 +37,7 @@ endif endif CFLAGS += -O0 -g3 -Wall -Wextra -I$(TOOLCHAIN_DIR)/include -fno-common \ - -mcpu=cortex-m3 -mthumb -MD + -mcpu=cortex-m3 -mthumb -MD -DLM3S LDSCRIPT ?= $(BINARY).ld LDFLAGS += -L$(TOOLCHAIN_DIR)/lib \ -T$(LDSCRIPT) -nostartfiles -Wl,--gc-sections diff --git a/examples/lpc13xx/Makefile.include b/examples/lpc13xx/Makefile.include index d8aeff09..0b220638 100644 --- a/examples/lpc13xx/Makefile.include +++ b/examples/lpc13xx/Makefile.include @@ -37,7 +37,7 @@ endif endif CFLAGS += -Os -g -Wall -Wextra -I$(TOOLCHAIN_DIR)/include -fno-common \ - -mcpu=cortex-m3 -mthumb -MD + -mcpu=cortex-m3 -mthumb -MD -DLPC13XX LDSCRIPT ?= $(BINARY).ld LDFLAGS += -L$(TOOLCHAIN_DIR)/lib \ -T$(LDSCRIPT) -nostartfiles -Wl,--gc-sections diff --git a/examples/lpc17xx/Makefile.include b/examples/lpc17xx/Makefile.include index 6d7bbfe5..9c38a68d 100644 --- a/examples/lpc17xx/Makefile.include +++ b/examples/lpc17xx/Makefile.include @@ -37,7 +37,7 @@ endif endif CFLAGS += -O0 -g -Wall -Wextra -I$(TOOLCHAIN_DIR)/include -fno-common \ - -mcpu=cortex-m3 -mthumb -MD + -mcpu=cortex-m3 -mthumb -MD -DLPC17XX LDSCRIPT ?= $(BINARY).ld LDFLAGS += -L$(TOOLCHAIN_DIR)/lib \ -T$(LDSCRIPT) -nostartfiles -Wl,--gc-sections diff --git a/examples/lpc43xx/Makefile.include b/examples/lpc43xx/Makefile.include index 15e523b4..cf78538f 100644 --- a/examples/lpc43xx/Makefile.include +++ b/examples/lpc43xx/Makefile.include @@ -41,7 +41,7 @@ endif CFLAGS += -O2 -g -Wall -Wextra -I$(TOOLCHAIN_DIR)/include -fno-common \ -mcpu=cortex-m4 -mthumb -MD \ - -mfloat-abi=hard -mfpu=fpv4-sp-d16 + -mfloat-abi=hard -mfpu=fpv4-sp-d16 -DLPC43XX LDSCRIPT ?= $(BINARY).ld LDFLAGS += -L$(TOOLCHAIN_DIR)/lib \ -T$(LDSCRIPT) -nostartfiles -Wl,--gc-sections -Xlinker -Map=$(BINARY).map diff --git a/lib/lm3s/Makefile b/lib/lm3s/Makefile index e471a001..6fc814d4 100644 --- a/lib/lm3s/Makefile +++ b/lib/lm3s/Makefile @@ -25,7 +25,7 @@ CC = $(PREFIX)-gcc AR = $(PREFIX)-ar CFLAGS = -Os -g -Wall -Wextra -I../../include -fno-common \ -mcpu=cortex-m3 -mthumb -Wstrict-prototypes \ - -ffunction-sections -fdata-sections -MD + -ffunction-sections -fdata-sections -MD -DLM3S # ARFLAGS = rcsv ARFLAGS = rcs OBJS = gpio.o vector.o assert.o diff --git a/lib/lpc13xx/Makefile b/lib/lpc13xx/Makefile index dd460b8f..15bc6868 100644 --- a/lib/lpc13xx/Makefile +++ b/lib/lpc13xx/Makefile @@ -25,7 +25,7 @@ CC = $(PREFIX)-gcc AR = $(PREFIX)-ar CFLAGS = -Os -g -Wall -Wextra -I../../include -fno-common \ -mcpu=cortex-m3 -mthumb -Wstrict-prototypes \ - -ffunction-sections -fdata-sections -MD + -ffunction-sections -fdata-sections -MD -DLPC13XX # ARFLAGS = rcsv ARFLAGS = rcs OBJS = gpio.o diff --git a/lib/lpc17xx/Makefile b/lib/lpc17xx/Makefile index f5fa7927..19fc1529 100644 --- a/lib/lpc17xx/Makefile +++ b/lib/lpc17xx/Makefile @@ -25,7 +25,7 @@ CC = $(PREFIX)-gcc AR = $(PREFIX)-ar CFLAGS = -O0 -g -Wall -Wextra -I../../include -fno-common \ -mcpu=cortex-m3 -mthumb -Wstrict-prototypes \ - -ffunction-sections -fdata-sections -MD + -ffunction-sections -fdata-sections -MD -DLPC17XX # ARFLAGS = rcsv ARFLAGS = rcs OBJS = gpio.o diff --git a/lib/lpc43xx/Makefile b/lib/lpc43xx/Makefile index a3a5361f..efbba0dd 100644 --- a/lib/lpc43xx/Makefile +++ b/lib/lpc43xx/Makefile @@ -28,7 +28,7 @@ AR = $(PREFIX)-ar CFLAGS = -O2 -g3 -Wall -Wextra -I../../include -fno-common \ -mcpu=cortex-m4 -mthumb -Wstrict-prototypes \ -ffunction-sections -fdata-sections -MD \ - -mfloat-abi=hard -mfpu=fpv4-sp-d16 + -mfloat-abi=hard -mfpu=fpv4-sp-d16 -DLPC43XX # ARFLAGS = rcsv ARFLAGS = rcs OBJS = gpio.o scu.o i2c.o ssp.o From 14a5fc78cf5e50364d6268aaeb1871966ee89b32 Mon Sep 17 00:00:00 2001 From: chrysn Date: Fri, 19 Oct 2012 19:07:30 +0200 Subject: [PATCH 4/5] completing dispatch the LM3S irq list was previously unused as it was missing in the dispatch files; now it got added. (before HEAD^, it wouldn't have made any difference because the discriminating constant wasn't defined anyway) also, this enhances the warning messages --- include/libopencm3/dispatch/nvic.h | 5 ++++- lib/dispatch/vector_nvic.c | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/include/libopencm3/dispatch/nvic.h b/include/libopencm3/dispatch/nvic.h index d8e7889a..441fd285 100644 --- a/include/libopencm3/dispatch/nvic.h +++ b/include/libopencm3/dispatch/nvic.h @@ -11,8 +11,11 @@ #elif defined(LPC43XX) # include +#elif defined(LM3S) +# include + #else -# warning"no chipset defined; user interrupts are disabled" +# warning"no interrupts defined for chipset; NVIC_IRQ_COUNT = 0" #define NVIC_IRQ_COUNT 0 diff --git a/lib/dispatch/vector_nvic.c b/lib/dispatch/vector_nvic.c index fc5fdd2a..d5e4a606 100644 --- a/lib/dispatch/vector_nvic.c +++ b/lib/dispatch/vector_nvic.c @@ -11,8 +11,11 @@ #elif defined(LPC43XX) # include "../lpc43xx/vector_nvic.c" +#elif defined(LM3S) +# include "../lm3s/vector_nvic.c" + #else -# warning"no chipset defined; user interrupts are disabled" +# warning"no interrupts defined for chipset; not allocating space in the vector table" #define IRQ_HANDLERS From f62eee7644f0dc329be0268633a39d0db11cd463 Mon Sep 17 00:00:00 2001 From: chrysn Date: Fri, 19 Oct 2012 19:29:06 +0200 Subject: [PATCH 5/5] remove nvic.o from stm32/f[24]'s explicit list this was missed out in 75c216582, see there for details --- lib/stm32/f2/Makefile | 2 +- lib/stm32/f4/Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/stm32/f2/Makefile b/lib/stm32/f2/Makefile index 69521da4..5cbb9770 100644 --- a/lib/stm32/f2/Makefile +++ b/lib/stm32/f2/Makefile @@ -28,7 +28,7 @@ CFLAGS = -Os -g -Wall -Wextra -I../../../include -fno-common \ -ffunction-sections -fdata-sections -MD -DSTM32F2 # ARFLAGS = rcsv ARFLAGS = rcs -OBJS = rcc.o gpio.o usart.o spi.o flash.o nvic.o \ +OBJS = rcc.o gpio.o usart.o spi.o flash.o \ i2c.o exti.o timer.o VPATH += ../../usb:../:../../cm3 diff --git a/lib/stm32/f4/Makefile b/lib/stm32/f4/Makefile index 180e537c..e09ef26d 100644 --- a/lib/stm32/f4/Makefile +++ b/lib/stm32/f4/Makefile @@ -29,7 +29,7 @@ CFLAGS = -Os -g -Wall -Wextra -I../../../include -fno-common \ -ffunction-sections -fdata-sections -MD -DSTM32F4 # ARFLAGS = rcsv ARFLAGS = rcs -OBJS = rcc.o gpio.o usart.o spi.o flash.o nvic.o \ +OBJS = rcc.o gpio.o usart.o spi.o flash.o \ i2c.o exti.o pwr.o timer.o \ usb.o usb_standard.o usb_control.o usb_f107.o