Skip to content

Commit a9c648c

Browse files
committed
soc: add realtek amebadplus SOC integration
Add initial version of Amebadplus Soc integration Signed-off-by: zjian zhang <zjian_zhang@realsil.com.cn>
1 parent b1a7de2 commit a9c648c

24 files changed

+1009
-0
lines changed

soc/realtek/ameba/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Copyright (c) 2024 Realtek Semiconductor Corp.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
zephyr_include_directories(common)
5+
6+
add_subdirectory(common)
7+
add_subdirectory(${CONFIG_SOC})

soc/realtek/ameba/Kconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Copyright (c) 2024 Realtek Semiconductor Corp.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config SOC_FAMILY_REALTEK_AMEBA
5+
select BUILD_OUTPUT_HEX
6+
select SOC_EARLY_INIT_HOOK
7+
8+
if SOC_FAMILY_REALTEK_AMEBA
9+
10+
rsource "*/Kconfig"
11+
12+
endif # SOC_FAMILY_REALTEK_AMEBA

soc/realtek/ameba/Kconfig.defconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Copyright (c) 2024 Realtek Semiconductor Corp.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
if SOC_FAMILY_REALTEK_AMEBA
5+
6+
rsource "*/Kconfig.defconfig"
7+
8+
endif # SOC_FAMILY_REALTEK_AMEBA

soc/realtek/ameba/Kconfig.soc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Copyright (c) 2024 Realtek Semiconductor Corp.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config SOC_FAMILY_REALTEK_AMEBA
5+
bool
6+
7+
config SOC_FAMILY
8+
default "realtek_ameba" if SOC_FAMILY_REALTEK_AMEBA
9+
10+
rsource "*/Kconfig.soc"
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Copyright (c) 2024 Realtek Semiconductor Corp.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
zephyr_include_directories(${ZEPHYR_BASE}/drivers)
5+
zephyr_include_directories(.)
6+
7+
zephyr_sources(soc.c)
8+
9+
zephyr_linker_sources(SECTIONS boot_section.ld)
10+
set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/arm/cortex_m/scripts/linker.ld CACHE INTERNAL "")

soc/realtek/ameba/amebadplus/Kconfig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Copyright (c) 2024 Realtek Semiconductor Corp.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config SOC_AMEBADPLUS
5+
select ARM
6+
select CPU_CORTEX_M55
7+
select CPU_HAS_DCACHE
8+
select CPU_HAS_ICACHE
9+
select CPU_HAS_ARM_SAU
10+
select CPU_HAS_FPU
11+
select CPU_HAS_VFP
12+
select ARMV8_M_DSP
13+
select CPU_HAS_ARM_MPU
14+
select ARM_MPU
15+
select ARM_TRUSTZONE_M
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Copyright (c) 2024 Realtek Semiconductor Corp.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
if SOC_AMEBADPLUS
5+
6+
config NUM_IRQS
7+
default 96
8+
9+
config SYS_CLOCK_HW_CYCLES_PER_SEC
10+
default $(dt_node_int_prop_int,/clocks/clk_sys,clock-frequency)
11+
12+
config CACHE_MANAGEMENT
13+
default y
14+
15+
endif #SOC_AMEBADPLUS
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Copyright (c) 2024 Realtek Semiconductor Corp.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config SOC_AMEBADPLUS
5+
bool
6+
select SOC_FAMILY_REALTEK_AMEBA
7+
8+
config SOC
9+
default "amebadplus" if SOC_AMEBADPLUS
10+
11+
config ARM_CORE_CM4
12+
bool
13+
default y if SOC_AMEBADPLUS
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* Copyright (c) 2024 Realtek Semiconductor Corp.
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
SECTION_PROLOGUE(.ram_image2.entry,,SUBALIGN(32))
8+
{
9+
__image2_entry_func__ = .;
10+
KEEP(*(SORT(.image2.entry.data*)))
11+
. = ALIGN(32);
12+
} GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
13+
14+
SECTION_PROLOGUE(.psram_image2.text.data,,SUBALIGN(32))
15+
{
16+
. = ALIGN (32);
17+
__ipc_table_start__ = .;
18+
KEEP(*(*.ipc.table.data*))
19+
__ipc_table_end__ = .;
20+
} GROUP_LINK_IN(ROMABLE_REGION)

soc/realtek/ameba/amebadplus/soc.c

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* Copyright (c) 2024 Realtek Semiconductor Corp.
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
#include <soc.h>
7+
#include <ameba_soc.h>
8+
9+
#include <zephyr/device.h>
10+
#include <zephyr/init.h>
11+
#include <zephyr/kernel.h>
12+
#include <zephyr/cache.h>
13+
14+
void z_arm_reset(void);
15+
16+
IMAGE2_ENTRY_SECTION
17+
RAM_START_FUNCTION Img2EntryFun0 = {z_arm_reset, NULL, /* BOOT_RAM_WakeFromPG, */
18+
(uint32_t)NewVectorTable};
19+
20+
void soc_early_init_hook(void)
21+
{
22+
/*
23+
* Cache is enabled by default at reset, disable it before
24+
* sys_cache*-functions can enable them.
25+
*/
26+
Cache_Enable(DISABLE);
27+
sys_cache_instr_enable();
28+
sys_cache_data_enable();
29+
30+
XTAL_INIT();
31+
32+
if (SYSCFG_CHIPType_Get() == CHIP_TYPE_ASIC_POSTSIM) { /* Only Asic need OSC Calibration */
33+
OSC4M_Init();
34+
OSC4M_Calibration(30000);
35+
if ((((BOOT_Reason()) & AON_BIT_RSTF_DSLP) == FALSE)) {
36+
OSC131K_Calibration(30000); /* PPM=30000=3% */ /* 7.5ms */
37+
}
38+
}
39+
}

0 commit comments

Comments
 (0)