diff --git a/examples/lm3s/Makefile.include b/examples/lm3s/Makefile.include
index d95ac8e..06dd29c 100644
--- a/examples/lm3s/Makefile.include
+++ b/examples/lm3s/Makefile.include
@@ -18,120 +18,26 @@
## along with this library. If not, see .
##
-PREFIX ?= arm-none-eabi
-#PREFIX ?= arm-elf
-CC = $(PREFIX)-gcc
-LD = $(PREFIX)-gcc
-OBJCOPY = $(PREFIX)-objcopy
-OBJDUMP = $(PREFIX)-objdump
+LIBNAME = opencm3_lm3s
+DEFS = -DLM3S
-TOOLCHAIN_DIR ?= ../../../../libopencm3
-ifeq ($(wildcard ../../../../libopencm3/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
-endif
+ARCH_FLAGS = -mthumb -mcpu=cortex-m3 -msoft-float
-CFLAGS += -O0 -g3 \
- -Wall -Wextra -Wimplicit-function-declaration \
- -Wredundant-decls -Wmissing-prototypes -Wstrict-prototypes \
- -Wundef -Wshadow \
- -I$(TOOLCHAIN_DIR)/include -fno-common \
- -mcpu=cortex-m3 -mthumb -MD -DLM3S
-LDSCRIPT ?= $(BINARY).ld
-LDFLAGS += -L$(TOOLCHAIN_DIR)/lib \
- -T$(LDSCRIPT) -nostartfiles -Wl,--gc-sections
-OBJS += $(BINARY).o
+################################################################################
+# OpenOCD specific variables
OOCD ?= openocd
OOCD_INTERFACE ?= flossjtag
OOCD_BOARD ?= olimex_stm32_h103
-# FIXME
-# Be silent per default, but 'make V=1' will show all compiler calls.
-ifneq ($(V),1)
-Q := @
-NULL := 2>/dev/null
-else
-LDFLAGS += -Wl,--print-gc-sections
-endif
+################################################################################
+# Black Magic Probe specific variables
+# Set the BMP_PORT to a serial port and then BMP is used for flashing
+BMP_PORT ?=
-.SUFFIXES: .elf .bin .hex .srec .list .images
-.SECONDEXPANSION:
-.SECONDARY:
+################################################################################
+# texane/stlink specific variables
+#STLINK_PORT ?= :4242
-all: images
-
-images: $(BINARY).images
-flash: $(BINARY).flash
-
-%.images: %.bin %.hex %.srec %.list
- @#printf "*** $* images generated ***\n"
-
-%.bin: %.elf
- @#printf " OBJCOPY $(*).bin\n"
- $(Q)$(OBJCOPY) -Obinary $(*).elf $(*).bin
-
-%.hex: %.elf
- @#printf " OBJCOPY $(*).hex\n"
- $(Q)$(OBJCOPY) -Oihex $(*).elf $(*).hex
-
-%.srec: %.elf
- @#printf " OBJCOPY $(*).srec\n"
- $(Q)$(OBJCOPY) -Osrec $(*).elf $(*).srec
-
-%.list: %.elf
- @#printf " OBJDUMP $(*).list\n"
- $(Q)$(OBJDUMP) -S $(*).elf > $(*).list
-
-%.elf: $(OBJS) $(LDSCRIPT) $(TOOLCHAIN_DIR)/lib/libopencm3_lm3s.a
- @#printf " LD $(subst $(shell pwd)/,,$(@))\n"
- $(Q)$(LD) $(LDFLAGS) -o $(*).elf $(OBJS) -lopencm3_lm3s
-
-%.o: %.c Makefile
- @#printf " CC $(subst $(shell pwd)/,,$(@))\n"
- $(Q)$(CC) $(CFLAGS) -o $@ -c $<
-
-clean:
- $(Q)rm -f *.o
- $(Q)rm -f *.d
- $(Q)rm -f *.elf
- $(Q)rm -f *.bin
- $(Q)rm -f *.hex
- $(Q)rm -f *.srec
- $(Q)rm -f *.list
-
-# FIXME: Replace STM32 stuff with proper LPC13XX OpenOCD support later.
-ifeq ($(OOCD_SERIAL),)
-%.flash: %.hex
- @printf " FLASH $<\n"
- @# IMPORTANT: Don't use "resume", only "reset" will work correctly!
- $(Q)$(OOCD) -f interface/$(OOCD_INTERFACE).cfg \
- -f board/$(OOCD_BOARD).cfg \
- -c "init" -c "reset init" \
- -c "stm32x mass_erase 0" \
- -c "flash write_image $(*).hex" \
- -c "reset" \
- -c "shutdown" $(NULL)
-else
-%.flash: %.hex
- @printf " FLASH $<\n"
- @# IMPORTANT: Don't use "resume", only "reset" will work correctly!
- $(Q)$(OOCD) -f interface/$(OOCD_INTERFACE).cfg \
- -f board/$(OOCD_BOARD).cfg \
- -c "ft2232_serial $(OOCD_SERIAL)" \
- -c "init" -c "reset init" \
- -c "stm32x mass_erase 0" \
- -c "flash write_image $(*).hex" \
- -c "reset" \
- -c "shutdown" $(NULL)
-endif
-
-.PHONY: images clean
-
--include $(OBJS:.o=.d)
+include ../../../Makefile.rules
diff --git a/examples/lm4f/Makefile.include b/examples/lm4f/Makefile.include
index 73645a8..54a64a9 100644
--- a/examples/lm4f/Makefile.include
+++ b/examples/lm4f/Makefile.include
@@ -19,106 +19,29 @@
## along with this library. If not, see .
##
-PREFIX ?= arm-none-eabi
-CC = $(PREFIX)-gcc
-LD = $(PREFIX)-gcc
-OBJCOPY = $(PREFIX)-objcopy
-OBJDUMP = $(PREFIX)-objdump
+LIBNAME = opencm3_lm4f
+DEFS = -DLM4F
-TOOLCHAIN_DIR ?= ../../../../libopencm3
-ifeq ($(wildcard ../../../../libopencm3/lib/libopencm3_lm4f.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
-endif
+ARCH_FLAGS = -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16
-ARCH_FLAGS = -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16
-CFLAGS += -O0 -g3 \
- -Wall -Wextra -Wimplicit-function-declaration \
- -Wredundant-decls -Wmissing-prototypes -Wstrict-prototypes \
- -Wundef -Wshadow \
- -I$(TOOLCHAIN_DIR)/include \
- -fno-common $(ARCH_FLAGS) -MD -DLM4F
-LDSCRIPT ?= $(BINARY).ld
-LDFLAGS += --static -Wl,--start-group -lc -lgcc -lnosys -Wl,--end-group \
- -L$(TOOLCHAIN_DIR)/lib \
- -T$(LDSCRIPT) -nostartfiles -Wl,--gc-sections \
- $(ARCH_FLAGS)
-
-OBJS += $(BINARY).o
+################################################################################
+# OpenOCD specific variables
# Support for ICDI is available starting with openocd 0.7.0
+
OOCD ?= openocd
+OOCD_INTERFACE ?= flossjtag
OOCD_BOARD ?= ek-lm4f120xl
-# Be silent per default, but 'make V=1' will show all compiler calls.
-ifneq ($(V),1)
-Q := @
-NULL := 2>/dev/null
-else
-LDFLAGS += -Wl,--print-gc-sections
-endif
+################################################################################
+# Black Magic Probe specific variables
+# Set the BMP_PORT to a serial port and then BMP is used for flashing
+BMP_PORT ?=
-.SUFFIXES: .elf .bin .hex .srec .list .images
-.SECONDEXPANSION:
-.SECONDARY:
+################################################################################
+# texane/stlink specific variables
+#STLINK_PORT ?= :4242
-all: images
-images: $(BINARY).images
-flash: $(BINARY).flash
-
-%.images: %.bin %.hex %.srec %.list
- @#printf "*** $* images generated ***\n"
-
-%.bin: %.elf
- @#printf " OBJCOPY $(*).bin\n"
- $(Q)$(OBJCOPY) -Obinary $(*).elf $(*).bin
-
-%.hex: %.elf
- @#printf " OBJCOPY $(*).hex\n"
- $(Q)$(OBJCOPY) -Oihex $(*).elf $(*).hex
-
-%.srec: %.elf
- @#printf " OBJCOPY $(*).srec\n"
- $(Q)$(OBJCOPY) -Osrec $(*).elf $(*).srec
-
-%.list: %.elf
- @#printf " OBJDUMP $(*).list\n"
- $(Q)$(OBJDUMP) -S $(*).elf > $(*).list
-
-%.elf: $(OBJS) $(LDSCRIPT) $(TOOLCHAIN_DIR)/lib/libopencm3_lm4f.a
- @#printf " LD $(subst $(shell pwd)/,,$(@))\n"
- $(Q)$(LD) -o $(*).elf $(OBJS) -lopencm3_lm4f $(LDFLAGS)
-
-%.o: %.c Makefile
- @#printf " CC $(subst $(shell pwd)/,,$(@))\n"
- $(Q)$(CC) $(CFLAGS) -o $@ -c $<
-
-clean:
- $(Q)rm -f *.o
- $(Q)rm -f *.d
- $(Q)rm -f *.elf
- $(Q)rm -f *.bin
- $(Q)rm -f *.hex
- $(Q)rm -f *.srec
- $(Q)rm -f *.list
-
-# FIXME: Replace STM32 stuff with proper Stellaris support.
-%.flash: %.hex
- @printf " FLASH $<\n"
- @# IMPORTANT: Don't use "resume", only "reset" will work correctly!
- $(Q)$(OOCD) -f board/$(OOCD_BOARD).cfg \
- -c "init" -c "reset init" \
- -c "flash write_image erase $(*).hex 0" \
- -c "reset" \
- -c "shutdown" $(NULL)
-
-.PHONY: images clean
-
--include $(OBJS:.o=.d)
+include ../../../Makefile.rules
diff --git a/examples/lpc13xx/Makefile.include b/examples/lpc13xx/Makefile.include
index ce0fed3..1ca0ee4 100644
--- a/examples/lpc13xx/Makefile.include
+++ b/examples/lpc13xx/Makefile.include
@@ -18,120 +18,27 @@
## along with this library. If not, see .
##
-PREFIX ?= arm-none-eabi
-#PREFIX ?= arm-elf
-CC = $(PREFIX)-gcc
-LD = $(PREFIX)-gcc
-OBJCOPY = $(PREFIX)-objcopy
-OBJDUMP = $(PREFIX)-objdump
+LIBNAME = opencm3_lpc13xx
+DEFS = -DLPC13XX
-TOOLCHAIN_DIR ?= ../../../../libopencm3
-ifeq ($(wildcard ../../../../libopencm3/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
-endif
+ARCH_FLAGS = -mthumb -mcpu=cortex-m3 -msoft-float -mfix-cortex-m3-ldrd
-CFLAGS += -Os -g \
- -Wall -Wextra -Wimplicit-function-declaration \
- -Wredundant-decls -Wmissing-prototypes -Wstrict-prototypes \
- -Wundef -Wshadow \
- -I$(TOOLCHAIN_DIR)/include -fno-common \
- -mcpu=cortex-m3 -mthumb -MD -DLPC13XX
-LDSCRIPT ?= $(BINARY).ld
-LDFLAGS += -L$(TOOLCHAIN_DIR)/lib \
- -T$(LDSCRIPT) -nostartfiles -Wl,--gc-sections
-OBJS += $(BINARY).o
+################################################################################
+# OpenOCD specific variables
OOCD ?= openocd
OOCD_INTERFACE ?= flossjtag
OOCD_BOARD ?= olimex_stm32_h103
-# FIXME
-# Be silent per default, but 'make V=1' will show all compiler calls.
-ifneq ($(V),1)
-Q := @
-NULL := 2>/dev/null
-else
-LDFLAGS += -Wl,--print-gc-sections
-endif
+################################################################################
+# Black Magic Probe specific variables
+# Set the BMP_PORT to a serial port and then BMP is used for flashing
+BMP_PORT ?=
-.SUFFIXES: .elf .bin .hex .srec .list .images
-.SECONDEXPANSION:
-.SECONDARY:
+################################################################################
+# texane/stlink specific variables
+#STLINK_PORT ?= :4242
-all: images
-images: $(BINARY).images
-flash: $(BINARY).flash
-
-%.images: %.bin %.hex %.srec %.list
- @#printf "*** $* images generated ***\n"
-
-%.bin: %.elf
- @#printf " OBJCOPY $(*).bin\n"
- $(Q)$(OBJCOPY) -Obinary $(*).elf $(*).bin
-
-%.hex: %.elf
- @#printf " OBJCOPY $(*).hex\n"
- $(Q)$(OBJCOPY) -Oihex $(*).elf $(*).hex
-
-%.srec: %.elf
- @#printf " OBJCOPY $(*).srec\n"
- $(Q)$(OBJCOPY) -Osrec $(*).elf $(*).srec
-
-%.list: %.elf
- @#printf " OBJDUMP $(*).list\n"
- $(Q)$(OBJDUMP) -S $(*).elf > $(*).list
-
-%.elf: $(OBJS) $(LDSCRIPT) $(TOOLCHAIN_DIR)/lib/libopencm3_lpc13xx.a
- @#printf " LD $(subst $(shell pwd)/,,$(@))\n"
- $(Q)$(LD) $(LDFLAGS) -o $(*).elf $(OBJS) -lopencm3_lpc13xx
-
-%.o: %.c Makefile
- @#printf " CC $(subst $(shell pwd)/,,$(@))\n"
- $(Q)$(CC) $(CFLAGS) -o $@ -c $<
-
-clean:
- $(Q)rm -f *.o
- $(Q)rm -f *.d
- $(Q)rm -f *.elf
- $(Q)rm -f *.bin
- $(Q)rm -f *.hex
- $(Q)rm -f *.srec
- $(Q)rm -f *.list
-
-# FIXME: Replace STM32 stuff with proper LPC13XX OpenOCD support later.
-ifeq ($(OOCD_SERIAL),)
-%.flash: %.hex
- @printf " FLASH $<\n"
- @# IMPORTANT: Don't use "resume", only "reset" will work correctly!
- $(Q)$(OOCD) -f interface/$(OOCD_INTERFACE).cfg \
- -f board/$(OOCD_BOARD).cfg \
- -c "init" -c "reset init" \
- -c "stm32x mass_erase 0" \
- -c "flash write_image $(*).hex" \
- -c "reset" \
- -c "shutdown" $(NULL)
-else
-%.flash: %.hex
- @printf " FLASH $<\n"
- @# IMPORTANT: Don't use "resume", only "reset" will work correctly!
- $(Q)$(OOCD) -f interface/$(OOCD_INTERFACE).cfg \
- -f board/$(OOCD_BOARD).cfg \
- -c "ft2232_serial $(OOCD_SERIAL)" \
- -c "init" -c "reset init" \
- -c "stm32x mass_erase 0" \
- -c "flash write_image $(*).hex" \
- -c "reset" \
- -c "shutdown" $(NULL)
-endif
-
-.PHONY: images clean
-
--include $(OBJS:.o=.d)
+include ../../../Makefile.rules
diff --git a/examples/lpc17xx/Makefile.include b/examples/lpc17xx/Makefile.include
index ccf1c35..d727d22 100644
--- a/examples/lpc17xx/Makefile.include
+++ b/examples/lpc17xx/Makefile.include
@@ -18,120 +18,28 @@
## along with this library. If not, see .
##
-PREFIX ?= arm-none-eabi
-#PREFIX ?= arm-elf
-CC = $(PREFIX)-gcc
-LD = $(PREFIX)-gcc
-OBJCOPY = $(PREFIX)-objcopy
-OBJDUMP = $(PREFIX)-objdump
-TOOLCHAIN_DIR ?= ../../../../libopencm3
-ifeq ($(wildcard ../../../../libopencm3/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
-endif
+LIBNAME = opencm3_lpc17xx
+DEFS = -DLPC17XX
-CFLAGS += -O0 -g \
- -Wall -Wextra -Wimplicit-function-declaration \
- -Wredundant-decls -Wmissing-prototypes -Wstrict-prototypes \
- -Wundef -Wshadow \
- -I$(TOOLCHAIN_DIR)/include -fno-common \
- -mcpu=cortex-m3 -mthumb -MD -DLPC17XX
-LDSCRIPT ?= $(BINARY).ld
-LDFLAGS += -L$(TOOLCHAIN_DIR)/lib \
- -T$(LDSCRIPT) -nostartfiles -Wl,--gc-sections
-OBJS += $(BINARY).o
+ARCH_FLAGS = -mthumb -mcpu=cortex-m3 -msoft-float -mfix-cortex-m3-ldrd
+
+################################################################################
+# OpenOCD specific variables
OOCD ?= openocd
OOCD_INTERFACE ?= flossjtag
OOCD_BOARD ?= olimex_stm32_h103
-# FIXME
-# Be silent per default, but 'make V=1' will show all compiler calls.
-ifneq ($(V),1)
-Q := @
-NULL := 2>/dev/null
-else
-LDFLAGS += -Wl,--print-gc-sections
-endif
+################################################################################
+# Black Magic Probe specific variables
+# Set the BMP_PORT to a serial port and then BMP is used for flashing
+BMP_PORT ?=
-.SUFFIXES: .elf .bin .hex .srec .list .images
-.SECONDEXPANSION:
-.SECONDARY:
+################################################################################
+# texane/stlink specific variables
+#STLINK_PORT ?= :4242
-all: images
-images: $(BINARY).images
-flash: $(BINARY).flash
-
-%.images: %.bin %.hex %.srec %.list
- @#printf "*** $* images generated ***\n"
-
-%.bin: %.elf
- @#printf " OBJCOPY $(*).bin\n"
- $(Q)$(OBJCOPY) -Obinary $(*).elf $(*).bin
-
-%.hex: %.elf
- @#printf " OBJCOPY $(*).hex\n"
- $(Q)$(OBJCOPY) -Oihex $(*).elf $(*).hex
-
-%.srec: %.elf
- @#printf " OBJCOPY $(*).srec\n"
- $(Q)$(OBJCOPY) -Osrec $(*).elf $(*).srec
-
-%.list: %.elf
- @#printf " OBJDUMP $(*).list\n"
- $(Q)$(OBJDUMP) -S $(*).elf > $(*).list
-
-%.elf: $(OBJS) $(LDSCRIPT) $(TOOLCHAIN_DIR)/lib/libopencm3_lpc17xx.a
- @#printf " LD $(subst $(shell pwd)/,,$(@))\n"
- $(Q)$(LD) $(LDFLAGS) -o $(*).elf $(OBJS) -lopencm3_lpc17xx
-
-%.o: %.c Makefile
- @#printf " CC $(subst $(shell pwd)/,,$(@))\n"
- $(Q)$(CC) $(CFLAGS) -o $@ -c $<
-
-clean:
- $(Q)rm -f *.o
- $(Q)rm -f *.d
- $(Q)rm -f *.elf
- $(Q)rm -f *.bin
- $(Q)rm -f *.hex
- $(Q)rm -f *.srec
- $(Q)rm -f *.list
-
-# FIXME: Replace STM32 stuff with proper LPC13XX OpenOCD support later.
-ifeq ($(OOCD_SERIAL),)
-%.flash: %.hex
- @printf " FLASH $<\n"
- @# IMPORTANT: Don't use "resume", only "reset" will work correctly!
- $(Q)$(OOCD) -f interface/$(OOCD_INTERFACE).cfg \
- -f board/$(OOCD_BOARD).cfg \
- -c "init" -c "reset init" \
- -c "stm32x mass_erase 0" \
- -c "flash write_image $(*).hex" \
- -c "reset" \
- -c "shutdown" $(NULL)
-else
-%.flash: %.hex
- @printf " FLASH $<\n"
- @# IMPORTANT: Don't use "resume", only "reset" will work correctly!
- $(Q)$(OOCD) -f interface/$(OOCD_INTERFACE).cfg \
- -f board/$(OOCD_BOARD).cfg \
- -c "ft2232_serial $(OOCD_SERIAL)" \
- -c "init" -c "reset init" \
- -c "stm32x mass_erase 0" \
- -c "flash write_image $(*).hex" \
- -c "reset" \
- -c "shutdown" $(NULL)
-endif
-
-.PHONY: images clean
-
--include $(OBJS:.o=.d)
+include ../../../Makefile.rules
diff --git a/examples/lpc43xx/Makefile.include b/examples/lpc43xx/Makefile.include
index 05b8c70..37a4e10 100644
--- a/examples/lpc43xx/Makefile.include
+++ b/examples/lpc43xx/Makefile.include
@@ -20,121 +20,27 @@
## along with this library. If not, see .
##
-PREFIX ?= arm-none-eabi
-#PREFIX ?= arm-elf
-CC = $(PREFIX)-gcc
-LD = $(PREFIX)-gcc
-OBJCOPY = $(PREFIX)-objcopy
-OBJDUMP = $(PREFIX)-objdump
-GDB = $(PREFIX)-gdb
-TOOLCHAIN_DIR ?= ../../../../libopencm3
-ifeq ($(wildcard ../../../../libopencm3/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
-endif
+LIBNAME = opencm3_lpc43xx
+DEFS = -DLPC43XX
-CFLAGS += -O2 -g \
- -Wall -Wextra -Wimplicit-function-declaration \
- -Wredundant-decls -Wmissing-prototypes -Wstrict-prototypes \
- -Wundef -Wshadow \
- -I$(TOOLCHAIN_DIR)/include -fno-common \
- -mcpu=cortex-m4 -mthumb -MD \
- -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
-OBJS += $(BINARY).o
+ARCH_FLAGS = -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16
+
+################################################################################
+# OpenOCD specific variables
OOCD ?= openocd
OOCD_INTERFACE ?= flossjtag
OOCD_BOARD ?= olimex_stm32_h103
-# Be silent per default, but 'make V=1' will show all compiler calls.
-ifneq ($(V),1)
-Q := @
-NULL := 2>/dev/null
-else
-LDFLAGS += -Wl,--print-gc-sections
-endif
+################################################################################
+# Black Magic Probe specific variables
+# Set the BMP_PORT to a serial port and then BMP is used for flashing
+BMP_PORT ?=
-.SUFFIXES: .elf .bin .hex .srec .list .images
-.SECONDEXPANSION:
-.SECONDARY:
+################################################################################
+# texane/stlink specific variables
+#STLINK_PORT ?= :4242
-all: images
-images: $(BINARY).images
-flash: $(BINARY).flash
-
-%.images: %.bin %.hex %.srec %.list
- @#printf "*** $* images generated ***\n"
-
-%.bin: %.elf
- @#printf " OBJCOPY $(*).bin\n"
- $(Q)$(OBJCOPY) -Obinary $(*).elf $(*).bin
-
-%.hex: %.elf
- @#printf " OBJCOPY $(*).hex\n"
- $(Q)$(OBJCOPY) -Oihex $(*).elf $(*).hex
-
-%.srec: %.elf
- @#printf " OBJCOPY $(*).srec\n"
- $(Q)$(OBJCOPY) -Osrec $(*).elf $(*).srec
-
-%.list: %.elf
- @#printf " OBJDUMP $(*).list\n"
- $(Q)$(OBJDUMP) -S $(*).elf > $(*).list
-
-%.elf: $(OBJS) $(LDSCRIPT) $(TOOLCHAIN_DIR)/lib/libopencm3_lpc43xx.a
- @#printf " LD $(subst $(shell pwd)/,,$(@))\n"
- $(Q)$(LD) $(LDFLAGS) -o $(*).elf $(OBJS) -lopencm3_lpc43xx
-
-%.o: %.c Makefile
- @#printf " CC $(subst $(shell pwd)/,,$(@))\n"
- $(Q)$(CC) $(CFLAGS) -o $@ -c $<
-
-clean:
- $(Q)rm -f *.o
- $(Q)rm -f *.d
- $(Q)rm -f *.elf
- $(Q)rm -f *.bin
- $(Q)rm -f *.hex
- $(Q)rm -f *.srec
- $(Q)rm -f *.list
- $(Q)rm -f *.map
-
-# FIXME: Replace STM32 stuff with proper LPC43XX OpenOCD support later.
-ifeq ($(OOCD_SERIAL),)
-%.flash: %.hex
- @printf " FLASH $<\n"
- @# IMPORTANT: Don't use "resume", only "reset" will work correctly!
- $(Q)$(OOCD) -f interface/$(OOCD_INTERFACE).cfg \
- -f board/$(OOCD_BOARD).cfg \
- -c "init" -c "reset init" \
- -c "stm32x mass_erase 0" \
- -c "flash write_image $(*).hex" \
- -c "reset" \
- -c "shutdown" $(NULL)
-else
-%.flash: %.hex
- @printf " FLASH $<\n"
- @# IMPORTANT: Don't use "resume", only "reset" will work correctly!
- $(Q)$(OOCD) -f interface/$(OOCD_INTERFACE).cfg \
- -f board/$(OOCD_BOARD).cfg \
- -c "ft2232_serial $(OOCD_SERIAL)" \
- -c "init" -c "reset init" \
- -c "stm32x mass_erase 0" \
- -c "flash write_image $(*).hex" \
- -c "reset" \
- -c "shutdown" $(NULL)
-endif
-
-.PHONY: images clean
-
--include $(OBJS:.o=.d)
+include ../../../Makefile.rules