Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions bsp/qemu-virt64-riscv/.config
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,6 @@ CONFIG_RT_DFS_ELM_MUTEX_TIMEOUT=3000

CONFIG_RT_USING_DFS_DEVFS=y
CONFIG_RT_USING_DFS_ROMFS=y
# CONFIG_RT_USING_DFS_ROMFS_USER_ROOT is not set
# CONFIG_RT_USING_DFS_CROMFS is not set
# CONFIG_RT_USING_DFS_TMPFS is not set
# CONFIG_RT_USING_DFS_MQUEUE is not set
Expand Down Expand Up @@ -1434,7 +1433,6 @@ CONFIG_RT_USING_ADT_REF=y
#
# RISC-V QEMU virt64 configs
#
CONFIG_RISCV_S_MODE=y
CONFIG_BSP_USING_VIRTIO=y
CONFIG_BSP_USING_VIRTIO_BLK=y
CONFIG_BSP_USING_VIRTIO_NET=y
Expand Down
4 changes: 0 additions & 4 deletions bsp/qemu-virt64-riscv/driver/Kconfig
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
menu "RISC-V QEMU virt64 configs"

config RISCV_S_MODE
bool "RT-Thread run in RISC-V S-Mode(supervisor mode)"
default y

config BSP_USING_VIRTIO
bool "Using VirtIO"
default y
Expand Down
1 change: 0 additions & 1 deletion bsp/qemu-virt64-riscv/rtconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,6 @@

/* RISC-V QEMU virt64 configs */

#define RISCV_S_MODE
#define BSP_USING_VIRTIO
#define BSP_USING_VIRTIO_BLK
#define BSP_USING_VIRTIO_NET
Expand Down
53 changes: 24 additions & 29 deletions bsp/renesas/libraries/HAL_Drivers/drv_gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* Date Author Notes
* 2021-07-29 KyleChan first version
* 2022-01-19 Sherman add PIN2IRQX_TABLE
* 2025-01-13 newflydd pin_get for RZ
*/

#include <drv_gpio.h>
Expand Down Expand Up @@ -304,37 +305,31 @@ static rt_err_t ra_pin_dettach_irq(struct rt_device *device, rt_base_t pin)

static rt_base_t ra_pin_get(const char *name)
{
int pin_number = -1, port = -1, pin = -1;

if (rt_strlen(name) != 4)
return -1;

if ((name[0] == 'P' || name[0] == 'p'))
#ifdef SOC_FAMILY_RENESAS_RZ
/* RZ series: use "PXX_X" format, like "P01_1" */
if ((rt_strlen(name) == 5) &&
((name[0] == 'P') || (name[0] == 'p')) &&
(name[3] == '_') &&
('0' <= (int) name[1] && (int) name[1] <= '1') &&
('0' <= (int) name[2] && (int) name[2] <= '9') &&
('0' <= (int) name[4] && (int) name[4] <= '7'))
{
if ('0' <= name[1] && name[1] <= '9')
{
port = (name[1] - '0') * 16 * 16;
if ('0' <= name[2] && name[2] <= '9' && '0' <= name[3] && name[3] <= '9')
{
pin = (name[2] - '0') * 10 + (name[3] - '0');
pin_number = port + pin;

return pin_number;
}
}
else if ('A' <= name[1] && name[1] <= 'Z')
{
port = (name[1] - '0' - 7) * 16 * 16;
if ('0' <= name[2] && name[2] <= '9' && '0' <= name[3] && name[3] <= '9')
{
pin = (name[2] - '0') * 10 + (name[3] - '0');
pin_number = port + pin;

return pin_number;
}
}
return (((int) name[1] - '0') * 10 + ((int) name[2] - '0')) * 0x100 + ((int) name[4] - '0');
}
LOG_W("Invalid pin expression, use `PXX_X` format like `P01_1`");
#else
/* RA series: use "PXXX" format, like "P101"*/
if ((rt_strlen(name) == 4) &&
(name[0] == 'P' || name[0] == 'p') &&
(name[1] >= '0' && name[1] <= '9') &&
(name[2] >= '0' && name[1] <= '9') &&
(name[3] >= '0' && name[1] <= '9'))
{
return (name[1] - '0') * 0x100 + (name[2] - '0') * 10 + (name[3] - '0');
}
return -1;
LOG_W("Invalid pin expression, use `PXXX` format like `P101`");
#endif
return -RT_ERROR;
}

const static struct rt_pin_ops _ra_pin_ops =
Expand Down
4 changes: 4 additions & 0 deletions bsp/renesas/libraries/HAL_Drivers/drv_sci.c
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,11 @@ static int ra_uart_putc(struct rt_serial_device *serial, char c)
sci_uart_instance_ctrl_t *p_ctrl = (sci_uart_instance_ctrl_t *)param->sci_ctrl;

