From 5356bc886d53291a9a812f2aba35e4e165d96fba Mon Sep 17 00:00:00 2001 From: Matthew Wozniak Date: Thu, 11 Dec 2025 23:58:51 -0500 Subject: initial commit --- Makefile | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 Makefile (limited to 'Makefile') diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..6b5ce62 --- /dev/null +++ b/Makefile @@ -0,0 +1,31 @@ +CC = arm-none-eabi-gcc +CFLAGS = -mcpu=cortex-m3 -mthumb -ffreestanding -Os -nostartfiles -std=c23 \ + -DSTM32F103xB \ + -Wpedantic \ + -I3p/cmsis-device-f1/Include \ + -I3p/CMSIS_6/CMSIS/Core/Include + +LINKER_FILE=linker_script.ld +LDFLAGS=-specs=nano.specs -specs=nosys.specs -T $(LINKER_FILE) + +all: blink.elf + +.PHONY: clean flash debug + +clean: + rm -v *.o blink.elf + +blink.elf: main.o startup.o system_stm32f1xx.o + $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $^ -o blink.elf + +system_stm32f1xx.o: 3p/cmsis-device-f1/Source/Templates/system_stm32f1xx.c + $(CC) $(CFLAGS) 3p/cmsis-device-f1/Source/Templates/system_stm32f1xx.c -c + +%.o: %.c + $(CC) $(CFLAGS) $< -c -o $@ + +flash: blink.elf + openocd -f interface/stlink.cfg -f target/stm32f1x.cfg -c "program blink.elf verify reset exit" + +debug: blink.elf + openocd -f interface/stlink.cfg -f target/stm32f1x.cfg -- cgit v1.2.3-54-g00ecf