Skip to content

Commit

Permalink
Add support for WB family
Browse files Browse the repository at this point in the history
  • Loading branch information
atsju committed Jul 18, 2021
1 parent 26593ee commit 5d93332
Show file tree
Hide file tree
Showing 7 changed files with 134 additions and 17 deletions.
4 changes: 3 additions & 1 deletion cmake/FindBSP.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# For information about why and how of this file: https://cmake.org/cmake/help/latest/command/find_package.html

set(BSP_F0_BOARDS
STM32F0xx_Nucleo_32 STM32F0xx-Nucleo STM32F072B-Discovery
STM32F0308-Discovery STM32072B_EVAL STM32091C_EVAL
Expand Down Expand Up @@ -244,7 +246,7 @@ foreach(COMP ${BSP_FIND_COMPONENTS})
string(TOLOWER ${COMP} COMP_L)
string(TOUPPER ${COMP} COMP_U)

string(REGEX MATCH "^STM32([A-Z][0-9])([0-9A-Z][0-9][A-Z][0-9A-Z])?_?(M[47])?.*$" COMP_U ${COMP_U})
string(REGEX MATCH "^STM32([FGHLW][0-9BL])([0-9A-Z][0-9M][A-Z][0-9A-Z])?_?(M[47])?.*$" COMP_U ${COMP_U})
if(NOT CMAKE_MATCH_1)
message(FATAL_ERROR "Unknown BSP component: ${COMP}")
endif()
Expand Down
39 changes: 32 additions & 7 deletions cmake/FindCMSIS.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# For information about why and how of this file: https://cmake.org/cmake/help/latest/command/find_package.html

if(NOT CMSIS_FIND_COMPONENTS)
set(CMSIS_FIND_COMPONENTS ${STM32_SUPPORTED_FAMILIES_LONG_NAME})
endif()
Expand Down Expand Up @@ -45,56 +47,69 @@ foreach(COMP ${CMSIS_FIND_COMPONENTS})
string(TOLOWER ${COMP} COMP_L)
string(TOUPPER ${COMP} COMP)

string(REGEX MATCH "^STM32([A-Z][0-9])([0-9A-Z][0-9][A-Z][0-9A-Z])?_?(M[47])?.*$" COMP ${COMP})

string(REGEX MATCH "^STM32([FGHLW][0-9BL])([0-9A-Z][0-9M][A-Z][0-9A-Z])?_?(M[47])?.*$" COMP ${COMP})
# CMAKE_MATCH_<n> contains n'th subexpression
# CMAKE_MATCH_0 contains full match

if((NOT CMAKE_MATCH_1) AND (NOT CMAKE_MATCH_2))
message(FATAL_ERROR "Unknown CMSIS component: ${COMP}")
endif()

if(CMAKE_MATCH_2)
set(FAMILY ${CMAKE_MATCH_1})
set(DEVICES "${CMAKE_MATCH_1}${CMAKE_MATCH_2}")
message(TRACE "FindCMSIS: full device name match for COMP ${COMP}, DEVICES is ${DEVICES}")
else()
set(FAMILY ${CMAKE_MATCH_1})
stm32_get_devices_by_family(DEVICES FAMILY ${FAMILY} CORE ${CORE})
stm32_get_devices_by_family(DEVICES FAMILY ${FAMILY})
message(TRACE "FindCMSIS: family only match for COMP ${COMP}, DEVICES is ${DEVICES}")
endif()

if(CMAKE_MATCH_3)
set(CORE ${CMAKE_MATCH_3})
set(CORE_C "::${CORE}")
set(CORE_U "_${CORE}")
set(CORE_Ucm "_c${CORE}")
string(TOLOWER ${CORE_Ucm} CORE_Ucm)
message(TRACE "FindCMSIS: core match in component name for COMP ${COMP}. CORE is ${CORE}")
else()
unset(CORE)
unset(CORE_C)
unset(CORE_U)
unset(CORE_Ucm)
endif()

string(TOLOWER ${FAMILY} FAMILY_L)

if((NOT STM32_CMSIS_${FAMILY}_PATH) AND (NOT STM32_CUBE_${FAMILY}_PATH))
# try to set path from environment variable. Note it could be ...-NOT-FOUND and it's fine
set(STM32_CUBE_${FAMILY}_PATH $ENV{STM32_CUBE_${FAMILY}_PATH} CACHE PATH "Path to STM32Cube${FAMILY}")
endif()

if((NOT STM32_CMSIS_${FAMILY}_PATH) AND (NOT STM32_CUBE_${FAMILY}_PATH))
set(STM32_CUBE_${FAMILY}_PATH /opt/STM32Cube${FAMILY} CACHE PATH "Path to STM32Cube${FAMILY}")
message(STATUS "Neither STM32_CUBE_${FAMILY}_PATH nor STM32_CMSIS_${FAMILY}_PATH specified using default STM32_CUBE_${FAMILY}_PATH: ${STM32_CUBE_${FAMILY}_PATH}")
endif()


# search for Include/cmsis_gcc.h
find_path(CMSIS_${FAMILY}${CORE_U}_CORE_PATH
NAMES Include/cmsis_gcc.h
PATHS "${STM32_CMSIS_PATH}" "${STM32_CUBE_${FAMILY}_PATH}/Drivers/CMSIS"
NO_DEFAULT_PATH
)
if (NOT CMSIS_${FAMILY}${CORE_U}_CORE_PATH)
message(VERBOSE "TODO meaning full message 1")
continue()
endif()

# search for Include/stm32[XX]xx.h
find_path(CMSIS_${FAMILY}${CORE_U}_PATH
NAMES Include/stm32${FAMILY_L}xx.h
PATHS "${STM32_CMSIS_${FAMILY}_PATH}" "${STM32_CUBE_${FAMILY}_PATH}/Drivers/CMSIS/Device/ST/STM32${FAMILY}xx"
NO_DEFAULT_PATH
)
if (NOT CMSIS_${FAMILY}${CORE_U}_PATH)
message(VERBOSE "TODO meaning full message 2")
continue()
endif()
list(APPEND CMSIS_INCLUDE_DIRS "${CMSIS_${FAMILY}${CORE_U}_CORE_PATH}/Include" "${CMSIS_${FAMILY}${CORE_U}_PATH}/Include")
Expand All @@ -117,19 +132,22 @@ foreach(COMP ${CMSIS_FIND_COMPONENTS})

set(CMSIS_${COMP}_VERSION ${CMSIS_${FAMILY}${CORE_U}_VERSION})
set(CMSIS_VERSION ${CMSIS_${COMP}_VERSION})


# search for system_stm32[XX]xx.c
find_file(CMSIS_${FAMILY}${CORE_U}_SOURCE
NAMES system_stm32${FAMILY_L}xx.c
PATHS "${CMSIS_${FAMILY}${CORE_U}_PATH}/Source/Templates"
NO_DEFAULT_PATH
)
list(APPEND CMSIS_SOURCES "${CMSIS_${FAMILY}${CORE_U}_SOURCE}")

if (NOT CMSIS_${FAMILY}${CORE_U}_SOURCE)
if(NOT CMSIS_${FAMILY}${CORE_U}_SOURCE)
message(VERBOSE "TODO meaning full message 3")
continue()
endif()

if(NOT (TARGET CMSIS::STM32::${FAMILY}${CORE_C}))
message(TRACE "FindCMSIS: creating library CMSIS::STM32::${FAMILY}${CORE_C}")
add_library(CMSIS::STM32::${FAMILY}${CORE_C} INTERFACE IMPORTED)
target_link_libraries(CMSIS::STM32::${FAMILY}${CORE_C} INTERFACE STM32::${FAMILY}${CORE_C})
target_include_directories(CMSIS::STM32::${FAMILY}${CORE_C} INTERFACE "${CMSIS_${FAMILY}${CORE_U}_CORE_PATH}/Include")
Expand All @@ -139,8 +157,11 @@ foreach(COMP ${CMSIS_FIND_COMPONENTS})

set(DEVICES_FOUND TRUE)
foreach(DEVICE ${DEVICES})
message(TRACE "FindCMSIS: Iterating DEVICE ${DEVICE}")

stm32_get_cores(DEV_CORES FAMILY ${FAMILY} DEVICE ${DEVICE})
if(CORE AND (NOT ${CORE} IN_LIST DEV_CORES))
message(TRACE "FindCMSIS: skip device because CORE ${CORE} provided doesn't correspond to FAMILY ${FAMILY} DEVICE ${DEVICE}")
continue()
endif()

Expand All @@ -149,17 +170,19 @@ foreach(COMP ${CMSIS_FIND_COMPONENTS})
string(TOLOWER ${TYPE} TYPE_L)

find_file(CMSIS_${FAMILY}${CORE_U}_${TYPE}_STARTUP
NAMES startup_stm32${TYPE_L}.s
NAMES startup_stm32${TYPE_L}.s startup_stm32${TYPE_L}${CORE_Ucm}.s
PATHS "${CMSIS_${FAMILY}${CORE_U}_PATH}/Source/Templates/gcc"
NO_DEFAULT_PATH
)
list(APPEND CMSIS_SOURCES "${CMSIS_${FAMILY}${CORE_U}_${TYPE}_STARTUP}")
if(NOT CMSIS_${FAMILY}${CORE_U}_${TYPE}_STARTUP)
set(DEVICES_FOUND FALSE)
message(VERBOSE "FindCMSIS: did not find file: startup_stm32${TYPE_L}.s or startup_stm32${TYPE_L}${CORE_Ucm}.s")
break()
endif()

if(NOT (TARGET CMSIS::STM32::${TYPE}${CORE_C}))
message(TRACE "FindCMSIS: creating library CMSIS::STM32::${TYPE}${CORE_C}")
add_library(CMSIS::STM32::${TYPE}${CORE_C} INTERFACE IMPORTED)
target_link_libraries(CMSIS::STM32::${TYPE}${CORE_C} INTERFACE CMSIS::STM32::${FAMILY}${CORE_C} STM32::${TYPE}${CORE_C})
target_sources(CMSIS::STM32::${TYPE}${CORE_C} INTERFACE "${CMSIS_${FAMILY}${CORE_U}_${TYPE}_STARTUP}")
Expand All @@ -172,8 +195,10 @@ foreach(COMP ${CMSIS_FIND_COMPONENTS})

if(DEVICES_FOUND)
set(CMSIS_${COMP}_FOUND TRUE)
message(DEBUG "CMSIS_${COMP}_FOUND TRUE")
else()
set(CMSIS_${COMP}_FOUND FALSE)
message(DEBUG "CMSIS_${COMP}_FOUND FALSE")
endif()
list(REMOVE_DUPLICATES CMSIS_INCLUDE_DIRS)
list(REMOVE_DUPLICATES CMSIS_SOURCES)
Expand Down
2 changes: 2 additions & 0 deletions cmake/FindFreeRTOS.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# For information about why and how of this file: https://cmake.org/cmake/help/latest/command/find_package.html

if(NOT FreeRTOS_FIND_COMPONENTS)
set(FreeRTOS_FIND_COMPONENTS
ARM_CM0 ARM_CM3 ARM_CM4F ARM_CM7
Expand Down
38 changes: 34 additions & 4 deletions cmake/FindHAL.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# For information about why and how of this file: https://cmake.org/cmake/help/latest/command/find_package.html

set(HAL_DRIVERS_F0
adc can cec comp cortex crc dac dma exti flash gpio i2c i2s irda iwdg pcd
pwr rcc rtc smartcard smbus spi tim tsc uart usart wwdg
Expand Down Expand Up @@ -171,6 +173,20 @@ set(HAL_LL_DRIVERS_L5
rng rtc sdmmc spi tim ucpd usart usb utils
)

set(HAL_DRIVERS_WB
adc comp cortex crc cryp dma exti flash gpio hsem
i2c ipcc irda iwdg lcd lptim pcd pka pwr qspi rcc
rng rtc sai smartcard smbus spi sram tim tsc uart usart wwdg
)
set(HAL_EX_DRIVERS_WB
adc crc cryp dma flash i2c pcd pwr rcc
rtc sai smartcard spi tim uart usart
)
set(HAL_LL_DRIVERS_WB
adc comp crc crs dma exti gpio i2c lptim lpuart pka pwr rcc
rng rtc spi tim usart usb utils
)

foreach(FAMILY_SUFFIX ${STM32_SUPPORTED_FAMILIES_SHORT_NAME})
list(APPEND HAL_DRIVERS ${HAL_DRIVERS_${FAMILY_SUFFIX}})
list(APPEND HAL_LL_DRIVERS ${HAL_LL_DRIVERS_${FAMILY_SUFFIX}})
Expand All @@ -182,21 +198,24 @@ foreach(COMP ${HAL_FIND_COMPONENTS})
string(TOLOWER ${COMP} COMP_L)
string(TOUPPER ${COMP} COMP_U)

string(REGEX MATCH "^STM32([A-Z][0-9])([0-9A-Z][0-9][A-Z][0-9A-Z])?_?(M[47])?.*$" COMP_U ${COMP_U})
string(REGEX MATCH "^STM32([FGHLW][0-9BL])([0-9A-Z][0-9M][A-Z][0-9A-Z])?_?(M[47])?.*$" COMP_U ${COMP_U})
if(CMAKE_MATCH_1)
list(APPEND HAL_FIND_COMPONENTS_FAMILIES ${COMP})
message(TRACE "FindHAL: append COMP ${COMP} to HAL_FIND_COMPONENTS_FAMILIES")
continue()
endif()
if(${COMP_L} IN_LIST HAL_DRIVERS)
list(APPEND HAL_FIND_COMPONENTS_DRIVERS ${COMP})
message(TRACE "FindHAL: append COMP ${COMP} to HAL_FIND_COMPONENTS_DRIVERS")
continue()
endif()
string(REGEX REPLACE "^ll_" "" COMP_L ${COMP_L})
if(${COMP_L} IN_LIST HAL_LL_DRIVERS)
list(APPEND HAL_FIND_COMPONENTS_DRIVERS_LL ${COMP})
message(TRACE "FindHAL: append COMP ${COMP} to HAL_FIND_COMPONENTS_DRIVERS_LL")
continue()
endif()
message(FATAL_ERROR "Unknown HAL component: ${COMP}")
message(FATAL_ERROR "FindHAL: unknown HAL component: ${COMP}")
endforeach()

if(NOT HAL_FIND_COMPONENTS_FAMILIES)
Expand All @@ -209,6 +228,8 @@ if(STM32H7 IN_LIST HAL_FIND_COMPONENTS_FAMILIES)
endif()
list(REMOVE_DUPLICATES HAL_FIND_COMPONENTS_FAMILIES)

# when no explicit driver and driver_ll is given to find_component(HAL )
# then search for all supported driver and driver_ll
if((NOT HAL_FIND_COMPONENTS_DRIVERS) AND (NOT HAL_FIND_COMPONENTS_DRIVERS_LL))
set(HAL_FIND_COMPONENTS_DRIVERS ${HAL_DRIVERS})
set(HAL_FIND_COMPONENTS_DRIVERS_LL ${HAL_LL_DRIVERS})
Expand All @@ -223,7 +244,7 @@ message(STATUS "Search for HAL LL drivers: ${HAL_FIND_COMPONENTS_DRIVERS_LL}")
foreach(COMP ${HAL_FIND_COMPONENTS_FAMILIES})
string(TOUPPER ${COMP} COMP_U)

string(REGEX MATCH "^STM32([A-Z][0-9])([0-9A-Z][0-9][A-Z][0-9A-Z])?_?(M[47])?.*$" COMP_U ${COMP_U})
string(REGEX MATCH "^STM32([FGHLW][0-9BL])([0-9A-Z][0-9M][A-Z][0-9A-Z])?_?(M[47])?.*$" COMP_U ${COMP_U})
if(CMAKE_MATCH_3)
set(CORE ${CMAKE_MATCH_3})
set(CORE_C "::${CORE}")
Expand Down Expand Up @@ -270,6 +291,7 @@ foreach(COMP ${HAL_FIND_COMPONENTS_FAMILIES})
NO_DEFAULT_PATH
)
if (NOT HAL_${FAMILY}_PATH)
message(DEBUG "Missing HAL_${FAMILY}_PATH path")
continue()
endif()

Expand All @@ -286,14 +308,19 @@ foreach(COMP ${HAL_FIND_COMPONENTS_FAMILIES})

if ((NOT HAL_${FAMILY}${CORE_U}_INCLUDE) OR (NOT HAL_${FAMILY}${CORE_U}_SOURCE))
set(HAL_${COMP}_FOUND FALSE)
message(DEBUG "FindHAL: did not find path to HAL /src or /inc dir")
continue()
endif()

if(NOT (TARGET HAL::STM32::${FAMILY}${CORE_C}))
message(TRACE "FindHAL: creating library HAL::STM32::${FAMILY}${CORE_C}")
add_library(HAL::STM32::${FAMILY}${CORE_C} INTERFACE IMPORTED)
target_link_libraries(HAL::STM32::${FAMILY}${CORE_C} INTERFACE STM32::${FAMILY}${CORE_C} CMSIS::STM32::${FAMILY}${CORE_C})
target_link_libraries(HAL::STM32::${FAMILY}${CORE_C} INTERFACE
STM32::${FAMILY}${CORE_C}
CMSIS::STM32::${FAMILY}${CORE_C})
target_include_directories(HAL::STM32::${FAMILY}${CORE_C} INTERFACE "${HAL_${FAMILY}${CORE_U}_INCLUDE}")
target_sources(HAL::STM32::${FAMILY}${CORE_C} INTERFACE "${HAL_${FAMILY}${CORE_U}_SOURCE}")
message(TRACE "REMOVE ME: depends STM32::${FAMILY}${CORE_C} CMSIS::STM32::${FAMILY}${CORE_C}")
endif()

foreach(DRV_COMP ${HAL_FIND_COMPONENTS_DRIVERS})
Expand All @@ -318,6 +345,7 @@ foreach(COMP ${HAL_FIND_COMPONENTS_FAMILIES})

set(HAL_${DRV_COMP}_FOUND TRUE)
if(HAL_${FAMILY}${CORE_U}_${DRV}_SOURCE AND (NOT (TARGET HAL::STM32::${FAMILY}::${DRV})))
message(TRACE "FindHAL: creating library HAL::STM32::${FAMILY}${CORE_C}::${DRV}")
add_library(HAL::STM32::${FAMILY}${CORE_C}::${DRV} INTERFACE IMPORTED)
target_link_libraries(HAL::STM32::${FAMILY}${CORE_C}::${DRV} INTERFACE HAL::STM32::${FAMILY}${CORE_C})
target_sources(HAL::STM32::${FAMILY}${CORE_C}::${DRV} INTERFACE "${HAL_${FAMILY}${CORE_U}_${DRV}_SOURCE}")
Expand All @@ -335,6 +363,7 @@ foreach(COMP ${HAL_FIND_COMPONENTS_FAMILIES})
endif()

if((TARGET HAL::STM32::${FAMILY}${CORE_C}::${DRV}) AND (NOT (TARGET HAL::STM32::${FAMILY}${CORE_C}::${DRV}Ex)))
message(TRACE "FindHAL: creating library HAL::STM32::${FAMILY}${CORE_C}::${DRV}Ex")
add_library(HAL::STM32::${FAMILY}${CORE_C}::${DRV}Ex INTERFACE IMPORTED)
target_link_libraries(HAL::STM32::${FAMILY}${CORE_C}::${DRV}Ex INTERFACE HAL::STM32::${FAMILY}${CORE_C}::${DRV})
target_sources(HAL::STM32::${FAMILY}${CORE_C}::${DRV}Ex INTERFACE "${HAL_${FAMILY}${CORE_U}_${DRV}_EX_SOURCE}")
Expand Down Expand Up @@ -365,6 +394,7 @@ foreach(COMP ${HAL_FIND_COMPONENTS_FAMILIES})

set(HAL_${DRV_COMP}_FOUND TRUE)
if(HAL_${FAMILY}${CORE_U}_${DRV}_LL_SOURCE AND (NOT (TARGET HAL::STM32::${FAMILY}${CORE_C}::LL_${DRV})))
message(TRACE "FindHAL: creating library HAL::STM32::${FAMILY}${CORE_C}::LL_${DRV}")
add_library(HAL::STM32::${FAMILY}${CORE_C}::LL_${DRV} INTERFACE IMPORTED)
target_include_directories(HAL::STM32::${FAMILY}${CORE_C}::LL_${DRV} INTERFACE "${HAL_${FAMILY}${CORE_U}_INCLUDE}")
target_sources(HAL::STM32::${FAMILY}${CORE_C}::LL_${DRV} INTERFACE "${HAL_${FAMILY}${CORE_U}_${DRV}_LL_SOURCE}")
Expand Down
26 changes: 21 additions & 5 deletions cmake/stm32/common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ set(STM32_SUPPORTED_FAMILIES_LONG_NAME
STM32F0 STM32F1 STM32F2 STM32F3 STM32F4 STM32F7
STM32G0 STM32G4
STM32H7_M4 STM32H7_M7
STM32L0 STM32L1 STM32L4 STM32L5)
STM32L0 STM32L1 STM32L4 STM32L5
STM32WB STM32WL )

foreach(FAMILY ${STM32_SUPPORTED_FAMILIES_LONG_NAME})
string(REGEX MATCH "^STM32([A-Z][0-9])_?(M[47])?" FAMILY ${FAMILY})
# append short names (F0, F1, H7_M4, ...) to STM32_SUPPORTED_FAMILIES_SHORT_NAME
string(REGEX MATCH "^STM32([FGHLW][0-9BL])_?(M[47])?" FAMILY ${FAMILY})
list(APPEND STM32_SUPPORTED_FAMILIES_SHORT_NAME ${CMAKE_MATCH_1})
endforeach()
list(REMOVE_DUPLICATES STM32_SUPPORTED_FAMILIES_SHORT_NAME)
Expand Down Expand Up @@ -70,6 +72,7 @@ function(stm32_generate_hex_file TARGET)
)
endfunction()

