summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile23
1 files changed, 17 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index 4ef61dd..0b7e9c0 100644
--- a/Makefile
+++ b/Makefile
@@ -1,12 +1,23 @@
-.PHONY: all clean
+OBJS = main.o startup.o
+
+# tools
+PREFIX ?= arm-none-eabi
+CC = $(PREFIX)-gcc
+LD = $(PREFIX)-gcc
+OBJCOPY = $(PREFIX)-objcopy
-all:
+all: deps/libopencm3/lib/libopencm3_stm32f1.a
mkdir build
- arm-none-eabi-gcc -O0 -c -g -mcpu=cortex-m3 -mthumb -o build/test_program.o src/test_program.c
- arm-none-eabi-gcc -O0 -c -g -mcpu=cortex-m3 -mthumb -o build/startup.o src/startup.c
- arm-none-eabi-ld -Tld/stm32.ld -o build/test_program.elf build/startup.o build/test_program.o
- arm-none-eabi-objcopy -O binary build/test_program.elf build/test_program.bin
+ $(CC) -O0 -c -g -DSTM32F1 -Ideps/libopencm3/include -mcpu=cortex-m3 -mthumb -o build/main.o src/main.c
+ $(CC) -O0 -c -g -DSTM32F1 -Ideps/libopencm3/include -mcpu=cortex-m3 -mthumb -o build/startup.o src/startup.c
+ $(LD) --static -nostartfiles -mcpu=cortex-m3 -mthumb -msoft-float -Tld/stm32f103c8t6.ld -Ldeps/libopencm3/lib build/startup.o build/main.o -lopencm3_stm32f1 -o build/ledcontrol.elf
+ $(OBJCOPY) -O binary build/ledcontrol.elf build/ledcontrol.bin
+
+deps/libopencm3/lib/libopencm3_stm32f1.a:
+ make -C deps/libopencm3
clean:
rm -rf build
+
+.PHONY: all clean