soc: ambiq: apollo2: Add support for Apollo2 SoC

Added SoC series for the Ambiq Apollo2 SoC.

Signed-off-by: Sri Surya <srisurya@linumiz.com>
This commit is contained in:
Sri Surya
2025-06-30 00:59:53 +05:30
committed by Benjamin Cabé
parent ad322030a2
commit 358c113a96
9 changed files with 109 additions and 6 deletions

View File

@@ -2,10 +2,11 @@
#
# Copyright (c) 2023 Antmicro <www.antmicro.com>
# Copyright (c) 2025, Ambiq Micro Inc. <www.ambiq.com>
# Copyright (c) 2025, Linumiz GmbH
#
config AMBIQ_HAL
bool "Ambiq HAL drivers support"
depends on SOC_SERIES_APOLLO3X || SOC_SERIES_APOLLO4X || SOC_SERIES_APOLLO5X
depends on SOC_SERIES_APOLLO2X || SOC_SERIES_APOLLO3X || SOC_SERIES_APOLLO4X || SOC_SERIES_APOLLO5X
help
Use the Ambiq HAL

View File

@@ -0,0 +1,9 @@
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (c) 2025 Linumiz GmbH
# Author : Sri Surya <srisurya@linumiz.com>
zephyr_sources(soc.c)
zephyr_include_directories(.)
set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/arm/cortex_m/scripts/linker.ld CACHE INTERNAL "")

View File

@@ -0,0 +1,14 @@
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (c) 2025 Linumiz GmbH
# Author : Sri Surya <srisurya@linumiz.com>
config SOC_SERIES_APOLLO2X
select ARM
select CPU_CORTEX_M4
select CPU_CORTEX_M_HAS_DWT
select CPU_HAS_FPU
select CPU_HAS_ARM_MPU
select HAS_SWO
select AMBIQ_HAL
select SOC_EARLY_INIT_HOOK

View File

@@ -0,0 +1,16 @@
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (c) 2025 Linumiz GmbH
# Author : Sri Surya <srisurya@linumiz.com>
if SOC_APOLLO2
config NUM_IRQS
default 32
DT_CLK_SYS_PATH := $(dt_nodelabel_path,sys_clk)
config SYS_CLOCK_HW_CYCLES_PER_SEC
default $(dt_node_int_prop_int,$(DT_CLK_SYS_PATH),clock-frequency)
endif

View File

@@ -0,0 +1,22 @@
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (c) 2025 Linumiz GmbH
# Author : Sri Surya <srisurya@linumiz.com>
config SOC_SERIES_APOLLO2X
bool
select SOC_FAMILY_AMBIQ
help
Apollo2 Series MCU
config SOC_APOLLO2
bool
select SOC_SERIES_APOLLO2X
help
Apollo2
config SOC_SERIES
default "apollo2x" if SOC_SERIES_APOLLO2X
config SOC
default "apollo2" if SOC_APOLLO2

24
soc/ambiq/apollo2x/soc.c Normal file
View File

@@ -0,0 +1,24 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright (c) 2025 Linumiz GmbH
* Author: Sri Surya <srisurya@linumiz.com>
*/
#include <zephyr/init.h>
#include <soc.h>
void soc_early_init_hook(void)
{
/* Set the clock frequency.*/
am_hal_clkgen_sysclk_select(AM_HAL_CLKGEN_SYSCLK_MAX);
/* Enable Flash cache.*/
am_hal_cachectrl_enable(&am_hal_cachectrl_defaults);
/* Initialize for low power in the power control block */
am_hal_pwrctrl_low_power_init();
/* Disable the RTC. */
am_hal_rtc_osc_disable();
}

14
soc/ambiq/apollo2x/soc.h Normal file
View File

@@ -0,0 +1,14 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright (c) 2025 Linumiz GmbH
* Author: Sri Surya <srisurya@linumiz.com>
*/
#ifndef __SOC_H__
#define __SOC_H__
/*required in soc.c and pinctrl_ambiq.c*/
#include <am_mcu_apollo.h>
#endif /* __SOC_H__ */

View File

@@ -1,14 +1,17 @@
family:
- name: ambiq
series:
- name: apollo4x
- name: apollo2x
socs:
- name: apollo4p
- name: apollo4p_blue
- name: apollo2
- name: apollo3x
socs:
- name: apollo3_blue
- name: apollo3p_blue
- name: apollo4x
socs:
- name: apollo4p
- name: apollo4p_blue
- name: apollo5x
socs:
- name: apollo510

View File

@@ -154,7 +154,7 @@ manifest:
groups:
- hal
- name: hal_ambiq
revision: e9212585cd7c4e1cc189f7d530b8a028d5e8ecf5
revision: 5546a303ac04b7bc728b2c92ff1b1009ea795a22
path: modules/hal/ambiq
groups:
- hal