p_ctrl->p_reg->TDR = c;
#ifdef SOC_SERIES_R9A07G0
while ((p_ctrl->p_reg->CSR_b.TEND) == 0);
#else
while ((p_ctrl->p_reg->SSR_b.TEND) == 0);
#endif

return RT_EOK;
}
Expand Down
26 changes: 12 additions & 14 deletions bsp/renesas/libraries/Kconfig
Original file line number Diff line number Diff line change
@@ -1,52 +1,50 @@

config SOC_FAMILY_RENESAS
config SOC_FAMILY_RENESAS_RA
bool
default n

config SOC_FAMILY_RENESAS_RZ
bool
default n

config SOC_SERIES_R7FA6M3
bool
select ARCH_ARM_CORTEX_M4
select SOC_FAMILY_RENESAS
select SOC_FAMILY_RENESAS_RA
default n

config SOC_SERIES_R7FA6M4
bool
select ARCH_ARM_CORTEX_M4
select SOC_FAMILY_RENESAS
select SOC_FAMILY_RENESAS_RA
default n

config SOC_SERIES_R7FA2L1
bool
select ARCH_ARM_CORTEX_M23
select SOC_FAMILY_RENESAS
select SOC_FAMILY_RENESAS_RA
default n

config SOC_SERIES_R7FA6M5
bool
select ARCH_ARM_CORTEX_M33
select SOC_FAMILY_RENESAS
select SOC_FAMILY_RENESAS_RA
default n

config SOC_SERIES_R7FA4M2
bool
select ARCH_ARM_CORTEX_M4
select SOC_FAMILY_RENESAS
select SOC_FAMILY_RENESAS_RA
default n

config SOC_SERIES_R7FA8M85
bool
select ARCH_ARM_CORTEX_M85
select SOC_FAMILY_RENESAS
select SOC_FAMILY_RENESAS_RA
default n

config SOC_SERIES_R9A07G0
bool
select ARCH_ARM_CORTEX_R52
select SOC_FAMILY_RENESAS
default n

config SOC_SERIES_R7FA6E2
bool
select ARCH_ARM_CORTEX_M33
select SOC_FAMILY_RENESAS
select SOC_FAMILY_RENESAS_RZ
default n
1 change: 1 addition & 0 deletions components/dfs/dfs_v2/filesystems/devfs/devfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ static int dfs_devfs_open(struct dfs_file *file)
}
}
}
rt_free(device_name);
}

return ret;
Expand Down
13 changes: 13 additions & 0 deletions components/utilities/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,19 @@ config RT_USING_UTEST
config UTEST_THR_PRIORITY
int "The utest thread priority"
default 20

config RT_UTEST_USING_AUTO_RUN
bool "Enable auto run test cases"
default n
help
If enable this option, the test cases will be run automatically when board boot up.

config RT_UTEST_USING_ALL_CASES
bool "Enable all selected modules' test cases"
default n
help
If enable this option, all selected modules' test cases will be run.
Otherwise, only the test cases that are explicitly enabled will be run.
endif

config RT_USING_VAR_EXPORT
Expand Down
8 changes: 4 additions & 4 deletions components/utilities/utest/utest.c
Original file line number Diff line number Diff line change
Expand Up @@ -316,15 +316,15 @@ static void utest_thread_create(const char *utest_name)
}
}

#ifdef RT_USING_CI_ACTION
static int utest_ci_action(void)
#ifdef RT_UTEST_USING_AUTO_RUN
static int utest_auto_run(void)
{
tc_loop = 1;
utest_thread_create(RT_NULL);
return RT_EOK;
}
INIT_APP_EXPORT(utest_ci_action);
#endif /* RT_USING_CI_ACTION */
INIT_APP_EXPORT(utest_auto_run);
#endif /* RT_UTEST_USING_AUTO_RUN */

