Skip to content

Commit d488e93

Browse files
Hau Hoquytranpzz
authored andcommitted
soc: renesas: rx: Initial support for RX261 SOC
This commit to initial support for RX261 SOC. Signed-off-by: Hau Ho <hau.ho.xc@bp.renesas.com> Signed-off-by: Phi Tran <phi.tran.jg@bp.renesas.com>
1 parent 5d7eae3 commit d488e93

File tree

9 files changed

+186
-0
lines changed

9 files changed

+186
-0
lines changed

soc/renesas/rx/rx261/CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Copyright (c) 2025 Renesas Electronics Corporation
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
zephyr_include_directories(.)
5+
6+
zephyr_sources(
7+
soc.c
8+
)
9+
10+
zephyr_linker_sources(SECTIONS ofsm.ld)
11+
12+
set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/rx/linker.ld CACHE INTERNAL "")

soc/renesas/rx/rx261/Kconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Copyright (c) 2025 Renesas Electronics Corporation
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config SOC_SERIES_RX261
5+
select RX
6+
select CPU_RXV3
7+
select XIP
8+
select CLOCK_CONTROL_RENESAS_RX_CGC if CLOCK_CONTROL
9+
select HAS_RENESAS_RX_RDP
10+
select CLOCK_CONTROL
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Copyright (c) 2025 Renesas Electronics Corporation
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
if SOC_SERIES_RX261
5+
6+
DT_CMT_PATH := $(dt_nodelabel_path,cmt)
7+
8+
config SYS_CLOCK_HW_CYCLES_PER_SEC
9+
default $(dt_node_int_prop_int,$(DT_CMT_PATH),clock-frequency)
10+
11+
# SYS_CLOCK_TICKS_PER_SEC is set to 100 if PCLKB is 48MHz or less.
12+
# (PCLKB = SYS_CLOCK_HW_CYCLES_PER_SEC * 8)
13+
config SYS_CLOCK_TICKS_PER_SEC
14+
default 100 if SYS_CLOCK_HW_CYCLES_PER_SEC <= 6000000
15+
default 1000
16+
17+
config INITIALIZATION_STACK_SIZE
18+
default 512
19+
20+
config BUILD_OUTPUT_HEX
21+
default y
22+
23+
endif # SOC_SERIES_RX261

soc/renesas/rx/rx261/Kconfig.soc

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Copyright (c) 2025 Renesas Electronics Corporation
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config SOC_SERIES_RX261
5+
bool
6+
select SOC_FAMILY_RENESAS_RX
7+
help
8+
Renesas RX261 series
9+
10+
config SOC_R5F52618BGFP
11+
bool
12+
select SOC_SERIES_RX261
13+
help
14+
SOC_R5F52618BGFP
15+
16+
config SOC_SERIES
17+
default "rx261" if SOC_SERIES_RX261
18+
19+
config SOC
20+
default "r5f52618bgfp" if SOC_R5F52618BGFP

soc/renesas/rx/rx261/ofsm.c

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* Copyright (c) 2021 KT-Elektronik, Klaucke und Partner GmbH
3+
* Copyright (c) 2025 Renesas Electronics Corporation
4+
* SPDX-License-Identifier: Apache-2.0
5+
*
6+
*
7+
* Option-Setting Memory for the RX. This region of memory (located in flash)
8+
* determines the state of the MCU after reset and can not be changed on runtime
9+
*
10+
* All registers are set to 0xffffffff by default, which are "safe" settings.
11+
* Please refer to the Renesas RX Group User's Manual before changing any of
12+
* the values as some changes can be permanent or lock access to the device.
13+
*
14+
* Address range: 0xFFFFFF80 to 0xFFFFFF8F (16 Bytes)
15+
*/
16+
17+
#define __OFS_MDE __attribute__((section(".ofs_mde")))
18+
#define __OFS0 __attribute__((section(".ofs0")))
19+
#define __OFS1 __attribute__((section(".ofs1")))
20+
21+
/* Endian Select Register (MDE)
22+
*
23+
* b2 to b0: endian select between (0 0 0) for big endian and (1 1 1) for little
24+
* endian. Set this according to __BYTE_ORDER__ (cf. include\toolchain\gcc.h)
25+
*
26+
* b6-b4 (Bank Mode Select) indicate whether the flash is operated in
27+
* Dual mode (0 0 0) or Linear mode (1 1 1).
28+
*
29+
* all other bits are reserved and have to be set to 1
30+
*/
31+
const unsigned long __OFS_MDE __MDEreg = 0xffffffffU; /* little */
32+
33+
/* Option Function Select Register 0 (OFS0) */
34+
const unsigned long __OFS0 __OFS0reg = 0xffffffffU;
35+
36+
/* Option Function Select Register 1 (OFS1) */
37+
const unsigned long __OFS1 __OFS1reg = 0xffffffffU;

