aboutsummaryrefslogtreecommitdiff
path: root/src/led-test/Makefile
diff options
context:
space:
mode:
authorFredrik Thulin <fredrik@thulin.net>2015-01-15 17:04:03 +0100
committerFredrik Thulin <fredrik@thulin.net>2015-01-15 17:04:03 +0100
commit39cac7918987fc603dc54886e107af026583592e (patch)
treeacb95e5cebc2f410840659cc7e6d1a74331e3985 /src/led-test/Makefile
parent3347165e2927ec73014eafdfc0c650904a4b67d4 (diff)
init
Diffstat (limited to 'src/led-test/Makefile')
-rw-r--r--src/led-test/Makefile49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/led-test/Makefile b/src/led-test/Makefile
new file mode 100644
index 0000000..97865ee
--- /dev/null
+++ b/src/led-test/Makefile
@@ -0,0 +1,49 @@
+# put your *.o targets here, make should handle the rest!
+SRCS = main.c stm_init.c system_stm32f4xx.c stm32f4xx_it.c
+
+# all the files will be generated with this name
+PROJ_NAME=led-test
+
+TOPLEVEL=../..
+include $(TOPLEVEL)/common.mk
+
+OBJS = $(SRCS:.c=.o)
+
+###################################################
+
+.PHONY: lib proj
+
+all: lib proj
+
+lib:
+ $(MAKE) -C $(STD_PERIPH_LIB) STDPERIPH_SETTINGS="$(STDPERIPH_SETTINGS)"
+
+proj: $(PROJ_NAME).elf
+
+$(PROJ_NAME).elf: $(SRCS)
+ $(CC) $(CFLAGS) $^ -o $@ -L$(STD_PERIPH_LIB) -lstmf4 -L$(LDSCRIPT_INC) -T$(MCU_LINKSCRIPT) -g
+ $(OBJCOPY) -O ihex $(PROJ_NAME).elf $(PROJ_NAME).hex
+ $(OBJCOPY) -O binary $(PROJ_NAME).elf $(PROJ_NAME).bin
+ $(OBJDUMP) -St $(PROJ_NAME).elf >$(PROJ_NAME).lst
+ $(SIZE) $(PROJ_NAME).elf
+
+clean:
+ find ./ -name '*~' | xargs rm -f
+ rm -f *.o
+ rm -f $(PROJ_NAME).elf
+ rm -f $(PROJ_NAME).hex
+ rm -f $(PROJ_NAME).bin
+ rm -f $(PROJ_NAME).map
+ rm -f $(PROJ_NAME).lst
+
+really-clean: clean
+ $(MAKE) -C $(STD_PERIPH_LIB) clean
+
+debug:
+ $(GDB) -ex "target remote localhost:3333" \
+ -ex "set remote hardware-breakpoint-limit 6" \
+ -ex "set remote hardware-watchpoint-limit 4" $(PROJ_NAME).elf
+
+flash-target:
+ $(OPENOCD) -f $(OPENOCD_BOARD_DIR)/$(OPENOCD_PROC_FILE) \
+ -c "program $(PROJ_NAME).elf verify reset"