1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/cpu/stm32_common/Makefile.include
cladmi e0a5860bb7
cpu/stm32_common: remove inadapted periph_flash_common
The `periph_flash_common` feature was only defined here to trigger
inclusion of a source file with common functions.
It even only defines private symbols `_lock` and `_unlock` so no reason
to expose it to the build system.
And in practice, all stm cpus providing `periph_flashpage` or
`periph_eeprom` were required to provide `periph_flash_common` to allow
including it.

The previous implementation was only parsing in the modules were in
`FEATURES_REQUIRED` wich did not take cases of `FEATURES_OPTIONAL` into
account.
And also, in the same time, as the dependencies was declared in
`Makefile.include` it was processed before `Makefile.dep` so never handled
cases where a module could depend on `periph_flashpage` or
`periph_eeprom` feature.

It is replaced by selecting the common source file when module using it
are included.

The now useless feature `periph_flash_common` is removed from
`FEATURES_PROVIDED`.
2018-10-11 15:20:44 +02:00

42 lines
1.3 KiB
Makefile

# 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)
# include common periph module
USEMODULE += periph_common
# include stm32 common functions and stm32 common periph drivers
USEMODULE += stm32_common stm32_common_periph
# For stm32 cpu's we use the stm32_common.ld linker script
export LINKFLAGS += -L$(RIOTCPU)/stm32_common/ldscripts
LINKER_SCRIPT ?= stm32_common.ld
# export the common include directory
export INCLUDES += -I$(RIOTCPU)/stm32_common/include
# Compute ROM_LEN and RAM_LEN
include $(RIOTCPU)/stm32_common/stm32_mem_lengths.mk
KB := 1024
LEN := $(shell echo $(ROM_LEN) | sed 's/K//')
FLASHSIZE := $(shell echo $$(( $(LEN) * $(KB) )) )
# 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)
export CFLAGS += -DSTM32_FLASHSIZE=$(FLASHSIZE)U
info-stm32:
@$(COLOR_ECHO) "CPU: $(CPU_MODEL)"
@$(COLOR_ECHO) "\tLine: $(CPU_LINE)"
@$(COLOR_ECHO) "\tPin count:\t$(STM32_PINCOUNT)"
@$(COLOR_ECHO) "\tROM size:\t$(ROM_LEN) ($(FLASHSIZE) Bytes)"
@$(COLOR_ECHO) "\tRAM size:\t$(RAM_LEN)"
ifneq (,$(CCMRAM_LEN))
LINKFLAGS += $(LINKFLAGPREFIX)--defsym=_ccmram_length=$(CCMRAM_LEN)
endif