Skip to content

Commit 56c9da3

Browse files
gautierg-sterwango
authored andcommitted
stm32cube: add stm32c5 cube
Add Cube HAL and LL drivers and SoC files for STM32C5x series. Signed-off-by: Guillaume Gautier <[email protected]>
1 parent af97a59 commit 56c9da3

File tree

149 files changed

+424616
-4
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

149 files changed

+424616
-4
lines changed

stm32cube/CMakeLists.txt

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ zephyr_compile_definitions(
4848
# List of all supported STM32 SoC series
4949
set(supported_series
5050
stm32c0x
51+
stm32c5x
5152
stm32f0x
5253
stm32f1x
5354
stm32f2x
@@ -123,10 +124,21 @@ foreach(series ${supported_series})
123124
set(cube_dir ${series}x)
124125
endif()
125126

126-
zephyr_include_directories(
127-
${cube_dir}/soc
128-
${cube_dir}/drivers/include
129-
)
127+
if(CONFIG_STM32_HAL2)
128+
zephyr_compile_definitions(USE_EXTERNAL_ENV)
129+
zephyr_include_directories(
130+
${cube_dir}/dfp/Include
131+
${cube_dir}/dfp/Include/Templates
132+
${cube_dir}/drivers/hal
133+
${cube_dir}/drivers/ll
134+
${cube_dir}/drivers/templates/common
135+
)
136+
else()
137+
zephyr_include_directories(
138+
${cube_dir}/soc
139+
${cube_dir}/drivers/include
140+
)
141+
endif()
130142

131143
add_subdirectory(${cube_dir})
132144
endif()

stm32cube/stm32c5xx/CMakeLists.txt

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Copyright (c) 2026 STMicroelectronics
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
zephyr_library_sources(dfp/Source/Templates/system_stm32c5xx.c)
6+
zephyr_library_sources(drivers/hal/stm32c5xx_hal.c)
7+
zephyr_library_sources(drivers/hal/stm32c5xx_hal_rcc.c)
8+
zephyr_library_sources_ifdef(CONFIG_USE_STM32_HAL_ADC drivers/hal/stm32c5xx_hal_adc.c)
9+
zephyr_library_sources_ifdef(CONFIG_USE_STM32_HAL_AES drivers/hal/stm32c5xx_hal_aes.c)
10+
zephyr_library_sources_ifdef(CONFIG_USE_STM32_HAL_CCB drivers/hal/stm32c5xx_hal_ccb.c)
11+
zephyr_library_sources_ifdef(CONFIG_USE_STM32_HAL_COMP drivers/hal/stm32c5xx_hal_comp.c)
12+
zephyr_library_sources_ifdef(CONFIG_USE_STM32_HAL_CORDIC drivers/hal/stm32c5xx_hal_cordic.c)
13+
zephyr_library_sources_ifdef(CONFIG_USE_STM32_HAL_CORTEX drivers/hal/stm32c5xx_hal_cortex.c)
14+
zephyr_library_sources_ifdef(CONFIG_USE_STM32_HAL_CRC drivers/hal/stm32c5xx_hal_crc.c)
15+
zephyr_library_sources_ifdef(CONFIG_USE_STM32_HAL_CRS drivers/hal/stm32c5xx_hal_crs.c)
16+
zephyr_library_sources_ifdef(CONFIG_USE_STM32_HAL_DAC drivers/hal/stm32c5xx_hal_dac.c)
17+
zephyr_library_sources_ifdef(CONFIG_USE_STM32_HAL_DBGMCU drivers/hal/stm32c5xx_hal_dbgmcu.c)
18+
zephyr_library_sources_ifdef(CONFIG_USE_STM32_HAL_DMA drivers/hal/stm32c5xx_hal_dma.c)
19+
zephyr_library_sources_ifdef(CONFIG_USE_STM32_HAL_ETH drivers/hal/stm32c5xx_hal_eth.c)
20+
zephyr_library_sources_ifdef(CONFIG_USE_STM32_HAL_EXTI drivers/hal/stm32c5xx_hal_exti.c)
21+
zephyr_library_sources_ifdef(CONFIG_USE_STM32_HAL_FDCAN drivers/hal/stm32c5xx_hal_fdcan.c)
22+
zephyr_library_sources_ifdef(CONFIG_USE_STM32_HAL_FLASH drivers/hal/stm32c5xx_hal_flash.c)
23+
zephyr_library_sources_ifdef(CONFIG_USE_STM32_HAL_FLASH_ITF drivers/hal/stm32c5xx_hal_flash_itf.c)
24+
zephyr_library_sources_ifdef(CONFIG_USE_STM32_HAL_GPIO drivers/hal/stm32c5xx_hal_gpio.c)
25+
zephyr_library_sources_ifdef(CONFIG_USE_STM32_HAL_HASH drivers/hal/stm32c5xx_hal_hash.c)
26+
zephyr_library_sources_ifdef(CONFIG_USE_STM32_HAL_HCD drivers/hal/stm32c5xx_hal_hcd.c)
27+
zephyr_library_sources_ifdef(CONFIG_USE_STM32_HAL_I2C drivers/hal/stm32c5xx_hal_i2c.c)
28+
zephyr_library_sources_ifdef(CONFIG_USE_STM32_HAL_I2S drivers/hal/stm32c5xx_hal_i2s.c)
29+
zephyr_library_sources_ifdef(CONFIG_USE_STM32_HAL_I3C drivers/hal/stm32c5xx_hal_i3c.c)
30+
zephyr_library_sources_ifdef(CONFIG_USE_STM32_HAL_ICACHE drivers/hal/stm32c5xx_hal_icache.c)
31+
zephyr_library_sources_ifdef(CONFIG_USE_STM32_HAL_IWDG drivers/hal/stm32c5xx_hal_iwdg.c)
32+
zephyr_library_sources_ifdef(CONFIG_USE_STM32_HAL_LPTIM drivers/hal/stm32c5xx_hal_lptim.c)
33+
zephyr_library_sources_ifdef(CONFIG_USE_STM32_HAL_OPAMP drivers/hal/stm32c5xx_hal_opamp.c)
34+
zephyr_library_sources_ifdef(CONFIG_USE_STM32_HAL_PCD drivers/hal/stm32c5xx_hal_pcd.c)
35+
zephyr_library_sources_ifdef(CONFIG_USE_STM32_HAL_PKA drivers/hal/stm32c5xx_hal_pka.c)
36+
zephyr_library_sources_ifdef(CONFIG_USE_STM32_HAL_PWR drivers/hal/stm32c5xx_hal_pwr.c)
37+
zephyr_library_sources_ifdef(CONFIG_USE_STM32_HAL_RAMCFG drivers/hal/stm32c5xx_hal_ramcfg.c)
38+
zephyr_library_sources_ifdef(CONFIG_USE_STM32_HAL_RNG drivers/hal/stm32c5xx_hal_rng.c)
39+
zephyr_library_sources_ifdef(CONFIG_USE_STM32_HAL_RTC drivers/hal/stm32c5xx_hal_rtc.c)
40+
zephyr_library_sources_ifdef(CONFIG_USE_STM32_HAL_SBS drivers/hal/stm32c5xx_hal_sbs.c)
41+
zephyr_library_sources_ifdef(CONFIG_USE_STM32_HAL_SMARTCARD drivers/hal/stm32c5xx_hal_smartcard.c)
42+
zephyr_library_sources_ifdef(CONFIG_USE_STM32_HAL_SMBUS drivers/hal/stm32c5xx_hal_smbus.c)
43+
zephyr_library_sources_ifdef(CONFIG_USE_STM32_HAL_SPI drivers/hal/stm32c5xx_hal_spi.c)
44+
zephyr_library_sources_ifdef(CONFIG_USE_STM32_HAL_TAMP drivers/hal/stm32c5xx_hal_tamp.c)
45+
zephyr_library_sources_ifdef(CONFIG_USE_STM32_HAL_TIM drivers/hal/stm32c5xx_hal_tim.c)
46+
zephyr_library_sources_ifdef(CONFIG_USE_STM32_HAL_UART drivers/hal/stm32c5xx_hal_uart.c)
47+
zephyr_library_sources_ifdef(CONFIG_USE_STM32_HAL_USART drivers/hal/stm32c5xx_hal_usart.c)
48+
zephyr_library_sources_ifdef(CONFIG_USE_STM32_HAL_WWDG drivers/hal/stm32c5xx_hal_wwdg.c)
49+
zephyr_library_sources_ifdef(CONFIG_USE_STM32_HAL_XSPI drivers/hal/stm32c5xx_hal_xspi.c)
50+
zephyr_library_sources_ifdef(CONFIG_USE_STM32_LL_DLYB drivers/hal/stm32c5xx_dlyb_core.c)
51+
zephyr_library_sources_ifdef(CONFIG_USE_STM32_LL_USB drivers/hal/stm32c5xx_usb_drd_core.c)

stm32cube/stm32c5xx/LICENSE.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Copyright 2026 STMicroelectronics.
2+
All rights reserved.
3+
4+
Redistribution and use in source and binary forms, with or without modification,
5+
are permitted provided that the following conditions are met:
6+
7+
1. Redistributions of source code must retain the above copyright notice, this
8+
list of conditions and the following disclaimer.
9+
10+
2. Redistributions in binary form must reproduce the above copyright notice,
11+
this list of conditions and the following disclaimer in the documentation and/or
12+
other materials provided with the distribution.
13+
14+
3. Neither the name of the copyright holder nor the names of its contributors
15+
may be used to endorse or promote products derived from this software without
16+
specific prior written permission.
17+
18+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
22+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
25+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

stm32cube/stm32c5xx/README

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
STM32CubeC5
2+
###########
3+
4+
Origin:
5+
ST Microelectronics
6+
https://www.st.com/en/microcontrollers-microprocessors/stm32c5-series.html
7+
8+
Status:
9+
version 2.0.0
10+
11+
Purpose:
12+
ST Microelectronics official MCU package for STM32C5 series.
13+
14+
Description:
15+
This package is an extract of official STM32CubeC5 package written by ST Microelectronics.
16+
It is composed of STM32Cube hardware abstraction layer (HAL) and low layer (LL) plus a set
17+
of CMSIS headers files, one for each SoC in STM32C5 series.
18+
19+
Dependencies:
20+
None.
21+
22+
URL:
23+
https://github.com/STMicroelectronics/STM32CubeC5
24+
25+
Commit:
26+
bfb39f1c987ed1c6e49de19655d2c299a4aee462
27+
28+
Maintained-by:
29+
External
30+
31+
License:
32+
BSD-3-Clause
33+
34+
License Link:
35+
https://opensource.org/licenses/BSD-3-Clause
36+
37+
Patch List:
38+
39+
*Changes from official delivery:
40+
-dos2unix applied
41+
-trailing white spaces removed
42+
43+
See release_note.html from STM32Cube
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
/**
2+
******************************************************************************
3+
* @file stm32_external_env.h
4+
* @brief External environments values (external oscillators values).
5+
* This file should be copied to the application folder.
6+
******************************************************************************
7+
* @attention
8+
*
9+
* Copyright (c) 2026 STMicroelectronics.
10+
* All rights reserved.
11+
*
12+
* This software is licensed under terms that can be found in the LICENSE file
13+
* in the root directory of this software component.
14+
* If no LICENSE file comes with this software, it is provided AS-IS.
15+
*
16+
******************************************************************************
17+
*/
18+
19+
/* Define to prevent recursive inclusion -------------------------------------*/
20+
#ifndef STM32_EXTERNAL_ENV_H
21+
#define STM32_EXTERNAL_ENV_H
22+
23+
#ifdef __cplusplus
24+
extern "C" {
25+
#endif
26+
27+
/* Exported types ------------------------------------------------------------*/
28+
/* Exported constants --------------------------------------------------------*/
29+
30+
/* ########################## VDD Value #######################################*/
31+
/**
32+
* @brief VDD Value.
33+
*/
34+
#if !defined (VDD_VALUE)
35+
#define VDD_VALUE 3300UL /*!< Value of VDD in mv */
36+
#endif /* VDD_VALUE */
37+
38+
/* ########################## Oscillator Values adaptation ####################*/
39+
/**
40+
* @brief Adjust the value of External High Speed oscillator (HSE) used in your application.
41+
* This value is used by the RCC HAL module to compute the system frequency
42+
* (when HSE is used as system clock source, directly or through the PSI).
43+
*/
44+
#if !defined (HSE_VALUE)
45+
#if defined(RCC_CR1_HSIDIV4ON)
46+
#define HSE_VALUE 16000000UL /*!< Value of the External oscillator in Hz */
47+
#else
48+
#if defined(AHB4PERIPH_BASE)
49+
#define HSE_VALUE 48000000UL /*!< Value of the External oscillator in Hz */
50+
#else
51+
#define HSE_VALUE 24000000UL /*!< Value of the External oscillator in Hz */
52+
#endif /* AHB4PERIPH_BASE */
53+
#endif /* RCC_CR1_HSIDIV4ON */
54+
#endif /* HSE_VALUE */
55+
56+
#if !defined (HSE_STARTUP_TIMEOUT)
57+
#define HSE_STARTUP_TIMEOUT 100UL /*!< Time out for HSE start up, in ms */
58+
#endif /* HSE_STARTUP_TIMEOUT */
59+
60+
/**
61+
* @brief External Low Speed oscillator (LSE) value.
62+
* This value is used by the UART, RTC HAL module to compute the system frequency
63+
*/
64+
#if !defined (LSE_VALUE)
65+
#define LSE_VALUE 32768UL /*!< Value of the External oscillator in Hz*/
66+
#endif /* LSE_VALUE */
67+
68+
#if !defined (LSE_STARTUP_TIMEOUT)
69+
#define LSE_STARTUP_TIMEOUT 5000UL /*!< Time out for LSE start up, in ms */
70+
#endif /* HSE_STARTUP_TIMEOUT */
71+
72+
/* Tip: To avoid modifying this file each time you need to use different HSE,
73+
=== you can define the HSE value in your toolchain compiler preprocessor. */
74+
75+
#ifdef __cplusplus
76+
}
77+
#endif
78+
79+
#endif /* STM32_EXTERNAL_ENV_H */

0 commit comments

Comments
 (0)