soc: arm: ambiq: apollo4: Add support for Apollo4 Plus SoC

Add all required parts (new SoC family/series, device tree) for
the Ambiq Apollo4 Plus SoC.

Signed-off-by: Maciej Sobkowski <msobkowski@antmicro.com>
This commit is contained in:
Maciej Sobkowski 2023-05-09 23:47:55 +02:00 committed by Carles Cufí
commit 0118886624
13 changed files with 169 additions and 0 deletions

View file

@ -0,0 +1,32 @@
/* SPDX-License-Identifier: Apache-2.0 */
#include <arm/armv7-m.dtsi>
#include <mem.h>
/ {
cpus {
#address-cells = <1>;
#size-cells = <0>;
cpu0: cpu@0 {
compatible = "arm,cortex-m4f";
reg = <0>;
};
};
/* MRAM region */
flash0: flash@18000 {
compatible = "soc-nv-flash";
reg = <0x00018000 0x1e8000>;
};
/* TCM + SRAM region */
sram0: memory@10000000 {
compatible = "mmio-sram";
reg = <0x10000000 0x2C0000>;
};
};
&nvic {
arm,num-irq-priority-bits = <3>;
};

View file

@ -0,0 +1,7 @@
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (c) 2023 Antmicro <www.antmicro.com>
add_subdirectory(${SOC_SERIES})
zephyr_include_directories(.)

16
soc/arm/ambiq/Kconfig Normal file
View file

@ -0,0 +1,16 @@
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (c) 2023 Antmicro <www.antmicro.com>
config SOC_FAMILY_AMBIQ
bool
if SOC_FAMILY_AMBIQ
config SOC_FAMILY
string
default "ambiq"
source "soc/arm/ambiq/*/Kconfig.soc"
endif # SOC_FAMILY_AMBIQ

View file

@ -0,0 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (c) 2023 Antmicro <www.antmicro.com>
source "soc/arm/ambiq/*/Kconfig.defconfig.series"

View file

@ -0,0 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (c) 2023 Antmicro <www.antmicro.com>
source "soc/arm/ambiq/*/Kconfig.series"

View file

@ -0,0 +1,7 @@
# Copyright (c) 2023 Antmicro <www.antmicro.com>
#
# SPDX-License-Identifier: Apache-2.0
#
zephyr_sources(soc.c)
zephyr_include_directories(${ZEPHYR_BASE}/soc/arm/common/cortex_m)

View file

@ -0,0 +1,18 @@
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (c) 2023 Antmicro <www.antmicro.com>
if SOC_APOLLO4P
config NUM_IRQS
default 83
DT_NODE_SRAM := /memory@0
config SRAM_NC_SIZE
default $(dt_node_reg_size_int,$(DT_NODE_SRAM),1,K)
config SRAM_NC_BASE_ADDRESS
default $(dt_node_reg_addr_hex,$(DT_NODE_SRAM),1)
endif # SOC_APOLLO4P

View file

@ -0,0 +1,12 @@
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (c) 2023 Antmicro <www.antmicro.com>
if SOC_SERIES_APOLLO4X
source "soc/arm/ambiq/apollo4x/Kconfig.defconfig.apollo4*"
config SOC_SERIES
default "apollo4x"
endif # SOC_SERIES_APOLLO4X

View file

@ -0,0 +1,17 @@
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (c) 2023 Antmicro <www.antmicro.com>
# Ambiq Apollo4 MCU Series
config SOC_SERIES_APOLLO4X
bool "Apollo4 Series MCU"
select ARM
select CPU_CORTEX_M4
select CPU_CORTEX_M_HAS_DWT
select CPU_HAS_FPU
select SOC_FAMILY_AMBIQ
select HAS_SWO
select AMBIQ_HAL
help
Enable support for Apollo4 MCU series

View file

@ -0,0 +1,12 @@
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (c) 2023 Antmicro <www.antmicro.com>
choice
prompt "Ambiq Apollo4X Selection"
depends on SOC_SERIES_APOLLO4X
config SOC_APOLLO4P
bool "Apollo4P"
endchoice

View file

@ -0,0 +1,7 @@
/*
* Copyright (c) 2023 Antmicro <www.antmicro.com>
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/arch/arm/aarch32/cortex_m/scripts/linker.ld>

View file

@ -0,0 +1,19 @@
/*
* Copyright (c) 2023 Antmicro <www.antmicro.com>
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/init.h>
#include <am_mcu_apollo.h>
static int arm_apollo4_init(void)
{
am_hal_pwrctrl_low_power_init();
am_hal_rtc_osc_disable();
return 0;
}
SYS_INIT(arm_apollo4_init, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);

View file

@ -0,0 +1,12 @@
/*
* Copyright (c) 2023 Antmicro <www.antmicro.com>
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef __SOC_H__
#define __SOC_H__
#include <apollo4p.h>
#endif /* __SOC_H__ */