Skip to content

Commit 5bcf7da

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 c8a2915 commit 5bcf7da

File tree

9 files changed

+194
-0
lines changed

9 files changed

+194
-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: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
int "Initialization stack size (in bytes)"
19+
default 512
20+
21+
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: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
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: 0xFE7F5D00 to 0xFE7F5D7F (128 Bytes)
15+
*/
16+
17+
#define __OFS_MDE __attribute__((section(".ofs_mde")))
18+
19+
/* Endian Select Register (MDE) at 0xFE7F5D00
20+
*
21+
* b2 to b0: endian select between (0 0 0) for big endian and (1 1 1) for little
22+
* endian. Set this according to __BYTE_ORDER__ (cf. include\toolchain\gcc.h)
23+
*
24+
* b6-b4 (Bank Mode Select) indicate whether the flash is operated in
25+
* Dual mode (0 0 0) or Linear mode (1 1 1).
26+
*
27+
* all other bits are reserved and have to be set to 1
28+
*/
29+
const unsigned long __OFS_MDE __MDEreg = 0xffffffff; /* little */
30+
31+
struct st_ofs0 {
32+
unsigned long res0: 1;
33+
unsigned long IWDTSTRT: 1;
34+
unsigned long IWDTTOPS: 2;
35+
unsigned long IWDTCKS: 4;
36+
unsigned long IWDTRPES: 2;
37+
unsigned long IWDTRPSS: 2;
38+
unsigned long IWDTRSTIRQS: 1;
39+
unsigned long res1: 1;
40+
unsigned long IWDTSLCSTP: 1;
41+
unsigned long res2: 16;
42+
};
43+
44+
const unsigned long __OFS_MDE __OFS0reg = 0xffffffff;
45+
46+
/* Option Function Select Register 1 (OFS1) at 0xFE7F5D08 (Voltage detection and
47+
* HOCO)
48+
*/
49+
const unsigned long __OFS_MDE __OFS1reg = 0xffffffff;

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: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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_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_NONE_USED_PORT_INIT */
45+
#endif /* CONFIG_HAS_RENESAS_RX_RDP */
46+
}

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)