blinking
[rapper.git] / bitbucket_lpc1768 / Makefile
diff --git a/bitbucket_lpc1768/Makefile b/bitbucket_lpc1768/Makefile
new file mode 100644 (file)
index 0000000..348e0be
--- /dev/null
@@ -0,0 +1,76 @@
+# Copyright (c) 2008-2010 Jakub Piotr Cłapa
+# This program is released under the new BSD license.
+ARCH = /home/asbjorn/dev/armchain/arm-none-eabi/bin/arm-none-eabi
+MBED_VOLUME = /Volumes/MBED
+
+# Tool definitions
+CC      = $(ARCH)-gcc
+LD      = $(ARCH)-ld
+AR      = $(ARCH)-ar
+AS      = $(ARCH)-as
+CP      = $(ARCH)-objcopy
+OD     = $(ARCH)-objdump
+SIZE   = $(ARCH)-size
+RM     = rm
+Q      = @./quiet "$@"
+
+# Flags
+CFLAGS   = -W -Wall -Os --std=gnu99 -fgnu89-inline -mcpu=cortex-m3 -mthumb
+CFLAGS  += -ffunction-sections -fdata-sections
+ASFLAGS  =
+LDFLAGS  = --gc-sections
+CPFLAGS  =
+ODFLAGS  = -x --syms
+PRFLAGS ?=
+
+# Source files
+LINKER_SCRIPT = LPC1768-flash.ld
+CSRCS  = startup.c $(wildcard CMSIS/*.c)
+CSRCS += main.c
+ASRCS  = 
+
+
+OBJS   = $(CSRCS:.c=.o) $(ASRCS:.s=.o)
+
+.PHONY: all size clean nuke
+
+all: main.bin main.hex 
+
+isp: main.bin
+       @./quiet $< cp $^ $(MBED_VOLUME)/
+
+size: main.elf
+       @$(SIZE) $<
+
+%.hex: %.elf
+       $Q $(CP) $(CPFLAGS) -O ihex $< $*.hex
+
+%.bin: %.elf
+       $Q $(CP) $(CPFLAGS) -O binary $< $*.bin
+
+main.elf: $(LINKER_SCRIPT) $(OBJS)
+       $Q $(LD) -Map $(@:.elf=.map) $(LDFLAGS) -T $^ -o $@ 
+       $Q $(OD) $(ODFLAGS) $@ > $(@:.elf=.dump)
+       @$(SIZE) $@
+
+%.o: %.c
+       @$(CC) -MM $< -MF $*.d -MP
+       $Q $(CC) -c $(CFLAGS) $< -o $@
+
+%.o: %.S
+       $Q $(AS) $(ASFLAGS) $< -o $@
+
+io-pin.h: io-pin.ss
+       $Q mzscheme $< > $@
+
+clean:
+       @-rm -f *.elf quiet.log
+       @-\
+for D in "." "**"; do \
+  rm -f $$D/*.o $$D/*.d $$D/*.lst $$D/*.dump $$D/*.map; \
+done
+
+nuke: clean
+       -rm -f *.hex *.bin
+
+-include $(CSRCS:.c=.d)