soc: renesas: Add initial support for RA6M4 SoC
- Initial support for RA6M4 SoC Signed-off-by: Duy Phuong Hoang. Nguyen <duy.nguyen.xa@renesas.com>
This commit is contained in:
parent
7c67fa131f
commit
5f4b9bb0d9
10 changed files with 518 additions and 0 deletions
12
soc/renesas/ra/ra6m4/CMakeLists.txt
Normal file
12
soc/renesas/ra/ra6m4/CMakeLists.txt
Normal file
|
@ -0,0 +1,12 @@
|
|||
# Copyright (c) 2024 Renesas Electronics Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
zephyr_include_directories(.)
|
||||
|
||||
zephyr_sources(
|
||||
soc.c
|
||||
)
|
||||
|
||||
zephyr_linker_sources(SECTIONS sections.ld)
|
||||
|
||||
set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/arm/cortex_m/scripts/linker.ld CACHE INTERNAL "")
|
15
soc/renesas/ra/ra6m4/Kconfig
Normal file
15
soc/renesas/ra/ra6m4/Kconfig
Normal file
|
@ -0,0 +1,15 @@
|
|||
# Copyright (c) 2024 Renesas Electronics Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
config SOC_SERIES_RA6M4
|
||||
select ARM
|
||||
select CPU_CORTEX_M33
|
||||
select CPU_HAS_ARM_MPU
|
||||
select HAS_RENESAS_RA_FSP
|
||||
select CLOCK_CONTROL_RENESAS_RA_CGC if CLOCK_CONTROL
|
||||
select CPU_CORTEX_M_HAS_DWT
|
||||
select CPU_HAS_FPU
|
||||
select ARMV8_M_DSP
|
||||
select FPU
|
||||
select HAS_SWO
|
||||
select XIP
|
12
soc/renesas/ra/ra6m4/Kconfig.defconfig
Normal file
12
soc/renesas/ra/ra6m4/Kconfig.defconfig
Normal file
|
@ -0,0 +1,12 @@
|
|||
# Copyright (c) 2024 Renesas Electronics Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
if SOC_SERIES_RA6M4
|
||||
|
||||
config NUM_IRQS
|
||||
default 96
|
||||
|
||||
config PINCTRL
|
||||
default y
|
||||
|
||||
endif # SOC_SERIES_RA6M4
|
20
soc/renesas/ra/ra6m4/Kconfig.soc
Normal file
20
soc/renesas/ra/ra6m4/Kconfig.soc
Normal file
|
@ -0,0 +1,20 @@
|
|||
# Copyright (c) 2024 Renesas Electronics Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
config SOC_SERIES_RA6M4
|
||||
bool
|
||||
select SOC_FAMILY_RENESAS_RA
|
||||
help
|
||||
Renesas RA6M4 series
|
||||
|
||||
config SOC_R7FA6M4AF3CFB
|
||||
bool
|
||||
select SOC_SERIES_RA6M4
|
||||
help
|
||||
R7FA6M4AF3CFB
|
||||
|
||||
config SOC_SERIES
|
||||
default "ra6m4" if SOC_SERIES_RA6M4
|
||||
|
||||
config SOC
|
||||
default "r7fa6m4af3cfb" if SOC_R7FA6M4AF3CFB
|
79
soc/renesas/ra/ra6m4/sections.ld
Normal file
79
soc/renesas/ra/ra6m4/sections.ld
Normal file
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
* Copyright (c) 2024 Renesas Electronics Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
.code_in_ram :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
__Code_In_RAM_Start = .;
|
||||
KEEP(*(.code_in_ram*))
|
||||
__Code_In_RAM_End = .;
|
||||
} > RAMABLE_REGION
|
||||
|
||||
SECTION_DATA_PROLOGUE(.fsp_dtc_vector_table,(NOLOAD),)
|
||||
{
|
||||
/* If DTC is used, put the DTC vector table at the start of SRAM.
|
||||
This avoids memory holes due to 1K alignment required by it. */
|
||||
*(.fsp_dtc_vector_table)
|
||||
} GROUP_DATA_LINK_IN(RAMABLE_REGION, RAMABLE_REGION)
|
||||
|
||||
SECTION_PROLOGUE(.option_setting_ofs,,)
|
||||
{
|
||||
__OPTION_SETTING_OFS_Start = .;
|
||||
KEEP(*(.option_setting_ofs0))
|
||||
. = __OPTION_SETTING_OFS_Start + 0x04;
|
||||
KEEP(*(.option_setting_ofs2))
|
||||
. = __OPTION_SETTING_OFS_Start + 0x10;
|
||||
KEEP(*(.option_setting_dualsel))
|
||||
__OPTION_SETTING_OFS_End = .;
|
||||
} GROUP_LINK_IN(OPTION_SETTING_OFS) = 0xFF
|
||||
|
||||
SECTION_PROLOGUE(.option_setting_sas,,)
|
||||
{
|
||||
__OPTION_SETTING_SAS_Start = .;
|
||||
KEEP(*(.option_setting_sas))
|
||||
__OPTION_SETTING_SAS_End = .;
|
||||
} GROUP_LINK_IN(OPTION_SETTING_SAS) = 0xFF
|
||||
|
||||
SECTION_PROLOGUE(.option_setting_s,,)
|
||||
{
|
||||
__OPTION_SETTING_S_Start = .;
|
||||
KEEP(*(.option_setting_ofs1_sec))
|
||||
. = __OPTION_SETTING_S_Start + 0x04;
|
||||
KEEP(*(.option_setting_ofs3_sec))
|
||||
. = __OPTION_SETTING_S_Start + 0x10;
|
||||
KEEP(*(.option_setting_banksel_sec))
|
||||
. = __OPTION_SETTING_S_Start + 0x40;
|
||||
KEEP(*(.option_setting_bps_sec0))
|
||||
. = __OPTION_SETTING_S_Start + 0x44;
|
||||
KEEP(*(.option_setting_bps_sec1))
|
||||
. = __OPTION_SETTING_S_Start + 0x48;
|
||||
KEEP(*(.option_setting_bps_sec2))
|
||||
. = __OPTION_SETTING_S_Start + 0x4C;
|
||||
KEEP(*(.option_setting_bps_sec3))
|
||||
. = __OPTION_SETTING_S_Start + 0x60;
|
||||
KEEP(*(.option_setting_pbps_sec0))
|
||||
. = __OPTION_SETTING_S_Start + 0x64;
|
||||
KEEP(*(.option_setting_pbps_sec1))
|
||||
. = __OPTION_SETTING_S_Start + 0x68;
|
||||
KEEP(*(.option_setting_pbps_sec2))
|
||||
. = __OPTION_SETTING_S_Start + 0x6C;
|
||||
KEEP(*(.option_setting_pbps_sec3))
|
||||
. = __OPTION_SETTING_S_Start + 0x80;
|
||||
KEEP(*(.option_setting_ofs1_sel))
|
||||
. = __OPTION_SETTING_S_Start + 0x84;
|
||||
KEEP(*(.option_setting_ofs3_sel))
|
||||
. = __OPTION_SETTING_S_Start + 0x90;
|
||||
KEEP(*(.option_setting_banksel_sel))
|
||||
. = __OPTION_SETTING_S_Start + 0xC0;
|
||||
KEEP(*(.option_setting_bps_sel0))
|
||||
. = __OPTION_SETTING_S_Start + 0xC4;
|
||||
KEEP(*(.option_setting_bps_sel1))
|
||||
. = __OPTION_SETTING_S_Start + 0xC8;
|
||||
KEEP(*(.option_setting_bps_sel2))
|
||||
. = __OPTION_SETTING_S_Start + 0xCC;
|
||||
KEEP(*(.option_setting_bps_sel3))
|
||||
__OPTION_SETTING_S_End = .;
|
||||
} GROUP_LINK_IN(OPTION_SETTING_S) = 0xFF
|
74
soc/renesas/ra/ra6m4/soc.c
Normal file
74
soc/renesas/ra/ra6m4/soc.c
Normal file
|
@ -0,0 +1,74 @@
|
|||
/*
|
||||
* Copyright (c) 2024 Renesas Electronics Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief System/hardware module for Renesas RA6M4 family processor
|
||||
*/
|
||||
|
||||
#include <zephyr/device.h>
|
||||
#include <zephyr/init.h>
|
||||
#include <zephyr/kernel.h>
|
||||
#include <zephyr/arch/cpu.h>
|
||||
#include <cmsis_core.h>
|
||||
#include <zephyr/irq.h>
|
||||
#include <zephyr/logging/log.h>
|
||||
LOG_MODULE_REGISTER(soc, CONFIG_SOC_LOG_LEVEL);
|
||||
|
||||
#include "bsp_cfg.h"
|
||||
#include <bsp_api.h>
|
||||
|
||||
uint32_t SystemCoreClock BSP_SECTION_EARLY_INIT;
|
||||
|
||||
volatile uint32_t g_protect_pfswe_counter BSP_SECTION_EARLY_INIT;
|
||||
|
||||
/**
|
||||
* @brief Perform basic hardware initialization at boot.
|
||||
*
|
||||
* This needs to be run from the very beginning.
|
||||
* So the init priority has to be 0 (zero).
|
||||
*
|
||||
* @return 0
|
||||
*/
|
||||
static int renesas_ra6m4_init(void)
|
||||
{
|
||||
uint32_t key;
|
||||
|
||||
key = irq_lock();
|
||||
|
||||
extern volatile uint16_t g_protect_counters[];
|
||||
|
||||
for (uint32_t i = 0; i < 4; i++) {
|
||||
g_protect_counters[i] = 0;
|
||||
}
|
||||
|
||||
#if FSP_PRIV_TZ_USE_SECURE_REGS
|
||||
/* Disable protection using PRCR register. */
|
||||
R_BSP_RegisterProtectDisable(BSP_REG_PROTECT_SAR);
|
||||
|
||||
/* Initialize peripherals to secure mode for flat projects */
|
||||
R_PSCU->PSARB = 0;
|
||||
R_PSCU->PSARC = 0;
|
||||
R_PSCU->PSARD = 0;
|
||||
R_PSCU->PSARE = 0;
|
||||
|
||||
R_CPSCU->ICUSARG = 0;
|
||||
R_CPSCU->ICUSARH = 0;
|
||||
R_CPSCU->ICUSARI = 0;
|
||||
|
||||
/* Enable protection using PRCR register. */
|
||||
R_BSP_RegisterProtectEnable(BSP_REG_PROTECT_SAR);
|
||||
#endif
|
||||
|
||||
SystemCoreClock = BSP_MOCO_HZ;
|
||||
g_protect_pfswe_counter = 0;
|
||||
|
||||
irq_unlock(key);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
SYS_INIT(renesas_ra6m4_init, PRE_KERNEL_1, 0);
|
16
soc/renesas/ra/ra6m4/soc.h
Normal file
16
soc/renesas/ra/ra6m4/soc.h
Normal file
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
* Copyright (c) 2024 Renesas Electronics Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file SoC configuration macros for the Renesas RA6M4 family MCU
|
||||
*/
|
||||
|
||||
#ifndef ZEPHYR_SOC_RENESAS_RA6M4_SOC_H_
|
||||
#define ZEPHYR_SOC_RENESAS_RA6M4_SOC_H_
|
||||
|
||||
#include <bsp_api.h>
|
||||
|
||||
#endif /* ZEPHYR_SOC_RENESAS_RA6M4_SOC_H_ */
|
|
@ -31,3 +31,6 @@ family:
|
|||
- name: ra6m2
|
||||
socs:
|
||||
- name: r7fa6m2af3cfb
|
||||
- name: ra6m4
|
||||
socs:
|
||||
- name: r7fa6m4af3cfb
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue