2020-05-03 14:35:01 +02:00
|
|
|
# Extract STM32 infos from CPU_MODEL
|
2020-09-10 08:26:36 +02:00
|
|
|
# Example for STM32L476RG:
|
|
|
|
# - STM32_TYPE: L
|
|
|
|
# - STM32_FAMILY: 4
|
|
|
|
# - STM32_MODEL: 476
|
|
|
|
# - STM32_MODEL2: 7
|
|
|
|
# - STM32_MODEL3: 6
|
|
|
|
# - STM32_PINCOUNT: R (64)
|
|
|
|
# - STM32_ROMSIZE: G (1024K)
|
2020-05-03 14:35:01 +02:00
|
|
|
CPU_MODEL_UPPERCASE = $(call uppercase,$(CPU_MODEL))
|
2024-01-25 22:45:17 +01:00
|
|
|
STM32_INFO := $(shell echo $(CPU_MODEL_UPPERCASE) | sed -E -e 's/^STM32(F|L|W|G|MP|U|C)([0-7]|B|L)([A-Z0-9])([0-9])(.)(.)?(_A)?/\1 \2 \2\3\4 \3 \4 \5 \6 \7/')
|
2020-05-03 14:35:01 +02:00
|
|
|
STM32_TYPE = $(word 1, $(STM32_INFO))
|
|
|
|
STM32_FAMILY = $(word 2, $(STM32_INFO))
|
|
|
|
STM32_MODEL = $(word 3, $(STM32_INFO))
|
2021-07-21 11:23:47 +02:00
|
|
|
ifneq (,$(filter W,$(STM32_TYPE)))
|
2020-08-03 00:35:59 +02:00
|
|
|
STM32_MODEL2 = $(word 4, $(STM32_INFO))
|
|
|
|
STM32_MODEL3 = $(word 5, $(STM32_INFO))
|
|
|
|
STM32_PINCOUNT = $(word 6, $(STM32_INFO))
|
|
|
|
STM32_ROMSIZE = $(word 7, $(STM32_INFO))
|
2021-07-21 11:23:47 +02:00
|
|
|
else ifneq (,$(filter MP,$(STM32_TYPE)))
|
2020-08-03 00:35:59 +02:00
|
|
|
STM32_MODEL2 = $(word 6, $(STM32_INFO))
|
|
|
|
STM32_PINCOUNT = $(word 7, $(STM32_INFO))$(word 8, $(STM32_INFO))
|
2021-07-21 11:23:47 +02:00
|
|
|
else
|
|
|
|
STM32_MODEL2 = $(word 4, $(STM32_INFO))
|
|
|
|
STM32_MODEL3 = $(word 5, $(STM32_INFO))
|
|
|
|
STM32_PINCOUNT = $(word 6, $(STM32_INFO))
|
|
|
|
STM32_ROMSIZE = $(word 7, $(STM32_INFO))
|
|
|
|
STM32_RAMMOD = $(word 8, $(STM32_INFO))
|
2020-08-03 00:35:59 +02:00
|
|
|
endif
|
2020-05-03 14:35:01 +02:00
|
|
|
|
2020-05-26 11:12:06 +02:00
|
|
|
CPU_FAM = $(call lowercase,$(STM32_TYPE)$(STM32_FAMILY))
|
2020-05-03 14:35:01 +02:00
|
|
|
|
2020-05-26 11:12:06 +02:00
|
|
|
ifeq (f0,$(CPU_FAM))
|
2020-06-10 13:11:32 +02:00
|
|
|
CPU_CORE = cortex-m0
|
2020-05-26 11:12:06 +02:00
|
|
|
else ifneq (,$(filter $(CPU_FAM),f1 f2 l1))
|
2020-06-10 13:11:32 +02:00
|
|
|
CPU_CORE = cortex-m3
|
2020-08-03 00:35:59 +02:00
|
|
|
else ifneq (,$(filter $(CPU_FAM),f3 f4 l4 mp1))
|
2020-06-10 13:11:32 +02:00
|
|
|
CPU_CORE = cortex-m4f
|
2021-03-05 01:00:00 +01:00
|
|
|
else ifneq (,$(filter $(CPU_FAM),g4 wb wl))
|
2020-06-10 13:11:32 +02:00
|
|
|
CPU_CORE = cortex-m4
|
2020-05-26 11:12:06 +02:00
|
|
|
else ifeq (f7,$(CPU_FAM))
|
2020-06-10 13:11:32 +02:00
|
|
|
CPU_CORE = cortex-m7
|
2024-01-25 22:45:17 +01:00
|
|
|
else ifneq (,$(filter $(CPU_FAM),g0 l0 c0))
|
2020-06-10 13:11:32 +02:00
|
|
|
CPU_CORE = cortex-m0plus
|
2021-12-15 15:53:53 +01:00
|
|
|
else ifneq (,$(filter $(CPU_FAM),l5 u5))
|
2020-09-28 15:57:01 +02:00
|
|
|
CPU_CORE = cortex-m33
|
2020-05-03 14:35:01 +02:00
|
|
|
else
|
2024-01-25 22:45:17 +01:00
|
|
|
$(error Not supported CPU family: '$(CPU_FAM)')
|
2020-05-03 14:35:01 +02:00
|
|
|
endif
|