Skip to content

Commit

Permalink
soc: arm: ambiq: apollo4: Add support for Apollo4 Plus SoC
Browse files Browse the repository at this point in the history
Add all required parts (new SoC family/series, device tree) for
the Ambiq Apollo4 Plus SoC.

Signed-off-by: Maciej Sobkowski <msobkowski@antmicro.com>
  • Loading branch information
msobkowski authored and pull[bot] committed Feb 10, 2024
1 parent e321709 commit ca554e9
Show file tree
Hide file tree
Showing 13 changed files with 169 additions and 0 deletions.
32 changes: 32 additions & 0 deletions dts/arm/ambiq/ambiq_apollo4p.dtsi
Original file line number Diff line number Diff line change
@@ -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>;
};
7 changes: 7 additions & 0 deletions soc/arm/ambiq/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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 changes: 16 additions & 0 deletions soc/arm/ambiq/Kconfig
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions soc/arm/ambiq/Kconfig.defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (c) 2023 Antmicro <www.antmicro.com>

source "soc/arm/ambiq/*/Kconfig.defconfig.series"
5 changes: 5 additions & 0 deletions soc/arm/ambiq/Kconfig.soc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (c) 2023 Antmicro <www.antmicro.com>

source "soc/arm/ambiq/*/Kconfig.series"
7 changes: 7 additions & 0 deletions soc/arm/ambiq/apollo4x/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
18 changes: 18 additions & 0 deletions soc/arm/ambiq/apollo4x/Kconfig.defconfig.apollo4p
Original file line number Diff line number Diff line change
@@ -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
12 changes: 12 additions & 0 deletions soc/arm/ambiq/apollo4x/Kconfig.defconfig.series
Original file line number Diff line number Diff line change
@@ -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
17 changes: 17 additions & 0 deletions soc/arm/ambiq/apollo4x/Kconfig.series
Original file line number Diff line number Diff line change
@@ -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
12 changes: 12 additions & 0 deletions soc/arm/ambiq/apollo4x/Kconfig.soc
Original file line number Diff line number Diff line change
@@ -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
7 changes: 7 additions & 0 deletions soc/arm/ambiq/apollo4x/linker.ld
Original file line number Diff line number Diff line change
@@ -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>
19 changes: 19 additions & 0 deletions soc/arm/ambiq/apollo4x/soc.c
Original file line number Diff line number Diff line change
@@ -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);
12 changes: 12 additions & 0 deletions soc/arm/ambiq/apollo4x/soc.h
Original file line number Diff line number Diff line change
@@ -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__ */

0 comments on commit ca554e9

Please sign in to comment.