You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
stm32-better-blink/Makefile

19 lines
705 B
Makefile

OPENCM3_DIR := libopencm3
9 years ago
# NB: Not exhaustive, some still hardcoded.
CPU_FLAGS := -mthumb -mcpu=cortex-m3 -msoft-float -mfix-cortex-m3-ldrd
9 years ago
%.o: %.c
arm-none-eabi-gcc -Os -g -Wextra -fno-common -ffunction-sections -fdata-sections -Wall -Wundef -I $(OPENCM3_DIR)/include -D STM32F1 ${CPU_FLAGS} -c $*.c -o $*.o
9 years ago
%.elf: %.o
arm-none-eabi-gcc --static -nostartfiles -L $(OPENCM3_DIR)/lib -T $(OPENCM3_DIR)/lib/stm32/f1/stm32f100xb.ld -Wl,-Map=$*.map -Wl,--gc-sections ${CPU_FLAGS} $*.o -l opencm3_stm32f1 -Wl,--start-group -lc -lgcc -lnosys -Wl,--end-group -o $*.elf
9 years ago
9 years ago
%.bin: %.elf
arm-none-eabi-objcopy -Obinary $*.elf $*.bin
9 years ago
flash: main.bin
st-flash --reset write main.bin 0x08000000
.PHONY: flash