Skip to content

Commit 016d048

Browse files
gautierg-stkartben
authored andcommitted
soc: st: stm32: add stm32n6 series
Add STM32N6 series Signed-off-by: Guillaume Gautier <[email protected]>
1 parent 45d3bf2 commit 016d048

File tree

8 files changed

+161
-0
lines changed

8 files changed

+161
-0
lines changed

soc/st/stm32/soc.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,9 @@ family:
186186
- name: stm32mp1x
187187
socs:
188188
- name: stm32mp157cxx
189+
- name: stm32n6x
190+
socs:
191+
- name: stm32n657xx
189192
- name: stm32u0x
190193
socs:
191194
- name: stm32u031xx

soc/st/stm32/stm32n6x/CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
3+
zephyr_include_directories(${ZEPHYR_BASE}/drivers)
4+
zephyr_sources(
5+
soc.c
6+
)
7+
8+
zephyr_include_directories(.)
9+
10+
set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/arm/cortex_m/scripts/linker.ld CACHE INTERNAL "")

soc/st/stm32/stm32n6x/Kconfig

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# ST Microelectronics STM32N6 MCU series
2+
3+
# Copyright (c) 2024 STMicroelectronics
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
config SOC_SERIES_STM32N6X
7+
select ARM
8+
select CPU_CORTEX_M55
9+
select ARM_TRUSTZONE_M
10+
select CPU_HAS_ARM_SAU
11+
select CPU_HAS_ARM_MPU
12+
select CPU_HAS_FPU
13+
select ARMV8_M_DSP
14+
select CPU_CORTEX_M_HAS_DWT
15+
select HAS_STM32CUBE
16+
select INIT_ARCH_HW_AT_BOOT
17+
select SOC_RESET_HOOK
18+
select TRUSTED_EXECUTION_SECURE
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# ST Microelectronics STM32N6 MCU series
2+
3+
# Copyright (c) 2024 STMicroelectronics
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
if SOC_SERIES_STM32N6X
7+
8+
rsource "Kconfig.defconfig.stm32n6*"
9+
10+
DT_STM32_CPU_CLOCK_PATH := $(dt_nodelabel_path,cpusw)
11+
DT_STM32_CPU_CLOCK_FREQ := $(dt_node_int_prop_int,$(DT_STM32_CPU_CLOCK_PATH),clock-frequency)
12+
13+
# For STM32N6, override the value defined in STM32 Kconfig to use CPU clock frequency
14+
config SYS_CLOCK_HW_CYCLES_PER_SEC
15+
default "$(DT_STM32_CPU_CLOCK_FREQ)" if "$(dt_nodelabel_enabled,cpusw)"
16+
17+
endif # SOC_SERIES_STM32N6X
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# ST Microelectronics STM32N6 MCU series
2+
3+
# Copyright (c) 2024 STMicroelectronics
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
if SOC_STM32N657XX
7+
8+
config NUM_IRQS
9+
default 194
10+
11+
endif # SOC_STM32N657XX

soc/st/stm32/stm32n6x/Kconfig.soc

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# ST Microelectronics STM32N6 MCU series
2+
3+
# Copyright (c) 2024 STMicroelectronics
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
config SOC_SERIES_STM32N6X
7+
bool
8+
select SOC_FAMILY_STM32
9+
10+
config SOC_SERIES
11+
default "stm32n6x" if SOC_SERIES_STM32N6X
12+
13+
config SOC_STM32N657XX
14+
bool
15+
select SOC_SERIES_STM32N6X
16+
17+
config SOC
18+
default "stm32n657xx" if SOC_STM32N657XX

soc/st/stm32/stm32n6x/soc.c

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
/*
2+
* Copyright (c) 2024 STMicroelectronics
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/**
8+
* @file
9+
* @brief System/hardware module for STM32N6 processor
10+
*/
11+
12+
#include <zephyr/device.h>
13+
#include <zephyr/init.h>
14+
#include <zephyr/cache.h>
15+
#include <zephyr/logging/log.h>
16+
17+
#include <stm32_ll_bus.h>
18+
#include <stm32_ll_pwr.h>
19+
#include <stm32_ll_icache.h>
20+
21+
#include <cmsis_core.h>
22+
23+
#define LOG_LEVEL CONFIG_SOC_LOG_LEVEL
24+
LOG_MODULE_REGISTER(soc);
25+
26+
extern char _vector_start[];
27+
void *g_pfnVectors = (void *)_vector_start;
28+
29+
#if defined(CONFIG_SOC_RESET_HOOK)
30+
void soc_reset_hook(void)
31+
{
32+
/* This is provided by STM32Cube HAL */
33+
SystemInit();
34+
}
35+
#endif
36+
37+
/**
38+
* @brief Perform basic hardware initialization at boot.
39+
*
40+
* This needs to be run from the very beginning.
41+
*
42+
* @return 0
43+
*/
44+
void soc_early_init_hook(void)
45+
{
46+
/* Enable caches */
47+
sys_cache_instr_enable();
48+
sys_cache_data_enable();
49+
50+
/* Update CMSIS SystemCoreClock variable (HCLK) */
51+
/* At reset, system core clock is set to 64 MHz from HSI */
52+
SystemCoreClock = 64000000;
53+
54+
/* Enable PWR */
55+
LL_AHB4_GRP1_EnableClock(LL_AHB4_GRP1_PERIPH_PWR);
56+
57+
/* Enable IOs */
58+
LL_PWR_EnableVddIO2();
59+
LL_PWR_EnableVddIO3();
60+
LL_PWR_EnableVddIO4();
61+
LL_PWR_EnableVddIO5();
62+
}

soc/st/stm32/stm32n6x/soc.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
* Copyright (c) 2024 STMicroelectronics
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/**
8+
* @file SoC configuration macros for the STM32N6 family processors.
9+
*
10+
*/
11+
12+
13+
#ifndef _STM32N6_SOC_H_
14+
#define _STM32N6_SOC_H_
15+
16+
#ifndef _ASMLANGUAGE
17+
18+
#include <stm32n6xx.h>
19+
20+
#endif /* !_ASMLANGUAGE */
21+
22+
#endif /* _STM32N6_SOC_H_ */

0 commit comments

Comments
 (0)