aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--examples/lm3s/Makefile.include6
-rw-r--r--examples/lpc13xx/Makefile.include6
-rw-r--r--examples/lpc17xx/Makefile.include6
-rw-r--r--examples/lpc43xx/Makefile.include6
-rw-r--r--examples/stm32/f1/Makefile.include8
-rw-r--r--examples/stm32/f2/Makefile.include6
-rw-r--r--examples/stm32/f4/Makefile.include6
8 files changed, 37 insertions, 9 deletions
diff --git a/Makefile b/Makefile
index 37c0c40..492b618 100644
--- a/Makefile
+++ b/Makefile
@@ -26,7 +26,7 @@ SHAREDIR = $(DESTDIR)/$(PREFIX)/share/libopencm3/scripts
INSTALL = install
SRCLIBDIR = $(shell pwd)/lib
-TARGETS = stm32/f1 stm32/f2 stm32/f4 lpc13xx lpc17xx lpc43xx lm3s
+TARGETS = stm32/f1 stm32/f2 stm32/f4 lpc13xx lpc17xx lpc43xx lm3s
# Be silent per default, but 'make V=1' will show all compiler calls.
ifneq ($(V),1)
diff --git a/examples/lm3s/Makefile.include b/examples/lm3s/Makefile.include
index 0e18bd6..f519063 100644
--- a/examples/lm3s/Makefile.include
+++ b/examples/lm3s/Makefile.include
@@ -24,14 +24,18 @@ CC = $(PREFIX)-gcc
LD = $(PREFIX)-gcc
OBJCOPY = $(PREFIX)-objcopy
OBJDUMP = $(PREFIX)-objdump
+
+TOOLCHAIN_DIR ?= ../../../..
ifeq ($(wildcard ../../../../lib/libopencm3_lm3s.a),)
+ifneq ($(strip $(shell which $(CC))),)
TOOLCHAIN_DIR := $(shell dirname `which $(CC)`)/../$(PREFIX)
+endif
else
ifeq ($(V),1)
$(info We seem to be building the example in the source directory. Using local library!)
endif
-TOOLCHAIN_DIR := ../../../..
endif
+
CFLAGS += -O0 -g3 -Wall -Wextra -I$(TOOLCHAIN_DIR)/include -fno-common \
-mcpu=cortex-m3 -mthumb -MD
LDSCRIPT ?= $(BINARY).ld
diff --git a/examples/lpc13xx/Makefile.include b/examples/lpc13xx/Makefile.include
index cc668f8..d8aeff0 100644
--- a/examples/lpc13xx/Makefile.include
+++ b/examples/lpc13xx/Makefile.include
@@ -24,14 +24,18 @@ CC = $(PREFIX)-gcc
LD = $(PREFIX)-gcc
OBJCOPY = $(PREFIX)-objcopy
OBJDUMP = $(PREFIX)-objdump
+
+TOOLCHAIN_DIR ?= ../../../..
ifeq ($(wildcard ../../../../lib/libopencm3_lpc13xx.a),)
+ifneq ($(strip $(shell which $(CC))),)
TOOLCHAIN_DIR := $(shell dirname `which $(CC)`)/../$(PREFIX)
+endif
else
ifeq ($(V),1)
$(info We seem to be building the example in the source directory. Using local library!)
endif
-TOOLCHAIN_DIR := ../../../..
endif
+
CFLAGS += -Os -g -Wall -Wextra -I$(TOOLCHAIN_DIR)/include -fno-common \
-mcpu=cortex-m3 -mthumb -MD
LDSCRIPT ?= $(BINARY).ld
diff --git a/examples/lpc17xx/Makefile.include b/examples/lpc17xx/Makefile.include
index 66688d3..6d7bbfe 100644
--- a/examples/lpc17xx/Makefile.include
+++ b/examples/lpc17xx/Makefile.include
@@ -24,14 +24,18 @@ CC = $(PREFIX)-gcc
LD = $(PREFIX)-gcc
OBJCOPY = $(PREFIX)-objcopy
OBJDUMP = $(PREFIX)-objdump
+
+TOOLCHAIN_DIR ?= ../../../..
ifeq ($(wildcard ../../../../lib/libopencm3_lpc17xx.a),)
+ifneq ($(strip $(shell which $(CC))),)
TOOLCHAIN_DIR := $(shell dirname `which $(CC)`)/../$(PREFIX)
+endif
else
ifeq ($(V),1)
$(info We seem to be building the example in the source directory. Using local library!)
endif
-TOOLCHAIN_DIR := ../../../..
endif
+
CFLAGS += -O0 -g -Wall -Wextra -I$(TOOLCHAIN_DIR)/include -fno-common \
-mcpu=cortex-m3 -mthumb -MD
LDSCRIPT ?= $(BINARY).ld
diff --git a/examples/lpc43xx/Makefile.include b/examples/lpc43xx/Makefile.include
index 4b1a092..15e523b 100644
--- a/examples/lpc43xx/Makefile.include
+++ b/examples/lpc43xx/Makefile.include
@@ -27,14 +27,18 @@ LD = $(PREFIX)-gcc
OBJCOPY = $(PREFIX)-objcopy
OBJDUMP = $(PREFIX)-objdump
GDB = $(PREFIX)-gdb
+
+TOOLCHAIN_DIR ?= ../../../..
ifeq ($(wildcard ../../../../lib/libopencm3_lpc43xx.a),)
+ifneq ($(strip $(shell which $(CC))),)
TOOLCHAIN_DIR := $(shell dirname `which $(CC)`)/../$(PREFIX)
+endif
else
ifeq ($(V),1)
$(info We seem to be building the example in the source directory. Using local library!)
endif
-TOOLCHAIN_DIR := ../../../..
endif
+
CFLAGS += -O2 -g -Wall -Wextra -I$(TOOLCHAIN_DIR)/include -fno-common \
-mcpu=cortex-m4 -mthumb -MD \
-mfloat-abi=hard -mfpu=fpv4-sp-d16
diff --git a/examples/stm32/f1/Makefile.include b/examples/stm32/f1/Makefile.include
index 60f44e7..6b87b98 100644
--- a/examples/stm32/f1/Makefile.include
+++ b/examples/stm32/f1/Makefile.include
@@ -25,14 +25,18 @@ LD = $(PREFIX)-gcc
OBJCOPY = $(PREFIX)-objcopy
OBJDUMP = $(PREFIX)-objdump
GDB = $(PREFIX)-gdb
+
+TOOLCHAIN_DIR ?= ../../../../..
ifeq ($(wildcard ../../../../../lib/libopencm3_stm32f1.a),)
+ifneq ($(strip $(shell which $(CC))),)
TOOLCHAIN_DIR := $(shell dirname `which $(CC)`)/../$(PREFIX)
+endif
else
ifeq ($(V),1)
-$(info We seem to be building the example in the source directory. Using local library!)
+$(info We seem to be building the example in the source directory. Using local library!)
endif
-TOOLCHAIN_DIR := ../../../../..
endif
+
ARCH_FLAGS = -mthumb -mcpu=cortex-m3 -msoft-float
CFLAGS += -Os -g -Wall -Wextra -I$(TOOLCHAIN_DIR)/include \
-fno-common $(ARCH_FLAGS) -MD -DSTM32F1
diff --git a/examples/stm32/f2/Makefile.include b/examples/stm32/f2/Makefile.include
index 690f8c4..10eed79 100644
--- a/examples/stm32/f2/Makefile.include
+++ b/examples/stm32/f2/Makefile.include
@@ -26,14 +26,18 @@ LD = $(PREFIX)-gcc
OBJCOPY = $(PREFIX)-objcopy
OBJDUMP = $(PREFIX)-objdump
GDB = $(PREFIX)-gdb
+
+TOOLCHAIN_DIR ?= ../../../../..
ifeq ($(wildcard ../../../../../lib/libopencm3_stm32f2.a),)
+ifneq ($(strip $(shell which $(CC))),)
TOOLCHAIN_DIR := $(shell dirname `which $(CC)`)/../$(PREFIX)
+endif
else
ifeq ($(V),1)
$(info We seem to be building the example in the source directory. Using local library!)
endif
-TOOLCHAIN_DIR := ../../../../..
endif
+
CFLAGS += -Os -g -Wall -Wextra -I$(TOOLCHAIN_DIR)/include \
-fno-common -mcpu=cortex-m3 -mthumb -msoft-float -MD -DSTM32F2
LDSCRIPT ?= $(BINARY).ld
diff --git a/examples/stm32/f4/Makefile.include b/examples/stm32/f4/Makefile.include
index f436bc8..815f375 100644
--- a/examples/stm32/f4/Makefile.include
+++ b/examples/stm32/f4/Makefile.include
@@ -27,14 +27,18 @@ OBJCOPY = $(PREFIX)-objcopy
OBJDUMP = $(PREFIX)-objdump
GDB = $(PREFIX)-gdb
FLASH = $(shell which st-flash)
+
+TOOLCHAIN_DIR ?= ../../../../..
ifeq ($(wildcard ../../../../../lib/libopencm3_stm32f4.a),)
+ifneq ($(strip $(shell which $(CC))),)
TOOLCHAIN_DIR := $(shell dirname `which $(CC)`)/../$(PREFIX)
+endif
else
ifeq ($(V),1)
$(info We seem to be building the example in the source directory. Using local library!)
endif
-TOOLCHAIN_DIR := ../../../../..
endif
+
CFLAGS += -Os -g -Wall -Wextra -I$(TOOLCHAIN_DIR)/include \
-fno-common -mcpu=cortex-m4 -mthumb \
-mfloat-abi=hard -mfpu=fpv4-sp-d16 -MD -DSTM32F4