diff --git a/dts/arm/ambiq/ambiq_apollo4p.dtsi b/dts/arm/ambiq/ambiq_apollo4p.dtsi new file mode 100644 index 00000000000..62b5d10e7c1 --- /dev/null +++ b/dts/arm/ambiq/ambiq_apollo4p.dtsi @@ -0,0 +1,32 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +#include +#include + +/ { + 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>; +}; diff --git a/soc/arm/ambiq/CMakeLists.txt b/soc/arm/ambiq/CMakeLists.txt new file mode 100644 index 00000000000..7afff4e7ec8 --- /dev/null +++ b/soc/arm/ambiq/CMakeLists.txt @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: Apache-2.0 +# +# Copyright (c) 2023 Antmicro + +add_subdirectory(${SOC_SERIES}) + +zephyr_include_directories(.) diff --git a/soc/arm/ambiq/Kconfig b/soc/arm/ambiq/Kconfig new file mode 100644 index 00000000000..eba0a01db71 --- /dev/null +++ b/soc/arm/ambiq/Kconfig @@ -0,0 +1,16 @@ +# SPDX-License-Identifier: Apache-2.0 +# +# Copyright (c) 2023 Antmicro + +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 diff --git a/soc/arm/ambiq/Kconfig.defconfig b/soc/arm/ambiq/Kconfig.defconfig new file mode 100644 index 00000000000..bbf406f5b59 --- /dev/null +++ b/soc/arm/ambiq/Kconfig.defconfig @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 +# +# Copyright (c) 2023 Antmicro + +source "soc/arm/ambiq/*/Kconfig.defconfig.series" diff --git a/soc/arm/ambiq/Kconfig.soc b/soc/arm/ambiq/Kconfig.soc new file mode 100644 index 00000000000..e1e31309730 --- /dev/null +++ b/soc/arm/ambiq/Kconfig.soc @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 +# +# Copyright (c) 2023 Antmicro + +source "soc/arm/ambiq/*/Kconfig.series" diff --git a/soc/arm/ambiq/apollo4x/CMakeLists.txt b/soc/arm/ambiq/apollo4x/CMakeLists.txt new file mode 100644 index 00000000000..2d96101cb0b --- /dev/null +++ b/soc/arm/ambiq/apollo4x/CMakeLists.txt @@ -0,0 +1,7 @@ +# Copyright (c) 2023 Antmicro +# +# SPDX-License-Identifier: Apache-2.0 +# + +zephyr_sources(soc.c) +zephyr_include_directories(${ZEPHYR_BASE}/soc/arm/common/cortex_m) diff --git a/soc/arm/ambiq/apollo4x/Kconfig.defconfig.apollo4p b/soc/arm/ambiq/apollo4x/Kconfig.defconfig.apollo4p new file mode 100644 index 00000000000..2d672184b4b --- /dev/null +++ b/soc/arm/ambiq/apollo4x/Kconfig.defconfig.apollo4p @@ -0,0 +1,18 @@ +# SPDX-License-Identifier: Apache-2.0 +# +# Copyright (c) 2023 Antmicro + +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 diff --git a/soc/arm/ambiq/apollo4x/Kconfig.defconfig.series b/soc/arm/ambiq/apollo4x/Kconfig.defconfig.series new file mode 100644 index 00000000000..f933eb5d1c4 --- /dev/null +++ b/soc/arm/ambiq/apollo4x/Kconfig.defconfig.series @@ -0,0 +1,12 @@ +# SPDX-License-Identifier: Apache-2.0 +# +# Copyright (c) 2023 Antmicro + +if SOC_SERIES_APOLLO4X + +source "soc/arm/ambiq/apollo4x/Kconfig.defconfig.apollo4*" + +config SOC_SERIES + default "apollo4x" + +endif # SOC_SERIES_APOLLO4X diff --git a/soc/arm/ambiq/apollo4x/Kconfig.series b/soc/arm/ambiq/apollo4x/Kconfig.series new file mode 100644 index 00000000000..b7982d3609e --- /dev/null +++ b/soc/arm/ambiq/apollo4x/Kconfig.series @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: Apache-2.0 +# +# Copyright (c) 2023 Antmicro + +# 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 diff --git a/soc/arm/ambiq/apollo4x/Kconfig.soc b/soc/arm/ambiq/apollo4x/Kconfig.soc new file mode 100644 index 00000000000..215367c4855 --- /dev/null +++ b/soc/arm/ambiq/apollo4x/Kconfig.soc @@ -0,0 +1,12 @@ +# SPDX-License-Identifier: Apache-2.0 +# +# Copyright (c) 2023 Antmicro + +choice + prompt "Ambiq Apollo4X Selection" + depends on SOC_SERIES_APOLLO4X + +config SOC_APOLLO4P + bool "Apollo4P" + +endchoice diff --git a/soc/arm/ambiq/apollo4x/linker.ld b/soc/arm/ambiq/apollo4x/linker.ld new file mode 100644 index 00000000000..9c1ab8ff301 --- /dev/null +++ b/soc/arm/ambiq/apollo4x/linker.ld @@ -0,0 +1,7 @@ +/* + * Copyright (c) 2023 Antmicro + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include diff --git a/soc/arm/ambiq/apollo4x/soc.c b/soc/arm/ambiq/apollo4x/soc.c new file mode 100644 index 00000000000..30288ad12c3 --- /dev/null +++ b/soc/arm/ambiq/apollo4x/soc.c @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2023 Antmicro + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +#include + +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); diff --git a/soc/arm/ambiq/apollo4x/soc.h b/soc/arm/ambiq/apollo4x/soc.h new file mode 100644 index 00000000000..dfa86b20146 --- /dev/null +++ b/soc/arm/ambiq/apollo4x/soc.h @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2023 Antmicro + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef __SOC_H__ +#define __SOC_H__ + +#include + +#endif /* __SOC_H__ */