# Toolchain CC = arm-none-eabi-gcc OBJCOPY = arm-none-eabi-objcopy STFLASH = st-flash # Compiler flags CFLAGS = -std=c99 -Wall -Wextra -Werror -g -mthumb -mcpu=cortex-m3 # Object files OBJS = blink.o # Output files ELF = blink.elf BIN = blink.bin # Targets .PHONY: all clean flash all: $(BIN) $(BIN): $(ELF) $(OBJCOPY) -O binary $< $@ $(ELF): $(OBJS) $(CC) $(CFLAGS) $^ -o $@ %.o: %.c $(CC) $(CFLAGS) -c $< -o $@ clean: rm -f $(OBJS) $(ELF) $(BIN) flash: $(BIN) $(STFLASH) --reset write $< 0x8000000