# This function takes FAMILY (e.g. L4) and DEVICE (e.g. L496VG) to output TYPE (e.g. L496xx)
function(stm32_get_chip_type FAMILY DEVICE TYPE)
set(INDEX 0)
foreach(C_TYPE ${STM32_${FAMILY}_TYPES})
Expand All @@ -93,7 +96,7 @@ function(stm32_get_chip_info CHIP)

string(TOUPPER ${CHIP} CHIP)

string(REGEX MATCH "^STM32([A-Z][0-9])([0-9A-Z][0-9][A-Z][0-9A-Z]).*$" CHIP ${CHIP})
string(REGEX MATCH "^STM32([FGHLW][0-9BL])([0-9A-Z][0-9M][A-Z][0-9A-Z]).*$" CHIP ${CHIP})

if((NOT CMAKE_MATCH_1) OR (NOT CMAKE_MATCH_2))
message(FATAL_ERROR "Unknown chip ${CHIP}")
Expand Down Expand Up @@ -127,8 +130,10 @@ function(stm32_get_cores CORES)
cmake_parse_arguments(PARSE_ARGV 1 ARG "${ARG_OPTIONS}" "${ARG_SINGLE}" "${ARG_MULTIPLE}")

if(ARG_CHIP)
# TODO: I don't get why stm32_get_chip_info is called in stm32_get_cores
stm32_get_chip_info(${ARG_CHIP} FAMILY ARG_FAMILY TYPE ARG_TYPE DEVICE ARG_DEVICE)
elseif(ARG_FAMILY AND ARG_DEVICE)
# TODO: I don't get why stm32_get_chip_type is called in stm32_get_cores
stm32_get_chip_type(${ARG_FAMILY} ${ARG_DEVICE} ARG_TYPE)
elseif(ARG_FAMILY)
if(${ARG_FAMILY} STREQUAL "H7")
Expand All @@ -141,8 +146,15 @@ function(stm32_get_cores CORES)
message(FATAL_ERROR "Either CHIP or FAMILY or FAMILY/DEVICE should be specified for stm32_get_cores()")
endif()

