Skip to content

Commit

Permalink
soc: st: stm32: Add serie stm32u0
Browse files Browse the repository at this point in the history
Add STM32U0 familly support

Signed-off-by: IBEN EL HADJ MESSAOUD Marwa <[email protected]>
  • Loading branch information
marwaiehm-st committed Aug 12, 2024
1 parent bf1e16e commit d0f37bc
Show file tree
Hide file tree
Showing 8 changed files with 133 additions and 0 deletions.
3 changes: 3 additions & 0 deletions soc/st/stm32/soc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,9 @@ family:
- name: stm32mp1x
socs:
- name: stm32mp157cxx
- name: stm32u0x
socs:
- name: stm32u083xx
- name: stm32u5x
socs:
- name: stm32u5a5xx
Expand Down
10 changes: 10 additions & 0 deletions soc/st/stm32/stm32u0x/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# SPDX-License-Identifier: Apache-2.0

zephyr_include_directories(${ZEPHYR_BASE}/drivers)
zephyr_sources(
soc.c
)

zephyr_include_directories(.)

set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/arm/cortex_m/scripts/linker.ld CACHE INTERNAL "")
12 changes: 12 additions & 0 deletions soc/st/stm32/stm32u0x/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# ST Microelectronics STM32U0 MCU series

# Copyright (c) 2024 STMicroelectronics
# SPDX-License-Identifier: Apache-2.0

config SOC_SERIES_STM32U0X
select ARM
select CPU_CORTEX_M0PLUS
select CPU_HAS_ARM_MPU
select CPU_CORTEX_M_HAS_VTOR
select HAS_STM32CUBE
select CPU_CORTEX_M_HAS_SYSTICK
10 changes: 10 additions & 0 deletions soc/st/stm32/stm32u0x/Kconfig.defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# ST Microelectronics STM32U0 MCU line

# Copyright (c) 2024 STMicroelectronics
# SPDX-License-Identifier: Apache-2.0

if SOC_SERIES_STM32U0X

rsource "Kconfig.defconfig.stm32u0*"

endif # SOC_SERIES_STM32U0X
11 changes: 11 additions & 0 deletions soc/st/stm32/stm32u0x/Kconfig.defconfig.stm32u083xx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# STMicroelectronics STM32U083XX MCU

# Copyright (c) 2024 STMicroelectronics
# SPDX-License-Identifier: Apache-2.0

if SOC_STM32U083XX

config NUM_IRQS
default 32

endif # SOC_STM32U083XX
18 changes: 18 additions & 0 deletions soc/st/stm32/stm32u0x/Kconfig.soc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# ST Microelectronics STM32U0 MCU line

# Copyright (c) 2024 STMicroelectronics
# SPDX-License-Identifier: Apache-2.0

config SOC_SERIES_STM32U0X
bool
select SOC_FAMILY_STM32

config SOC_SERIES
default "stm32u0x" if SOC_SERIES_STM32U0X

config SOC_STM32U083XX
bool
select SOC_SERIES_STM32U0X

config SOC
default "stm32u083xx" if SOC_STM32U083XX
47 changes: 47 additions & 0 deletions soc/st/stm32/stm32u0x/soc.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* Copyright (c) 2024 STMicroelectronics
*
* SPDX-License-Identifier: Apache-2.0
*/

/**
* @file
* @brief System/hardware module for STM32U0 processor
*/

#include <zephyr/device.h>
#include <zephyr/init.h>
#include <stm32_ll_bus.h>
#include <stm32_ll_pwr.h>
#include <stm32_ll_icache.h>
#include <zephyr/logging/log.h>

#include <cmsis_core.h>
#include <stm32_ll_system.h>

#define LOG_LEVEL CONFIG_SOC_LOG_LEVEL
LOG_MODULE_REGISTER(soc);

/**
* @brief Perform basic hardware initialization at boot.
*
* This needs to be run from the very beginning.
* So the init priority has to be 0 (zero).
*
* @return 0
*/
static int stm32u0_init(void)
{
/* Enable ART Accelerator prefetch */
LL_FLASH_EnablePrefetch();

/* Update CMSIS SystemCoreClock variable (HCLK) */
/* At reset, system core clock is set to 16 MHz from HSI */
SystemCoreClock = 16000000;

LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_PWR);

return 0;
}

SYS_INIT(stm32u0_init, PRE_KERNEL_1, 0);
22 changes: 22 additions & 0 deletions soc/st/stm32/stm32u0x/soc.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Copyright (c) 2024 STMicroelectronics
*
* SPDX-License-Identifier: Apache-2.0
*/

/**
* @file SoC configuration macros for the STM32U0 family processors.
*
*/


#ifndef _STM32U0_SOC_H_

Check notice on line 13 in soc/st/stm32/stm32u0x/soc.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

soc/st/stm32/stm32u0x/soc.h:13 -
#define _STM32U0_SOC_H_

#ifndef _ASMLANGUAGE

#include <stm32u0xx.h>

#endif /* !_ASMLANGUAGE */

#endif /* _STM32U0_SOC_H_ */

0 comments on commit d0f37bc

Please sign in to comment.