Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce the STM32WB0 series #230

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
461 changes: 461 additions & 0 deletions dts/st/wb0/stm32wb05kzvx-pinctrl.dtsi

Large diffs are not rendered by default.

461 changes: 461 additions & 0 deletions dts/st/wb0/stm32wb05tzfx-pinctrl.dtsi

Large diffs are not rendered by default.

696 changes: 696 additions & 0 deletions dts/st/wb0/stm32wb06ccfx-pinctrl.dtsi

Large diffs are not rendered by default.

786 changes: 786 additions & 0 deletions dts/st/wb0/stm32wb06ccvx-pinctrl.dtsi

Large diffs are not rendered by default.

481 changes: 481 additions & 0 deletions dts/st/wb0/stm32wb06kcvx-pinctrl.dtsi

Large diffs are not rendered by default.

696 changes: 696 additions & 0 deletions dts/st/wb0/stm32wb07ccfx-pinctrl.dtsi

Large diffs are not rendered by default.

786 changes: 786 additions & 0 deletions dts/st/wb0/stm32wb07ccvx-pinctrl.dtsi

Large diffs are not rendered by default.

481 changes: 481 additions & 0 deletions dts/st/wb0/stm32wb07kcvx-pinctrl.dtsi

Large diffs are not rendered by default.

461 changes: 461 additions & 0 deletions dts/st/wb0/stm32wb09kevx-pinctrl.dtsi

Large diffs are not rendered by default.

461 changes: 461 additions & 0 deletions dts/st/wb0/stm32wb09tefx-pinctrl.dtsi

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion scripts/genllheaders/header-template.j2
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

{% for series in all_series %}
#{{ "if" if loop.index == 1 else "elif"}} defined(CONFIG_SOC_SERIES_{{ series[:-1] | upper }})
#{{ "if" if loop.index == 1 else "elif"}} defined(CONFIG_SOC_SERIES_{{ series.replace("xx", "x") | upper }})
#include <{{ series }}_ll_{{ ll_api }}.h>
{% endfor %}
#endif
Expand Down
1 change: 1 addition & 0 deletions scripts/genpinctrl/genpinctrl.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
"stm32u5": 0x42020000,
"stm32wba": 0x42020000,
"stm32wb": 0x48000000,
"stm32wb0": 0x48000000,
"stm32wl": 0x48000000,
}
"""pinctrl peripheral addresses for each family."""
Expand Down
3 changes: 3 additions & 0 deletions scripts/genpinctrl/stm32-pinctrl-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@
- name: ADC_IN / ADC_INN / ADC_INP
match: "^ADC(?:\\d+)?_IN[NP]?\\d+$"

- name: ADC_VINM / ADC_VINP
match: "^ADC(?:\\d+)?_VIN[PM]\\d+$"
erwango marked this conversation as resolved.
Show resolved Hide resolved

- name: CAN_RX
match: "^CAN\\d*_RX$"
bias: pull-up
Expand Down
81 changes: 66 additions & 15 deletions stm32cube/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,27 +1,52 @@
# Makefile - STM32Cube SDK
#
# Copyright (c) 2016 Linaro Limited
# Copyright (c) 2024 STMicroelectronics
#
# SPDX-License-Identifier: Apache-2.0

#add_library(STM32CUBE INTERFACE)
#
# This file enables compilation of the STM32Cube library
# for a target STM32 series as part of the Zephyr RTOS.
#
# The following symbols are provided by the Zephyr build system:
# * CONFIG_SOC: name of the SoC
# - Converted to HAL/LL model selection define
# (c.f. `*/soc/stm32*xx.h` for list of allowed values)
# - In Zephyr, the value should be fully lower-cased
# (inverse conversion is performed by this script)
# - e.g.: CONFIG_SOC = "stm32f030xc" -> #define STM32F030xC
#
# * CONFIG_SOC_SERIES_{SERIES_NAME}: name of the STM32 series
# - Corresponding STM32Cube package is included in the build
# - Found in subfolder "{SERIES_NAME}" or "{SERIES_NAME}x"
# - ${supported_series} below lists all supported series
# - The SERIES_NAME is lowercase in this list
# - The SERIES_NAME **always** ends with a single `x`

zephyr_library()

