2016-02-08 21:18:05 +01:00
|
|
|
# export the CPU family so we can differentiate between them in the code
|
|
|
|
FAM = $(shell echo $(CPU_FAM) | tr 'a-z-' 'A-Z_')
|
|
|
|
export CFLAGS += -DCPU_FAM_$(FAM)
|
|
|
|
|
2016-02-12 00:49:30 +01:00
|
|
|
# include common periph module
|
2016-02-08 21:18:05 +01:00
|
|
|
USEMODULE += periph_common
|
|
|
|
|
2016-03-16 12:11:11 +01:00
|
|
|
# include stm32 common functions and stm32 common periph drivers
|
|
|
|
USEMODULE += stm32_common stm32_common_periph
|
2016-02-12 00:49:30 +01:00
|
|
|
|
2018-04-01 17:40:14 +02:00
|
|
|
# flashpage and eeprom periph implementations share flash lock/unlock functions
|
|
|
|
# in periph_flash_common
|
|
|
|
ifneq (,$(filter periph_flashpage periph_eeprom,$(FEATURES_REQUIRED)))
|
|
|
|
FEATURES_REQUIRED += periph_flash_common
|
|
|
|
endif
|
|
|
|
|
2017-10-17 15:07:18 +02:00
|
|
|
# For stm32 cpu's we use the stm32_common.ld linker script
|
|
|
|
export LINKFLAGS += -L$(RIOTCPU)/stm32_common/ldscripts
|
|
|
|
LINKER_SCRIPT ?= stm32_common.ld
|
|
|
|
|
2016-02-08 21:18:05 +01:00
|
|
|
# export the common include directory
|
|
|
|
export INCLUDES += -I$(RIOTCPU)/stm32_common/include
|
2017-10-17 15:07:18 +02:00
|
|
|
|
2018-06-18 19:18:37 +02:00
|
|
|
# Compute ROM_LEN and RAM_LEN
|
2017-10-17 15:07:18 +02:00
|
|
|
include $(RIOTCPU)/stm32_common/stm32_mem_lengths.mk
|
2018-06-18 19:18:37 +02:00
|
|
|
KB := 1024
|
|
|
|
LEN := $(shell echo $(ROM_LEN) | sed 's/K//')
|
|
|
|
FLASHSIZE := $(shell echo $$(( $(LEN) * $(KB) )) )
|
2017-11-22 15:53:30 +01:00
|
|
|
|
2018-05-07 18:04:32 +02:00
|
|
|
# Get CPU_LINE_ variable
|
|
|
|
-include $(RIOTCPU)/$(CPU)/stm32_line.mk
|
|
|
|
CPU_LINE ?= $(shell echo $(CPU_MODEL) | cut -c -9 | tr 'a-z-' 'A-Z_')xx
|
|
|
|
|
|
|
|
# Set CFLAGS
|
|
|
|
export CFLAGS += -D$(CPU_LINE) -DCPU_LINE_$(CPU_LINE)
|
2018-06-18 19:18:37 +02:00
|
|
|
export CFLAGS += -DSTM32_FLASHSIZE=$(FLASHSIZE)U
|
2018-05-07 18:04:32 +02:00
|
|
|
|
2018-05-04 15:27:50 +02:00
|
|
|
info-stm32:
|
|
|
|
@$(COLOR_ECHO) "CPU: $(CPU_MODEL)"
|
2018-05-07 18:04:32 +02:00
|
|
|
@$(COLOR_ECHO) "\tLine: $(CPU_LINE)"
|
2018-05-04 15:27:50 +02:00
|
|
|
@$(COLOR_ECHO) "\tPin count:\t$(STM32_PINCOUNT)"
|
2018-06-18 19:18:37 +02:00
|
|
|
@$(COLOR_ECHO) "\tROM size:\t$(ROM_LEN) ($(FLASHSIZE) Bytes)"
|
2018-05-04 15:27:50 +02:00
|
|
|
@$(COLOR_ECHO) "\tRAM size:\t$(RAM_LEN)"
|
|
|
|
|
2017-11-22 15:53:30 +01:00
|
|
|
ifneq (,$(CCMRAM_LEN))
|
|
|
|
LINKFLAGS += $(LINKFLAGPREFIX)--defsym=_ccmram_length=$(CCMRAM_LEN)
|
|
|
|
endif
|