summaryrefslogtreecommitdiff
path: root/Makefile
blob: 0b7e9c0268c70cd052bbd1db6bd55aa65afee6ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23

OBJS = main.o startup.o

# tools
PREFIX     ?= arm-none-eabi
CC          = $(PREFIX)-gcc
LD          = $(PREFIX)-gcc
OBJCOPY     = $(PREFIX)-objcopy

all: deps/libopencm3/lib/libopencm3_stm32f1.a
	mkdir build
	$(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