int utest_testcase_run(int argc, char** argv)
{
Expand Down
2 changes: 1 addition & 1 deletion libcpu/risc-v/common64/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

| 选项 | 默认值 | 说明 |
| --------------- | --- | ---------------------------------------------------------------------------------------------------- |
| RISCV_S_MODE | 打开 | 系统启动后是否运行在S态,关闭时系统将运行在M态;目前系统存在bug尚不可直接运行在M态,故此开关必须打开 |
| RISCV_VIRT64_S_MODE | 打开 | 系统启动后是否运行在S态,关闭时系统将运行在M态;目前系统存在bug尚不可直接运行在M态,故此开关必须打开 |
| RT_USING_SMART | 关闭 | 是否开启RTThread SMART版本,开启后系统运行在S+U态,且会开启MMU页表(satp);关闭时系统仅运行在S态,MMU关闭(satp为bare translation) |
| ARCH_USING_ASID | 关闭 | MMU是否支持asid |

Expand Down
2 changes: 1 addition & 1 deletion libcpu/risc-v/virt64/plic.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ void plic_irq_enable(int irq)
{
int hart = __raw_hartid();
*(uint32_t *)PLIC_ENABLE(hart) = ((*(uint32_t *)PLIC_ENABLE(hart)) | (1 << irq));
#ifdef RISCV_S_MODE
#ifdef RISCV_VIRT64_S_MODE
set_csr(sie, read_csr(sie) | MIP_SEIP);
#else
set_csr(mie, read_csr(mie) | MIP_MEIP);
Expand Down
5 changes: 4 additions & 1 deletion libcpu/risc-v/virt64/plic.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ extern size_t plic_base;
#define PLIC_ENABLE_STRIDE 0x80
#define PLIC_CONTEXT_STRIDE 0x1000

#ifndef RISCV_S_MODE
/* RT-Thread runs in S-mode on virt64 by default */
#define RISCV_VIRT64_S_MODE

#ifndef RISCV_VIRT64_S_MODE
#define PLIC_MENABLE_OFFSET (0x2000)
#define PLIC_MTHRESHOLD_OFFSET (0x200000)
#define PLIC_MCLAIM_OFFSET (0x200004)
Expand Down
2 changes: 2 additions & 0 deletions src/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,8 @@ menuconfig RT_USING_DEBUG
config RT_USING_CI_ACTION
bool "Enable CI Action build mode"
select RT_USING_UTEST
select RT_UTEST_USING_AUTO_RUN
select RT_UTEST_USING_ALL_CASES
default n
help
Identify that the environment is CI Action.
Expand Down
2 changes: 1 addition & 1 deletion src/klibc/utest/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ from building import *

src = []

if GetDepend('RT_USING_CI_ACTION') or GetDepend('RT_UTEST_TC_USING_KLIBC'):
if GetDepend('RT_UTEST_USING_ALL_CASES') or GetDepend('RT_UTEST_TC_USING_KLIBC'):
src += Glob('TC_*.c')

group = DefineGroup('utestcases', src, depend = [''])
Expand Down
19 changes: 10 additions & 9 deletions tools/building.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,15 +210,16 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [
envm = utils.ImportModule('env_utility')
# from env import GetSDKPath
exec_path = envm.GetSDKPath(rtconfig.CC)
if 'gcc' in rtconfig.CC:
exec_path = os.path.join(exec_path, 'bin')

if os.path.exists(exec_path):
Env['log'].debug('set CC to ' + exec_path)
rtconfig.EXEC_PATH = exec_path
os.environ['RTT_EXEC_PATH'] = exec_path
else:
Env['log'].debug('No Toolchain found in path(%s).' % exec_path)
if exec_path != None:
if 'gcc' in rtconfig.CC:
exec_path = os.path.join(exec_path, 'bin')

if os.path.exists(exec_path):
Env['log'].debug('set CC to ' + exec_path)
rtconfig.EXEC_PATH = exec_path
os.environ['RTT_EXEC_PATH'] = exec_path
else:
Env['log'].debug('No Toolchain found in path(%s).' % exec_path)
except Exception as e:
# detect failed, ignore
Env['log'].debug(e)
Expand Down
12 changes: 11 additions & 1 deletion tools/env_utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,15 @@ def GetSDKPath(name):
sdk_pkgs = GetSDKPackagePath()

if sdk_pkgs:
# read env/tools/scripts/sdk_cfg.json for curstomized SDK path
if os.path.exists(os.path.join(sdk_pkgs, '..', 'sdk_cfg.json')):
with open(os.path.join(sdk_pkgs, '..', 'sdk_cfg.json'), 'r', encoding='utf-8') as f:
sdk_cfg = json.load(f)
for item in sdk_cfg:
if item['name'] == name:
sdk = os.path.join(sdk_pkgs, item['path'])
return sdk

# read packages.json under env/tools/scripts/packages
with open(os.path.join(sdk_pkgs, 'pkgs.json'), 'r', encoding='utf-8') as f:
# packages_json = f.read()
Expand All @@ -68,7 +77,8 @@ def GetSDKPath(name):
package = json.load(f)

if package['name'] == name:
return os.path.join(sdk_pkgs, package['name'] + '-' + item['ver'])
sdk = os.path.join(sdk_pkgs, package['name'] + '-' + item['ver'])
return sdk

# not found named package
return None
Expand Down
Loading