soc/renesas/rx/rx261/ofsm.ld

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*
2+
* Copyright (c) 2025 Renesas Electronics Corporation
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
SECTION_PROLOGUE(.ofsm,,)
8+
{
9+
__OFSM_START = .;
10+
KEEP(*(.ofs_mde))
11+
. = __OFSM_START + 0x8;
12+
KEEP(*(.ofs1))
13+
. = __OFSM_START + 0xC;
14+
KEEP(*(.ofs0))
15+
__OFSM_END = .;
16+
} GROUP_LINK_IN(OFSM) = 0xFF

soc/renesas/rx/rx261/soc.c

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
* Copyright (c) 2025 Renesas Electronics Corporation
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/**
8+
* @brief System/hardware module for RX SOC family
9+
*/
10+
11+
#include <zephyr/device.h>
12+
#include <zephyr/init.h>
13+
#include <zephyr/kernel.h>
14+
#include <zephyr/arch/cpu.h>
15+
#include <soc.h>
16+
17+
#include "platform.h"
18+
#include "r_bsp_cpu.h"
19+
20+
/**
21+
* @brief Perform basic hardware initialization at boot.
22+
*
23+
* This needs to be run from the very beginning.
24+
* So the init priority has to be 0 (zero).
25+
*
26+
* @return 0
27+
*/
28+
void soc_early_init_hook(void)
29+
{
30+
#ifdef CONFIG_HAS_RENESAS_RX_RDP
31+
bsp_ram_initialize();
32+
bsp_interrupt_open();
33+
bsp_register_protect_open();
34+
#if CONFIG_RENESAS_NONE_USED_PORT_INIT == 1
35+
/*
36+
* This is the function that initializes the unused port.
37+
* Please see datails on this in the "Handling of Unused Pins" section of PORT chapter
38+
* of RX MCU of User's manual.
39+
* And please MUST set "BSP_PACKAGE_PINS" definition to your device of pin type in
40+
* r_bsp_config.h Otherwise, the port may output without intention.
41+
*/
42+
bsp_non_existent_port_init();
43+
44+
#endif /* CONFIG_RENESAS_NONE_USED_PORT_INIT */
45+
#else
46+
renesas_rx_register_protect_open();
47+
#endif /* CONFIG_HAS_RENESAS_RX_RDP */
48+
}

soc/renesas/rx/rx261/soc.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/*
2+
* Copyright (c) 2025 Renesas Electronics Corporation
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/**
8+
* @brief SOC header file for Renesas RX SOC series
9+
*/
10+
11+
#ifndef _SOC_H_
12+
#define _SOC_H_
13+
14+
#include "reg_protection.h"
15+
#include <mcu_clocks.h>
16+
17+
#endif /* _SOC_H_ */

soc/renesas/rx/soc.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@ family:
77
- name: rx62n
88
socs:
99
- name: r5f562n8
10+
- name: rx261
11+
socs:
12+
- name: r5f52618bgfp

0 commit comments

Comments
 (0)