Skip to content

Commit 6347b87

Browse files
erwangogalak
authored andcommitted
soc/arm/st_stm32: Add support for stm32wb soc
Provide basic soc configuration for STM32WB SoCs support in Zephyr. Signed-off-by: Erwan Gouriou <[email protected]>
1 parent 9098215 commit 6347b87

File tree

10 files changed

+176
-0
lines changed

10 files changed

+176
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
zephyr_include_directories(${ZEPHYR_BASE}/drivers)
2+
zephyr_sources(
3+
soc.c
4+
)
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Kconfig - ST Microelectronics STM32WB MCU line
2+
#
3+
# Copyright (c) 2019 Linaro Limited
4+
#
5+
# SPDX-License-Identifier: Apache-2.0
6+
#
7+
8+
if SOC_SERIES_STM32WBX
9+
10+
source "soc/arm/st_stm32/stm32wb/Kconfig.defconfig.stm32wb*"
11+
12+
config SOC_SERIES
13+
default "stm32wb"
14+
15+
endif # SOC_SERIES_STM32WBX
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Kconfig - ST Microelectronics STM32WB55XX MCU
2+
#
3+
# Copyright (c) 2019 Linaro Limited
4+
#
5+
# SPDX-License-Identifier: Apache-2.0
6+
#
7+
8+
if SOC_STM32WB55XG
9+
10+
config SOC
11+
string
12+
default "stm32wb55xx"
13+
14+
config NUM_IRQS
15+
int
16+
default 63
17+
18+
endif # SOC_STM32WB55XG
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Kconfig - ST Microelectronics STM32WB MCU series
2+
#
3+
# Copyright (c) 2019 Linaro Limited
4+
#
5+
# SPDX-License-Identifier: Apache-2.0
6+
#
7+
8+
config SOC_SERIES_STM32WBX
9+
bool "STM32WBx Series MCU"
10+
select CPU_CORTEX_M4
11+
select CPU_HAS_FPU
12+
select SOC_FAMILY_STM32
13+
select HAS_STM32CUBE
14+
select CPU_HAS_ARM_MPU
15+
select CPU_HAS_SYSTICK
16+
help
17+
Enable support for STM32WB MCU series
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Kconfig - ST Microelectronics STM32WB MCU line
2+
#
3+
# Copyright (c) 2019 Linaro Limited
4+
#
5+
# SPDX-License-Identifier: Apache-2.0
6+
#
7+
8+
choice
9+
prompt "STM32WBx MCU Selection"
10+
depends on SOC_SERIES_STM32WBX
11+
12+
config SOC_STM32WB55XG
13+
bool "STM32WB55XX"
14+
15+
endchoice
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/*
2+
* Copyright (c) 2019 Linaro Limited
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/* SoC level DTS fixup file */
8+
9+
#define DT_NUM_IRQ_PRIO_BITS DT_ARM_V7M_NVIC_E000E100_ARM_NUM_IRQ_PRIORITY_BITS
10+
11+
/* End of SoC Level DTS fixup file */

soc/arm/st_stm32/stm32wb/linker.ld

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/* linker.ld - Linker command/script file */
2+
3+
/*
4+
* Copyright (c) 2014-2016 Wind River Systems, Inc.
5+
*
6+
* SPDX-License-Identifier: Apache-2.0
7+
*/
8+
9+
#include <arch/arm/cortex_m/scripts/linker.ld>

soc/arm/st_stm32/stm32wb/soc.c

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
* Copyright (c) 2018 Linaro Limited
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/**
8+
* @file
9+
* @brief System/hardware module for STM32WB processor
10+
*/
11+
12+
#include <device.h>
13+
#include <init.h>
14+
#include <arch/cpu.h>
15+
#include <cortex_m/exc.h>
16+
17+
/**
18+
* @brief Perform basic hardware initialization at boot.
19+
*
20+
* This needs to be run from the very beginning.
21+
* So the init priority has to be 0 (zero).
22+
*
23+
* @return 0
24+
*/
25+
static int stm32wb_init(struct device *arg)
26+
{
27+
u32_t key;
28+
29+
ARG_UNUSED(arg);
30+
31+
key = irq_lock();
32+
33+
z_clearfaults();
34+
35+
/* Install default handler that simply resets the CPU
36+
* if configured in the kernel, NOP otherwise
37+
*/
38+
NMI_INIT();
39+
40+
irq_unlock(key);
41+
42+
/* Update CMSIS SystemCoreClock variable (HCLK) */
43+
/* At reset, system core clock is set to 4 MHz from MSI */
44+
SystemCoreClock = 4000000;
45+
46+
return 0;
47+
}
48+
49+
SYS_INIT(stm32wb_init, PRE_KERNEL_1, 0);

soc/arm/st_stm32/stm32wb/soc.h

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
* Copyright (c) 2019 Linaro Limited
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/**
8+
* @file SoC configuration macros for the STM32WB family processors.
9+
*
10+
*/
11+
12+
13+
#ifndef _STM32WBX_SOC_H_
14+
#define _STM32WBX_SOC_H_
15+
16+
#ifndef _ASMLANGUAGE
17+
18+
#include <stm32wbxx.h>
19+
20+
/* ARM CMSIS definitions must be included before kernel_includes.h.
21+
* Therefore, it is essential to include kernel_includes.h after including
22+
* core SOC-specific headers.
23+
*/
24+
#include <kernel_includes.h>
25+
26+
#endif /* !_ASMLANGUAGE */
27+
28+
#endif /* _STM32WBX_SOC_H_ */
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/*
2+
* Copyright (c) 2018 Linaro Limited
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#ifndef _STM32WBX_SOC_REGISTERS_H_
8+
#define _STM32WBX_SOC_REGISTERS_H_
9+
10+
#endif /* _STM32WBX_SOC_REGISTERS_H_ */

0 commit comments

Comments
 (0)