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

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

all: libopencm3/lib/libopencm3_stm32f1.a
	mkdir -p build
	$(CC) -O0 -c -g -Wall -DSTM32F1 -Ilibopencm3/include -mcpu=cortex-m3 -mthumb -o build/main.o main.c
	$(LD) --static -nostartfiles -mcpu=cortex-m3 -mthumb -msoft-float -Tstm32f103c8t6.ld -Llibopencm3/lib build/main.o -lopencm3_stm32f1 -o build/ledcontrol.elf
	$(OBJCOPY) -O binary build/ledcontrol.elf build/ledcontrol.bin

libopencm3/lib/libopencm3_stm32f1.a:
	make -C libopencm3 TARGETS='stm32/f1'

clean:
	rm -rf build
	make -C libopencm3 clean

.PHONY: all clean