aboutsummaryrefslogtreecommitdiff
path: root/examples/lpc13xx
diff options
context:
space:
mode:
authorUwe Hermann2010-12-30 02:57:44 +0100
committerUwe Hermann2010-12-30 02:57:44 +0100
commit8e5acecc6e170760d0edf95edb8f413385b2bf62 (patch)
tree458c31126734f5bc31a428de3004b49dca965849 /examples/lpc13xx
parent7c53b252a35f5ac9a02216465bab26b059fffccc (diff)
More path and name changes.
Diffstat (limited to 'examples/lpc13xx')
-rw-r--r--examples/lpc13xx/Makefile38
-rw-r--r--examples/lpc13xx/Makefile.include118
-rw-r--r--examples/lpc13xx/lpc-p1343/Makefile38
-rw-r--r--examples/lpc13xx/lpc-p1343/miniblink/Makefile2
-rw-r--r--examples/lpc13xx/lpc-p1343/miniblink/miniblink.ld6
5 files changed, 197 insertions, 5 deletions
diff --git a/examples/lpc13xx/Makefile b/examples/lpc13xx/Makefile
new file mode 100644
index 0000000..0e9bdad
--- /dev/null
+++ b/examples/lpc13xx/Makefile
@@ -0,0 +1,38 @@
+##
+## This file is part of the libopenstm32 project.
+##
+## Copyright (C) 2010 Piotr Esden-Tempski <piotr@esden.net>
+##
+## This program is free software: you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program. If not, see <http://www.gnu.org/licenses/>.
+##
+
+# Be silent per default, but 'make V=1' will show all compiler calls.
+ifneq ($(V),1)
+Q := @
+# Do not print "Entering directory ...".
+MAKEFLAGS += --no-print-directory
+endif
+
+all: lpc-p1343
+
+lpc-p1343:
+ @printf " BUILD examples/lpc13xx/lpc-p1343\n"
+ $(Q)$(MAKE) -C lpc-p1343
+
+clean:
+ @printf " CLEAN examples/lpc13xx/lpc-p1343\n"
+ $(Q)$(MAKE) -C lpc-p1343 clean
+
+.PHONY: lpc-p1343 clean
+
diff --git a/examples/lpc13xx/Makefile.include b/examples/lpc13xx/Makefile.include
new file mode 100644
index 0000000..63a2633
--- /dev/null
+++ b/examples/lpc13xx/Makefile.include
@@ -0,0 +1,118 @@
+## This file is part of the libopenstm32 project.
+##
+## Copyright (C) 2009 Uwe Hermann <uwe@hermann-uwe.de>
+## Copyright (C) 2010 Piotr Esden-Tempski <piotr@esden.net>
+##
+## This program is free software: you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program. If not, see <http://www.gnu.org/licenses/>.
+##
+
+# PREFIX ?= arm-none-eabi
+PREFIX ?= arm-elf
+CC = $(PREFIX)-gcc
+LD = $(PREFIX)-gcc
+OBJCOPY = $(PREFIX)-objcopy
+OBJDUMP = $(PREFIX)-objdump
+# Uncomment this line if you want to use the installed (not local) library.
+# TOOLCHAIN_DIR = `dirname \`which $(CC)\``/../$(PREFIX)
+TOOLCHAIN_DIR = ../../../..
+CFLAGS += -Os -g -Wall -Wextra -I$(TOOLCHAIN_DIR)/include -fno-common \
+ -mcpu=cortex-m3 -mthumb
+LDSCRIPT = $(BINARY).ld
+LDFLAGS += -L$(TOOLCHAIN_DIR)/lib/lpc13xx -T$(LDSCRIPT) -nostartfiles \
+ -Wl,--gc-sections
+OBJS += $(BINARY).o
+
+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
+
+.SUFFIXES: .elf .bin .hex .srec .list .images
+.SECONDEXPANSION:
+.SECONDARY:
+
+all: images
+
+images: $(BINARY).images
+flash: $(BINARY).flash
+
+%.images: %.bin %.hex %.srec %.list
+ @#echo "*** $* images generated ***"
+
+%.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)
+ @#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 *.elf
+ $(Q)rm -f *.bin
+ $(Q)rm -f *.hex
+ $(Q)rm -f *.srec
+ $(Q)rm -f *.list
+
+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
+
diff --git a/examples/lpc13xx/lpc-p1343/Makefile b/examples/lpc13xx/lpc-p1343/Makefile
new file mode 100644
index 0000000..36c1994
--- /dev/null
+++ b/examples/lpc13xx/lpc-p1343/Makefile
@@ -0,0 +1,38 @@
+##
+## This file is part of the libopenstm32 project.
+##
+## Copyright (C) 2009 Uwe Hermann <uwe@hermann-uwe.de>
+##
+## This program is free software: you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program. If not, see <http://www.gnu.org/licenses/>.
+##
+
+# Be silent per default, but 'make V=1' will show all compiler calls.
+ifneq ($(V),1)
+Q := @
+# Do not print "Entering directory ...".
+MAKEFLAGS += --no-print-directory
+endif
+
+all: miniblink
+
+miniblink:
+ @printf " BUILD examples/lpc13xx/lpc-p1343/miniblink\n"
+ $(Q)$(MAKE) -C miniblink
+
+clean:
+ @printf " CLEAN examples/lpc13xx/lpc-p1343/miniblink\n"
+ $(Q)$(MAKE) -C miniblink clean
+
+.PHONY: miniblink clean
+
diff --git a/examples/lpc13xx/lpc-p1343/miniblink/Makefile b/examples/lpc13xx/lpc-p1343/miniblink/Makefile
index 9f24080..6f4ffcc 100644
--- a/examples/lpc13xx/lpc-p1343/miniblink/Makefile
+++ b/examples/lpc13xx/lpc-p1343/miniblink/Makefile
@@ -19,5 +19,5 @@
BINARY = miniblink
-include ../../../Makefile.include
+include ../../Makefile.include
diff --git a/examples/lpc13xx/lpc-p1343/miniblink/miniblink.ld b/examples/lpc13xx/lpc-p1343/miniblink/miniblink.ld
index f313b21..1a362e6 100644
--- a/examples/lpc13xx/lpc-p1343/miniblink/miniblink.ld
+++ b/examples/lpc13xx/lpc-p1343/miniblink/miniblink.ld
@@ -26,8 +26,6 @@ MEMORY
ram (rwx) : ORIGIN = 0x10000000, LENGTH = 8K
}
-/* Include the common ld script from libopenstm32. */
-INCLUDE libopenstm32.ld
-
-/* FIXME: _stack is incorrect in that file, refactor! */
+/* Include the common ld script. */
+INCLUDE lpc13xx.ld