# TODO following is the only part really used by FindCMSIS. Maybe a cleanup is needed
if(${ARG_FAMILY} STREQUAL "H7")
stm32h7_get_device_cores(${ARG_DEVICE} ${ARG_TYPE} CORE_LIST)
elseif(${ARG_FAMILY} STREQUAL "WB")
# note STM32WB have an M0 core but in current state of the art it runs ST stacks and is not needed/allowed to build for customer
set(CORE_LIST M4)
elseif(${ARG_FAMILY} STREQUAL "WL")
message(WARNING "common: WL family stm32_get_cores has not been tested")
set(CORE_LIST M4 M0)
endif()
set(${CORES} "${CORE_LIST}" PARENT_SCOPE)
endfunction()
Expand All @@ -163,7 +175,7 @@ function(stm32_get_memory_info)
stm32_get_chip_type(${INFO_FAMILY} ${INFO_DEVICE} INFO_TYPE)
endif()

string(REGEX REPLACE "^[FGHL][0-9][0-9A-Z][0-9].([3468BCDEFGHIZ])$" "\\1" SIZE_CODE ${INFO_DEVICE})
string(REGEX REPLACE "^[FGHLW][0-9BL][0-9A-Z][0-9M].([3468BCDEFGHIYZ])$" "\\1" SIZE_CODE ${INFO_DEVICE})

if(SIZE_CODE STREQUAL "3")
set(FLASH "8K")
Expand All @@ -176,6 +188,7 @@ function(stm32_get_memory_info)
elseif(SIZE_CODE STREQUAL "B")
set(FLASH "128K")
elseif(SIZE_CODE STREQUAL "C")
# Note there is a problem with STM32WB15CC (320kB flash)
set(FLASH "256K")
elseif(SIZE_CODE STREQUAL "D")
set(FLASH "384K")
Expand All @@ -189,6 +202,8 @@ function(stm32_get_memory_info)
set(FLASH "1536K")
elseif(SIZE_CODE STREQUAL "I")
set(FLASH "2048K")
elseif(SIZE_CODE STREQUAL "Y")
set(FLASH "640K")
elseif(SIZE_CODE STREQUAL "Z")
set(FLASH "192K")
else()
Expand Down Expand Up @@ -313,4 +328,5 @@ include(stm32/l0)
include(stm32/l1)
include(stm32/l4)
include(stm32/l5)

include(stm32/wb)
#include(stm32/wl) #TODO
Loading

0 comments on commit 5d93332

Please sign in to comment.