# Convert the Zephyr lowercase SoC name to the value expected by STM32Cube
# Example: "stm32f030xc" --TOUPPER--> "STM32F030XC" --REPLACE--> "STM32F030xC"
string(TOUPPER ${CONFIG_SOC} _STM32CUBE_CPU)
string(REPLACE "X" "x" STM32CUBE_CPU ${_STM32CUBE_CPU})

# STM32Cub uses the CPU name to expose SOC-specific attributes of a specific
# peripheral.
# It also requires USE_HAL_DRIVER to be define in order to benefit from
# STM32Cube HAL and LL APIs
# Provide the minimal definitions needed by Cube to function
# properly. This includes the SoC definition, but also the
# USE_HAL_DRIVER and USE_FULL_LL_DRIVER defines, which control
# whether or not the code in HAL/LL source files in compiled
# or not. Since we want this code, we have to define these too.
#
# Note that this does not add any HAL or LL source files to the
# build: this is controlled by the various USE_STM32_{HAL/LL}_<PPP>
# Kconfig symbols instead (see per-series CMakeLists for details).
zephyr_compile_definitions(
-D${STM32CUBE_CPU}
-DUSE_HAL_DRIVER
-DUSE_FULL_LL_DRIVER
)
)

set(stm_socs
# List of all supported STM32 SoC series
set(supported_series
stm32c0x
stm32f0x
stm32f1x
Expand All @@ -41,40 +66,66 @@ set(stm_socs
stm32mp1x
stm32u0x
stm32u5x
stm32wb0x
stm32wbax
stm32wbx
stm32wlx
)
)

# On dual-core MCUs, we must inform Cube which CPU we are building for.
# Provide the Cube definition based on the active CPU Kconfig symbols.
if(CONFIG_CPU_CORTEX_M4)
zephyr_compile_definitions( -DCORE_CM4 )
elseif(CONFIG_CPU_CORTEX_M7)
zephyr_compile_definitions( -DCORE_CM7 )
endif()

# Define the HSE frequency visible to Cube if a value is specified in Zephyr.
if(CONFIG_CLOCK_STM32_HSE_CLOCK)
zephyr_compile_definitions( -DHSE_VALUE=${CONFIG_CLOCK_STM32_HSE_CLOCK} )
endif()

# Ethernet HAL API v2 specifics
if(CONFIG_ETH_STM32_HAL_API_V2)
# Enable PTP support in HAL if requested by Zephyr
zephyr_compile_definitions_ifdef(CONFIG_PTP_CLOCK_STM32_HAL
-DHAL_ETH_USE_PTP)
endif()

foreach(stm_soc ${stm_socs})
string(TOUPPER ${stm_soc} soc_to_upper)
if(CONFIG_SOC_SERIES_${soc_to_upper})
# Search which STM32 series was selected
foreach(series ${supported_series})
string(TOUPPER ${series} series_to_upper)
if(CONFIG_SOC_SERIES_${series_to_upper})
# Found the series - now look for its Cube package.
# Depending on the naming convention used in the package,
# this will be either the raw ${series}, or ${series}
# suffixed with a single `x` (i.e., `${series}x`).
#
# Check if the former exists:
# - if yes, correct subdirectory is the raw variant
# - if no, correct subdirectory is the suffixed variant
#
# Note that `IS_DIRECTORY` checks for existence, so it
# is more appropriate than `EXISTS` for this usecase.
if (IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${series}")
set(cube_dir ${series})
else()
set(cube_dir ${series}x)
endif()

zephyr_include_directories(
${stm_soc}x/soc
${stm_soc}x/drivers/include
${cube_dir}/soc
${cube_dir}/drivers/include
)

add_subdirectory(${stm_soc}x)
add_subdirectory(${cube_dir})
endif()
endforeach()

# Enable HAL asserts if requested by Zephyr
if(CONFIG_USE_STM32_ASSERT)
zephyr_compile_definitions( -DUSE_FULL_ASSERT )
endif()

# Add the series-agnostic LL headers to include directories
zephyr_include_directories(common_ll/include)
1 change: 1 addition & 0 deletions stm32cube/common_ll/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ stm32l5xx 1.5.1
stm32mp1xx 1.6.0
stm32u0xx 1.1.0
stm32u5xx 1.5.0
stm32wb0x 1.0.0
stm32wbaxx 1.3.1
stm32wbxx 1.19.1
stm32wlxx 1.3.0
Expand Down
2 changes: 2 additions & 0 deletions stm32cube/common_ll/include/stm32_ll_adc.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
#include <stm32u0xx_ll_adc.h>
#elif defined(CONFIG_SOC_SERIES_STM32U5X)
#include <stm32u5xx_ll_adc.h>
#elif defined(CONFIG_SOC_SERIES_STM32WB0X)
#include <stm32wb0x_ll_adc.h>
#elif defined(CONFIG_SOC_SERIES_STM32WBAX)
#include <stm32wbaxx_ll_adc.h>
#elif defined(CONFIG_SOC_SERIES_STM32WBX)
Expand Down
2 changes: 2 additions & 0 deletions stm32cube/common_ll/include/stm32_ll_bus.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
#include <stm32u0xx_ll_bus.h>
#elif defined(CONFIG_SOC_SERIES_STM32U5X)
#include <stm32u5xx_ll_bus.h>
#elif defined(CONFIG_SOC_SERIES_STM32WB0X)
#include <stm32wb0x_ll_bus.h>
#elif defined(CONFIG_SOC_SERIES_STM32WBAX)
#include <stm32wbaxx_ll_bus.h>
#elif defined(CONFIG_SOC_SERIES_STM32WBX)
Expand Down
2 changes: 2 additions & 0 deletions stm32cube/common_ll/include/stm32_ll_cortex.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
#include <stm32u0xx_ll_cortex.h>
#elif defined(CONFIG_SOC_SERIES_STM32U5X)
#include <stm32u5xx_ll_cortex.h>
#elif defined(CONFIG_SOC_SERIES_STM32WB0X)
#include <stm32wb0x_ll_cortex.h>
#elif defined(CONFIG_SOC_SERIES_STM32WBAX)
#include <stm32wbaxx_ll_cortex.h>
#elif defined(CONFIG_SOC_SERIES_STM32WBX)
Expand Down
2 changes: 2 additions & 0 deletions stm32cube/common_ll/include/stm32_ll_crc.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
#include <stm32u0xx_ll_crc.h>
#elif defined(CONFIG_SOC_SERIES_STM32U5X)
#include <stm32u5xx_ll_crc.h>
#elif defined(CONFIG_SOC_SERIES_STM32WB0X)
#include <stm32wb0x_ll_crc.h>
#elif defined(CONFIG_SOC_SERIES_STM32WBAX)
#include <stm32wbaxx_ll_crc.h>
#elif defined(CONFIG_SOC_SERIES_STM32WBX)
Expand Down
2 changes: 2 additions & 0 deletions stm32cube/common_ll/include/stm32_ll_dma.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
#include <stm32u0xx_ll_dma.h>
#elif defined(CONFIG_SOC_SERIES_STM32U5X)
#include <stm32u5xx_ll_dma.h>
#elif defined(CONFIG_SOC_SERIES_STM32WB0X)
#include <stm32wb0x_ll_dma.h>
#elif defined(CONFIG_SOC_SERIES_STM32WBAX)
#include <stm32wbaxx_ll_dma.h>
#elif defined(CONFIG_SOC_SERIES_STM32WBX)
Expand Down
2 changes: 2 additions & 0 deletions stm32cube/common_ll/include/stm32_ll_dmamux.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#include <stm32mp1xx_ll_dmamux.h>
#elif defined(CONFIG_SOC_SERIES_STM32U0X)
#include <stm32u0xx_ll_dmamux.h>
#elif defined(CONFIG_SOC_SERIES_STM32WB0X)
#include <stm32wb0x_ll_dmamux.h>
#elif defined(CONFIG_SOC_SERIES_STM32WBX)
#include <stm32wbxx_ll_dmamux.h>
#elif defined(CONFIG_SOC_SERIES_STM32WLX)
Expand Down
2 changes: 2 additions & 0 deletions stm32cube/common_ll/include/stm32_ll_gpio.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
#include <stm32u0xx_ll_gpio.h>
#elif defined(CONFIG_SOC_SERIES_STM32U5X)
#include <stm32u5xx_ll_gpio.h>
#elif defined(CONFIG_SOC_SERIES_STM32WB0X)
#include <stm32wb0x_ll_gpio.h>
#elif defined(CONFIG_SOC_SERIES_STM32WBAX)
#include <stm32wbaxx_ll_gpio.h>
#elif defined(CONFIG_SOC_SERIES_STM32WBX)
Expand Down
2 changes: 2 additions & 0 deletions stm32cube/common_ll/include/stm32_ll_i2c.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
#include <stm32u0xx_ll_i2c.h>
#elif defined(CONFIG_SOC_SERIES_STM32U5X)
#include <stm32u5xx_ll_i2c.h>
#elif defined(CONFIG_SOC_SERIES_STM32WB0X)
#include <stm32wb0x_ll_i2c.h>
#elif defined(CONFIG_SOC_SERIES_STM32WBAX)
#include <stm32wbaxx_ll_i2c.h>
#elif defined(CONFIG_SOC_SERIES_STM32WBX)
Expand Down
2 changes: 2 additions & 0 deletions stm32cube/common_ll/include/stm32_ll_iwdg.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
#include <stm32u0xx_ll_iwdg.h>
#elif defined(CONFIG_SOC_SERIES_STM32U5X)
#include <stm32u5xx_ll_iwdg.h>
#elif defined(CONFIG_SOC_SERIES_STM32WB0X)
#include <stm32wb0x_ll_iwdg.h>
#elif defined(CONFIG_SOC_SERIES_STM32WBAX)
#include <stm32wbaxx_ll_iwdg.h>
#elif defined(CONFIG_SOC_SERIES_STM32WBX)
Expand Down
2 changes: 2 additions & 0 deletions stm32cube/common_ll/include/stm32_ll_lpuart.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
#include <stm32u0xx_ll_lpuart.h>
#elif defined(CONFIG_SOC_SERIES_STM32U5X)
#include <stm32u5xx_ll_lpuart.h>
#elif defined(CONFIG_SOC_SERIES_STM32WB0X)
#include <stm32wb0x_ll_lpuart.h>
#elif defined(CONFIG_SOC_SERIES_STM32WBAX)
#include <stm32wbaxx_ll_lpuart.h>
#elif defined(CONFIG_SOC_SERIES_STM32WBX)
Expand Down
2 changes: 2 additions & 0 deletions stm32cube/common_ll/include/stm32_ll_pka.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
#include <stm32l5xx_ll_pka.h>
#elif defined(CONFIG_SOC_SERIES_STM32U5X)
#include <stm32u5xx_ll_pka.h>
#elif defined(CONFIG_SOC_SERIES_STM32WB0X)
#include <stm32wb0x_ll_pka.h>
#elif defined(CONFIG_SOC_SERIES_STM32WBAX)
#include <stm32wbaxx_ll_pka.h>
#elif defined(CONFIG_SOC_SERIES_STM32WBX)
Expand Down
2 changes: 2 additions & 0 deletions stm32cube/common_ll/include/stm32_ll_pwr.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
#include <stm32u0xx_ll_pwr.h>
#elif defined(CONFIG_SOC_SERIES_STM32U5X)
#include <stm32u5xx_ll_pwr.h>
#elif defined(CONFIG_SOC_SERIES_STM32WB0X)
#include <stm32wb0x_ll_pwr.h>
#elif defined(CONFIG_SOC_SERIES_STM32WBAX)
#include <stm32wbaxx_ll_pwr.h>
#elif defined(CONFIG_SOC_SERIES_STM32WBX)
Expand Down
9 changes: 9 additions & 0 deletions stm32cube/common_ll/include/stm32_ll_radio.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
* NOTE: Autogenerated file using genllheaders.py
*
* SPDX-License-Identifier: Apache-2.0
*/

#if defined(CONFIG_SOC_SERIES_STM32WB0X)
#include <stm32wb0x_ll_radio.h>
#endif
2 changes: 2 additions & 0 deletions stm32cube/common_ll/include/stm32_ll_rcc.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
#include <stm32u0xx_ll_rcc.h>
#elif defined(CONFIG_SOC_SERIES_STM32U5X)
#include <stm32u5xx_ll_rcc.h>
#elif defined(CONFIG_SOC_SERIES_STM32WB0X)
#include <stm32wb0x_ll_rcc.h>
#elif defined(CONFIG_SOC_SERIES_STM32WBAX)
#include <stm32wbaxx_ll_rcc.h>
#elif defined(CONFIG_SOC_SERIES_STM32WBX)
Expand Down
2 changes: 2 additions & 0 deletions stm32cube/common_ll/include/stm32_ll_rng.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
#include <stm32u0xx_ll_rng.h>
#elif defined(CONFIG_SOC_SERIES_STM32U5X)
#include <stm32u5xx_ll_rng.h>
#elif defined(CONFIG_SOC_SERIES_STM32WB0X)
#include <stm32wb0x_ll_rng.h>
#elif defined(CONFIG_SOC_SERIES_STM32WBAX)
#include <stm32wbaxx_ll_rng.h>
#elif defined(CONFIG_SOC_SERIES_STM32WBX)
Expand Down
2 changes: 2 additions & 0 deletions stm32cube/common_ll/include/stm32_ll_rtc.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
#include <stm32u0xx_ll_rtc.h>
#elif defined(CONFIG_SOC_SERIES_STM32U5X)
#include <stm32u5xx_ll_rtc.h>
#elif defined(CONFIG_SOC_SERIES_STM32WB0X)
#include <stm32wb0x_ll_rtc.h>
#elif defined(CONFIG_SOC_SERIES_STM32WBAX)
#include <stm32wbaxx_ll_rtc.h>
#elif defined(CONFIG_SOC_SERIES_STM32WBX)
Expand Down
2 changes: 2 additions & 0 deletions stm32cube/common_ll/include/stm32_ll_spi.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
#include <stm32u0xx_ll_spi.h>
#elif defined(CONFIG_SOC_SERIES_STM32U5X)
#include <stm32u5xx_ll_spi.h>
#elif defined(CONFIG_SOC_SERIES_STM32WB0X)
#include <stm32wb0x_ll_spi.h>
#elif defined(CONFIG_SOC_SERIES_STM32WBAX)
#include <stm32wbaxx_ll_spi.h>
#elif defined(CONFIG_SOC_SERIES_STM32WBX)
Expand Down
2 changes: 2 additions & 0 deletions stm32cube/common_ll/include/stm32_ll_system.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
#include <stm32u0xx_ll_system.h>
#elif defined(CONFIG_SOC_SERIES_STM32U5X)
#include <stm32u5xx_ll_system.h>
#elif defined(CONFIG_SOC_SERIES_STM32WB0X)
#include <stm32wb0x_ll_system.h>
#elif defined(CONFIG_SOC_SERIES_STM32WBAX)
#include <stm32wbaxx_ll_system.h>
#elif defined(CONFIG_SOC_SERIES_STM32WBX)
Expand Down
2 changes: 2 additions & 0 deletions stm32cube/common_ll/include/stm32_ll_tim.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
#include <stm32u0xx_ll_tim.h>
#elif defined(CONFIG_SOC_SERIES_STM32U5X)
#include <stm32u5xx_ll_tim.h>
#elif defined(CONFIG_SOC_SERIES_STM32WB0X)
#include <stm32wb0x_ll_tim.h>
#elif defined(CONFIG_SOC_SERIES_STM32WBAX)
#include <stm32wbaxx_ll_tim.h>
#elif defined(CONFIG_SOC_SERIES_STM32WBX)
Expand Down
2 changes: 2 additions & 0 deletions stm32cube/common_ll/include/stm32_ll_usart.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
#include <stm32u0xx_ll_usart.h>
#elif defined(CONFIG_SOC_SERIES_STM32U5X)
#include <stm32u5xx_ll_usart.h>
#elif defined(CONFIG_SOC_SERIES_STM32WB0X)
#include <stm32wb0x_ll_usart.h>
#elif defined(CONFIG_SOC_SERIES_STM32WBAX)
#include <stm32wbaxx_ll_usart.h>
#elif defined(CONFIG_SOC_SERIES_STM32WBX)
Expand Down
2 changes: 2 additions & 0 deletions stm32cube/common_ll/include/stm32_ll_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
#include <stm32u0xx_ll_utils.h>
#elif defined(CONFIG_SOC_SERIES_STM32U5X)
#include <stm32u5xx_ll_utils.h>
#elif defined(CONFIG_SOC_SERIES_STM32WB0X)
#include <stm32wb0x_ll_utils.h>
#elif defined(CONFIG_SOC_SERIES_STM32WBAX)
#include <stm32wbaxx_ll_utils.h>
#elif defined(CONFIG_SOC_SERIES_STM32WBX)
Expand Down
Loading
Loading