soc: arm: add support for nuvoton numaker m46x series
Add initial support for nuvoton numaker m46x SoC series including basic init. Signed-off-by: cyliang tw <cyliang@nuvoton.com>
This commit is contained in:
parent
95cef5f3ab
commit
512371b75b
14 changed files with 265 additions and 1 deletions
43
dts/arm/nuvoton/m46x.dtsi
Normal file
43
dts/arm/nuvoton/m46x.dtsi
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2023 Nuvoton Technology Corporation.
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <arm/armv7-m.dtsi>
|
||||||
|
#include <mem.h>
|
||||||
|
|
||||||
|
/ {
|
||||||
|
cpus {
|
||||||
|
#address-cells = <1>;
|
||||||
|
#size-cells = <0>;
|
||||||
|
|
||||||
|
cpu@0 {
|
||||||
|
device_type = "cpu";
|
||||||
|
compatible = "arm,cortex-m4f";
|
||||||
|
reg = <0>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
sram0: memory@20000000 {
|
||||||
|
compatible = "mmio-sram";
|
||||||
|
reg = <0x20000000 DT_SIZE_K(512)>;
|
||||||
|
};
|
||||||
|
|
||||||
|
flash0: flash@0 {
|
||||||
|
compatible = "soc-nv-flash";
|
||||||
|
reg = <0 DT_SIZE_K(1024)>;
|
||||||
|
erase-block-size = <4096>;
|
||||||
|
write-block-size = <4>;
|
||||||
|
};
|
||||||
|
|
||||||
|
sysclk: system-clock {
|
||||||
|
compatible = "fixed-clock";
|
||||||
|
clock-frequency = <200000000>;
|
||||||
|
#clock-cells = <0>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
&nvic {
|
||||||
|
arm,num-irq-priority-bits = <4>;
|
||||||
|
};
|
|
@ -12,9 +12,59 @@ menu "Nuvoton drivers"
|
||||||
depends on HAS_NUMICRO_HAL
|
depends on HAS_NUMICRO_HAL
|
||||||
|
|
||||||
config HAS_NUMICRO_UART
|
config HAS_NUMICRO_UART
|
||||||
bool
|
bool "NuMicro UART"
|
||||||
help
|
help
|
||||||
Enable Nuvoton Universal asynchronous receiver transmitter HAL
|
Enable Nuvoton Universal asynchronous receiver transmitter HAL
|
||||||
module driver
|
module driver
|
||||||
|
|
||||||
endmenu
|
endmenu
|
||||||
|
|
||||||
|
config HAS_NUMAKER_HAL
|
||||||
|
bool
|
||||||
|
select HAS_CMSIS_CORE
|
||||||
|
depends on SOC_FAMILY_NUMAKER
|
||||||
|
|
||||||
|
menu "Nuvoton NuMaker drivers"
|
||||||
|
depends on HAS_NUMAKER_HAL
|
||||||
|
config HAS_NUMAKER_UART
|
||||||
|
bool "NuMaker UART"
|
||||||
|
help
|
||||||
|
Enable Nuvoton Universal asynchronous receiver transmitter HAL
|
||||||
|
module driver
|
||||||
|
config HAS_NUMAKER_GPIO
|
||||||
|
bool "NuMaker GPIO"
|
||||||
|
help
|
||||||
|
Enable Nuvoton gpio HAL module driver
|
||||||
|
config HAS_NUMAKER_FMC
|
||||||
|
bool "NuMaker FMC"
|
||||||
|
help
|
||||||
|
Enable Nuvoton FMC HAL module driver
|
||||||
|
config HAS_NUMAKER_I2C
|
||||||
|
bool "NuMaker I2C"
|
||||||
|
help
|
||||||
|
Enable Nuvoton I2C HAL module driver
|
||||||
|
config HAS_NUMAKER_SPI
|
||||||
|
bool "NuMaker SPI"
|
||||||
|
help
|
||||||
|
Enable Nuvoton SPI HAL module driver
|
||||||
|
config HAS_NUMAKER_PWM
|
||||||
|
bool "NuMaker PWM"
|
||||||
|
help
|
||||||
|
Enable Nuvoton PWM HAL module driver
|
||||||
|
config HAS_NUMAKER_USBD
|
||||||
|
bool "NuMaker USB 1.1 device controller"
|
||||||
|
help
|
||||||
|
Enable Nuvoton USB 1.1 device controller HAL module driver
|
||||||
|
config HAS_NUMAKER_HSUSBD
|
||||||
|
bool "NuMaker high-speed USB 2.0 device controller"
|
||||||
|
help
|
||||||
|
Enable Nuvoton high-speed USB 2.0 device controller HAL module driver
|
||||||
|
config HAS_NUMAKER_ETH
|
||||||
|
bool "NuMaker ETH"
|
||||||
|
help
|
||||||
|
Enable Nuvoton ETH EMAC HAL module driver
|
||||||
|
config HAS_NUMAKER_CANFD
|
||||||
|
bool "NuMaker CAN FD"
|
||||||
|
help
|
||||||
|
Enable Nuvoton CAN FD HAL module driver
|
||||||
|
endmenu
|
||||||
|
|
8
soc/arm/nuvoton_numaker/CMakeLists.txt
Normal file
8
soc/arm/nuvoton_numaker/CMakeLists.txt
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
# Copyright (c) 2023 Nuvoton Technology Corporation.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
# This is for access to pinctrl macros
|
||||||
|
zephyr_include_directories(common)
|
||||||
|
|
||||||
|
add_subdirectory(${SOC_SERIES})
|
18
soc/arm/nuvoton_numaker/Kconfig
Normal file
18
soc/arm/nuvoton_numaker/Kconfig
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
# Copyright (c) 2023 Nuvoton Technology Corporation.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
|
||||||
|
config SOC_FAMILY_NUMAKER
|
||||||
|
select PLATFORM_SPECIFIC_INIT
|
||||||
|
bool
|
||||||
|
|
||||||
|
if SOC_FAMILY_NUMAKER
|
||||||
|
|
||||||
|
config SOC_FAMILY
|
||||||
|
string
|
||||||
|
default "nuvoton_numaker"
|
||||||
|
|
||||||
|
source "soc/arm/nuvoton_numaker/*/Kconfig.soc"
|
||||||
|
|
||||||
|
endif # SOC_FAMILY_NUMAKER
|
5
soc/arm/nuvoton_numaker/Kconfig.defconfig
Normal file
5
soc/arm/nuvoton_numaker/Kconfig.defconfig
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
# Copyright (c) 2023 Nuvoton Technology Corporation.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
source "soc/arm/nuvoton_numaker/*/Kconfig.defconfig.series"
|
5
soc/arm/nuvoton_numaker/Kconfig.soc
Normal file
5
soc/arm/nuvoton_numaker/Kconfig.soc
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
# Copyright (c) 2023 Nuvoton Technology Corporation.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
source "soc/arm/nuvoton_numaker/*/Kconfig.series"
|
5
soc/arm/nuvoton_numaker/m46x/CMakeLists.txt
Normal file
5
soc/arm/nuvoton_numaker/m46x/CMakeLists.txt
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
# Copyright (c) 2023 Nuvoton Technology Corporation.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
zephyr_sources(soc.c)
|
10
soc/arm/nuvoton_numaker/m46x/Kconfig.defconfig.m467
Normal file
10
soc/arm/nuvoton_numaker/m46x/Kconfig.defconfig.m467
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
# Copyright (c) 2023 Nuvoton Technology Corporation.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
if SOC_M467
|
||||||
|
|
||||||
|
config NUM_IRQS
|
||||||
|
default 127
|
||||||
|
|
||||||
|
endif # SOC_M467
|
12
soc/arm/nuvoton_numaker/m46x/Kconfig.defconfig.series
Normal file
12
soc/arm/nuvoton_numaker/m46x/Kconfig.defconfig.series
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
# Copyright (c) 2023 Nuvoton Technology Corporation.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
if SOC_SERIES_M46X
|
||||||
|
|
||||||
|
source "soc/arm/nuvoton_numaker/m46x/Kconfig.defconfig.m46*"
|
||||||
|
|
||||||
|
config SOC_SERIES
|
||||||
|
default "m46x"
|
||||||
|
|
||||||
|
endif # SOC_SERIES_M46X
|
15
soc/arm/nuvoton_numaker/m46x/Kconfig.series
Normal file
15
soc/arm/nuvoton_numaker/m46x/Kconfig.series
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
# Copyright (c) 2023 Nuvoton Technology Corporation.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
config SOC_SERIES_M46X
|
||||||
|
bool "Nuvoton M46X Series MCU"
|
||||||
|
select ARM
|
||||||
|
select CPU_CORTEX_M4
|
||||||
|
select CPU_CORTEX_M_HAS_DWT
|
||||||
|
select CPU_HAS_FPU
|
||||||
|
select CPU_HAS_ARM_MPU
|
||||||
|
select CORTEX_M_SYSTICK
|
||||||
|
select SOC_FAMILY_NUMAKER
|
||||||
|
help
|
||||||
|
Enable support for Nuvoton M46X MCU series
|
13
soc/arm/nuvoton_numaker/m46x/Kconfig.soc
Normal file
13
soc/arm/nuvoton_numaker/m46x/Kconfig.soc
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
# Copyright (c) 2023 Nuvoton Technology Corporation.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
choice
|
||||||
|
prompt "Nuvoton M46X MCU Selection"
|
||||||
|
depends on SOC_SERIES_M46X
|
||||||
|
|
||||||
|
config SOC_M467
|
||||||
|
bool "M467"
|
||||||
|
select HAS_NUMAKER_HAL
|
||||||
|
|
||||||
|
endchoice
|
7
soc/arm/nuvoton_numaker/m46x/linker.ld
Normal file
7
soc/arm/nuvoton_numaker/m46x/linker.ld
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2023 Nuvoton Technology Corporation.
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <zephyr/arch/arm/aarch32/cortex_m/scripts/linker.ld>
|
60
soc/arm/nuvoton_numaker/m46x/soc.c
Normal file
60
soc/arm/nuvoton_numaker/m46x/soc.c
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2023 Nuvoton Technology Corporation.
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <zephyr/devicetree.h>
|
||||||
|
/* Hardware and starter kit includes. */
|
||||||
|
#include <NuMicro.h>
|
||||||
|
|
||||||
|
void z_arm_platform_init(void)
|
||||||
|
{
|
||||||
|
SystemInit();
|
||||||
|
|
||||||
|
/* Unlock protected registers */
|
||||||
|
SYS_UnlockReg();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* -------------------
|
||||||
|
* Init System Clock
|
||||||
|
* -------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
CLK_EnableXtalRC(CLK_PWRCTL_HXTEN_Msk);
|
||||||
|
/* Wait for HXT clock ready */
|
||||||
|
CLK_WaitClockReady(CLK_STATUS_HXTSTB_Msk);
|
||||||
|
|
||||||
|
CLK_EnableXtalRC(CLK_PWRCTL_LXTEN_Msk);
|
||||||
|
/* Wait for LXT clock ready */
|
||||||
|
CLK_WaitClockReady(CLK_STATUS_LXTSTB_Msk);
|
||||||
|
|
||||||
|
/* Enable 12 MHz high-speed internal RC oscillator (HIRC) */
|
||||||
|
CLK_EnableXtalRC(CLK_PWRCTL_HIRCEN_Msk);
|
||||||
|
/* Wait for HIRC clock ready */
|
||||||
|
CLK_WaitClockReady(CLK_STATUS_HIRCSTB_Msk);
|
||||||
|
|
||||||
|
/* Enable 10 KHz low-speed internal RC oscillator (LIRC) */
|
||||||
|
CLK_EnableXtalRC(CLK_PWRCTL_LIRCEN_Msk);
|
||||||
|
/* Wait for LIRC clock ready */
|
||||||
|
CLK_WaitClockReady(CLK_STATUS_LIRCSTB_Msk);
|
||||||
|
|
||||||
|
CLK_EnableXtalRC(CLK_PWRCTL_HIRC48EN_Msk);
|
||||||
|
/* Wait for HIRC48 clock ready */
|
||||||
|
CLK_WaitClockReady(CLK_STATUS_HIRC48STB_Msk);
|
||||||
|
|
||||||
|
/* Set PCLK0 and PCLK1 to HCLK/2 */
|
||||||
|
CLK->PCLKDIV = (CLK_PCLKDIV_APB0DIV_DIV2 | CLK_PCLKDIV_APB1DIV_DIV2);
|
||||||
|
|
||||||
|
/* Set core clock to 200MHz */
|
||||||
|
CLK_SetCoreClock(200000000);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Update System Core Clock
|
||||||
|
* User can use SystemCoreClockUpdate() to calculate SystemCoreClock.
|
||||||
|
*/
|
||||||
|
SystemCoreClockUpdate();
|
||||||
|
|
||||||
|
/* Lock protected registers */
|
||||||
|
SYS_LockReg();
|
||||||
|
}
|
13
soc/arm/nuvoton_numaker/m46x/soc.h
Normal file
13
soc/arm/nuvoton_numaker/m46x/soc.h
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2023 Nuvoton Technology Corporation.
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef ZEPHYR_SOC_ARM_NUVOTON_M46X_SOC_H_
|
||||||
|
#define ZEPHYR_SOC_ARM_NUVOTON_M46X_SOC_H_
|
||||||
|
|
||||||
|
/* Hardware and starter kit includes. */
|
||||||
|
#include <NuMicro.h>
|
||||||
|
|
||||||
|
#endif /* ZEPHYR_SOC_ARM_NUVOTON_M46X_SOC_H_*/
|
Loading…
Add table
Add a link
Reference in a new issue