Libopencm3 blink template, simplified for only bluepill/stm32f1 target as a base template for stm32f1 projects
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

28 lines
856 B

# Instructions:
# 1) add a rule for your board to the bottom of this file
# 2) profit!
LFLAGS_STM32=$(LFLAGS) template_stm32.c -T ld.stm32.basic
# STM32F1 starts up with HSI at 8Mhz
STM32F1_CFLAGS=$(M3_FLAGS) -DSTM32F1 -DLITTLE_BIT=800000 $(LFLAGS_STM32) -lopencm3_stm32f1
define RAWMakeBoard
$(CC) -DRCC_LED1=$(1) -DPORT_LED1=$(2) -DPIN_LED1=$(3) $(4) -o $(OD)/stm32/$(5)
endef
define MakeBoard
BOARDS_ELF+=$(OD)/stm32/$(1).elf
BOARDS_BIN+=$(OD)/stm32/$(1).bin
BOARDS_HEX+=$(OD)/stm32/$(1).hex
$(OD)/stm32/$(1).elf: template_stm32.c libopencm3/lib/libopencm3_$(5).a
@echo " $(5) -> Creating $(OD)/stm32/$(1).elf"
$(call RAWMakeBoard,RCC_$(2),$(2),$(3),$(4),$(1).elf)
endef
define stm32f1board
$(call MakeBoard,$(1),$(2),$(3),$(STM32F1_CFLAGS),stm32f1)
endef
# make only for bluepill board :)
$(eval $(call stm32f1board,bluepill,GPIOC,GPIO13))