Skip to content

Conversation

@hywing
Copy link
Contributor

@hywing hywing commented Sep 28, 2025

拉取/合并请求描述:(PR description)

[

为什么提交这份PR (why to submit this PR)

add a new bsp for ra4m1-ek board

你的解决方案是什么 (what is your solution)

add ra4m1 mcu bsp files

请提供验证的bsp和config (provide the config and bsp)

  • BSP: bsp/renesas/ra4m1-ek
  • .config:

]

当前拉取/合并请求的状态 Intent for your PR

必须选择一项 Choose one (Mandatory):

  • 本拉取/合并请求是一个草稿版本 This PR is for a code-review and is intended to get feedback
  • 本拉取/合并请求是一个成熟版本 This PR is mature, and ready to be integrated into the repo

代码质量 Code Quality:

我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:

  • 已经仔细查看过代码改动的对比 Already check the difference between PR and old code
  • 代码风格正确,包括缩进空格,命名及其他风格 Style guide is adhered to, including spacing, naming and other styles
  • 没有垃圾代码,代码尽量精简,不包含#if 0代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up
  • 所有变更均有原因及合理的,并且不会影响到其他软件组件代码或BSP All modifications are justified and not affect other components or BSP
  • 对难懂代码均提供对应的注释 I've commented appropriately where code is tricky
  • 代码是高质量的 Code in this PR is of high quality
  • 已经使用formatting 等源码格式化工具确保格式符合RT-Thread代码规范 This PR complies with RT-Thread code specification
  • 如果是新增bsp, 已经添加ci检查到.github/ALL_BSP_COMPILE.json 详细请参考链接BSP自查

@github-actions
Copy link

👋 感谢您对 RT-Thread 的贡献!Thank you for your contribution to RT-Thread!

为确保代码符合 RT-Thread 的编码规范,请在你的仓库中执行以下步骤运行代码格式化工作流(如果格式化CI运行失败)。
To ensure your code complies with RT-Thread's coding style, please run the code formatting workflow by following the steps below (If the formatting of CI fails to run).


🛠 操作步骤 | Steps

  1. 前往 Actions 页面 | Go to the Actions page
    点击进入工作流 → | Click to open workflow →

  2. 点击 Run workflow | Click Run workflow

  • 设置需排除的文件/目录(目录请以"/"结尾)
    Set files/directories to exclude (directories should end with "/")
  • 将目标分支设置为 \ Set the target branch to:ra4m1-ek
  • 设置PR number为 \ Set the PR number to:10755
  1. 等待工作流完成 | Wait for the workflow to complete
    格式化后的代码将自动推送至你的分支。
    The formatted code will be automatically pushed to your branch.

完成后,提交将自动更新至 ra4m1-ek 分支,关联的 Pull Request 也会同步更新。
Once completed, commits will be pushed to the ra4m1-ek branch automatically, and the related Pull Request will be updated.

如有问题欢迎联系我们,再次感谢您的贡献!💐
If you have any questions, feel free to reach out. Thanks again for your contribution!

@github-actions github-actions bot added BSP action github action yml imporve BSP: Renesas BSP related with Renesas labels Sep 28, 2025
@github-actions
Copy link

github-actions bot commented Sep 28, 2025

📌 Code Review Assignment

🏷️ Tag: bsp_renesas

Reviewers: kurisaW

Changed Files (Click to expand)
  • bsp/renesas/libraries/HAL_Drivers/drivers/config/drv_config.h
  • bsp/renesas/libraries/HAL_Drivers/drivers/config/ra4m1/adc_config.h
  • bsp/renesas/libraries/HAL_Drivers/drivers/config/ra4m1/can_config.h
  • bsp/renesas/libraries/HAL_Drivers/drivers/config/ra4m1/dac_config.h
  • bsp/renesas/libraries/HAL_Drivers/drivers/config/ra4m1/pwm_config.h
  • bsp/renesas/libraries/HAL_Drivers/drivers/config/ra4m1/uart_config.h
  • bsp/renesas/libraries/HAL_Drivers/drivers/drv_can.c
  • bsp/renesas/libraries/Kconfig
  • bsp/renesas/ra4m1-ek/.api_xml
  • bsp/renesas/ra4m1-ek/.config
  • bsp/renesas/ra4m1-ek/.gitignore
  • bsp/renesas/ra4m1-ek/.ignore_format.yml
  • bsp/renesas/ra4m1-ek/.secure_azone
  • bsp/renesas/ra4m1-ek/.secure_rzone
  • bsp/renesas/ra4m1-ek/.secure_xml
  • bsp/renesas/ra4m1-ek/.settings/standalone.prefs
  • bsp/renesas/ra4m1-ek/Kconfig
  • bsp/renesas/ra4m1-ek/README.md
  • bsp/renesas/ra4m1-ek/SConscript
  • bsp/renesas/ra4m1-ek/SConstruct
  • bsp/renesas/ra4m1-ek/board/Kconfig
  • bsp/renesas/ra4m1-ek/board/SConscript
  • bsp/renesas/ra4m1-ek/board/board.h
  • bsp/renesas/ra4m1-ek/board/ports/SConscript
  • bsp/renesas/ra4m1-ek/board/ports/fal_cfg.h
  • bsp/renesas/ra4m1-ek/board/ports/gpio_cfg.h
  • bsp/renesas/ra4m1-ek/buildinfo.gpdsc
  • bsp/renesas/ra4m1-ek/configuration.xml
  • bsp/renesas/ra4m1-ek/docs/picture/RASC.png

🏷️ Tag: workflow

Reviewers: Rbb666 kurisaW supperthomas

Changed Files (Click to expand)
  • .github/ALL_BSP_COMPILE.json

📊 Current Review Status (Last Updated: 2025-10-14 15:33 CST)

  • Rbb666 Pending Review
  • kurisaW Pending Review
  • supperthomas Pending Review

📝 Review Instructions

  1. 维护者可以通过单击此处来刷新审查状态: 🔄 刷新状态
    Maintainers can refresh the review status by clicking here: 🔄 Refresh Status

  2. 确认审核通过后评论 LGTM/lgtm
    Comment LGTM/lgtm after confirming approval

  3. PR合并前需至少一位维护者确认
    PR must be confirmed by at least one maintainer before merging

ℹ️ 刷新CI状态操作需要具备仓库写入权限。
ℹ️ Refresh CI status operation requires repository Write permission.

@Rbb666 Rbb666 requested a review from Copilot September 28, 2025 01:28
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a new Board Support Package (BSP) for the Renesas RA4M1-EK evaluation board, introducing CMSIS 6 core header files and compiler-specific implementations for Cortex-M cores.

Key changes include:

  • Addition of CMSIS 6 core header files for Cortex-M architecture support
  • Compiler-specific implementations for IAR, GCC, Clang, and ARM Clang
  • Core support files for SC000, CM1, and various Cortex-M profile implementations
  • MPU, cache, PMU, and PAC extension support headers

Reviewed Changes

Copilot reviewed 57 out of 218 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
cmsis_iccarm_m.h IAR compiler-specific CMSIS definitions and intrinsics for Cortex-M
cmsis_gcc_m.h GCC compiler-specific CMSIS definitions for Cortex-M
cmsis_clang_m.h Clang compiler-specific CMSIS definitions for Cortex-M
cmsis_armclang_m.h ARM Clang compiler-specific CMSIS definitions for Cortex-M
armv8m_pmu.h Performance Monitoring Unit support for ARMv8.1-M
armv8m_mpu.h Memory Protection Unit API for ARMv8-M and ARMv8.1-M
armv81m_pac.h Pointer Authentication Code functions for ARMv8.1-M
armv7m_mpu.h Memory Protection Unit API for ARMv7-M
armv7m_cachel1.h Level 1 Cache API for ARMv7-M and later
core_sc000.h CMSIS SC000 Core Peripheral Access Layer
core_cm1.h CMSIS Cortex-M1 Core Peripheral Access Layer

#pragma language=extended
__IAR_FT void __iar_uint16_write(void const *ptr, uint16_t val)
{
*(__packed uint16_t*)(ptr) = val;;
Copy link

Copilot AI Sep 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Double semicolon should be single semicolon.

Copilot uses AI. Check for mistakes.
#pragma language=extended
__IAR_FT void __iar_uint32_write(void const *ptr, uint32_t val)
{
*(__packed uint32_t*)(ptr) = val;;
Copy link

Copilot AI Sep 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Double semicolon should be single semicolon.

Suggested change
*(__packed uint32_t*)(ptr) = val;;
*(__packed uint32_t*)(ptr) = val;

Copilot uses AI. Check for mistakes.
#endif /* __ARM_ARCH_PROFILE == 'M' */
#endif

/* Alternativ core deduction for older ICCARM's */
Copy link

Copilot AI Sep 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in comment: 'Alternativ' should be 'Alternative'.

Suggested change
/* Alternativ core deduction for older ICCARM's */
/* Alternative core deduction for older ICCARM's */

Copilot uses AI. Check for mistakes.
msg_ra = &can->callback_args->frame;
#else
msg_ra = can->callback_args->p_frame;
#if defined(SOC_SERIES_R7FA4M1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里为什么要额外加个宏定义去配置?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

因为RA4M1的结构体类型是这个:msg_ra = &can->callback_args->frame,这个msg_ra = can->callback_args->p_frame会报错,MCU自带CAN为传统CAN

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

那可能这块的逻辑之前是有问题的,这里不应该是can或canfd的判断,可能是FSP版本不同导致的,我看了一下fsp600版本的can和canfd驱动这里都是一样的,可以由:

#if defined(BSP_USING_CANFD)
    msg_ra = &can->callback_args->frame;
#else
    msg_ra = can->callback_args->p_frame;
#endif

修改为:

    msg_ra = &can->callback_args->frame;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BSP_USING_CANFD直接用这个宏会报错,另外,去掉条件编译那以前的FSP版本怎么办

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里不清楚fsp是哪个版本后被修改的,但是推荐用户使用最新版本fsp吧,毕竟有些更新是针对驱动库进行更新的

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

那可能这块的逻辑之前是有问题的,这里不应该是can或canfd的判断,可能是FSP版本不同导致的,我看了一下fsp600版本的can和canfd驱动这里都是一样的,可以由:

#if defined(BSP_USING_CANFD)
    msg_ra = &can->callback_args->frame;
#else
    msg_ra = can->callback_args->p_frame;
#endif

修改为:

    msg_ra = &can->callback_args->frame;

这样会引起别人的BSP编译出错

Copy link
Member

@kurisaW kurisaW Sep 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

能举例是哪个吗,我这边看了ra6m3的350和510版本中对于此处定义都是msg_ra = &can->callback_args->frame;,所以应该问题不大,估计之前就是有问题的,而且我看瑞萨对于can和canfd的驱动在此处成员的类型是不区分can/fdcan的,所以也不应该用BSP_USING_CANFD宏定义

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

重新看了一下,这里跟fsp版本,can/canfd并无关系,可以写成:

msg_ra = can->callback_args->p_frame;

也可以写成:

msg_ra = &can->callback_args->frame;

对于fsp中的描述p_frame指向的应该就是frame,所以两种写法都没毛病,只是说不应该用宏定义搞两套写法,选择修改为msg_ra = &can->callback_args->frame;就好了

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

能举例是哪个吗,我这边看了ra6m3的350和510版本中对于此处定义都是msg_ra = &can->callback_args->frame;,所以应该问题不大,估计之前就是有问题的,而且我看瑞萨对于can和canfd的驱动在此处成员的类型是不区分can/fdcan的,所以也不应该用BSP_USING_CANFD宏定义

我的直觉是做条件编译确保兼容性
image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

你看下源码吧,这块两个写法都是可以的,这不是兼不兼容的问题

OBJCPY = PREFIX + 'objcopy'
NM = PREFIX + 'nm'

DEVICE = ' -mcpu=cortex-m33 -mthumb -mfpu=fpv5-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

上面的cpu是m4,这里的编译参数是m33?

@@ -0,0 +1,178 @@
menu "Hardware Drivers Config"

config SOC_R7FA4M1AB
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里请按照之前说的nano支持进行修改,群里有说明

@Rbb666 Rbb666 requested a review from kurisaW September 28, 2025 09:42
@hywing
Copy link
Contributor Author

hywing commented Sep 28, 2025 via email

@kurisaW
Copy link
Member

kurisaW commented Sep 28, 2025

msg_ra = can->callback_args->p_frame;  不是啊,这个写法编译有问题啊…… hywing.sir @.***

---Original--- From: "Yuqiang @.> Date: Sun, Sep 28, 2025 18:34 PM To: @.>; Cc: @.@.>; Subject: Re: [RT-Thread/rt-thread] [bsp][renesas][ra4m1-ek] add a new bsp forra4m1-ek board (PR #10755) @kurisaW commented on this pull request. In bsp/renesas/libraries/HAL_Drivers/drivers/drv_can.c: > @@ -227,7 +227,11 @@ rt_ssize_t ra_can_recvmsg(struct rt_can_device can_dev, void buf, rt_uint32_t #if defined(BSP_USING_CANFD) msg_ra = &can->callback_args->frame; #else - msg_ra = can->callback_args->p_frame; + #if defined(SOC_SERIES_R7FA4M1) 你看下源码吧,这块两个写法都是可以的,这不是兼不兼容的问题 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.*>

看了下600版本把can->callback_args->p_frame成员删掉了,那就统一只保留msg_ra = &can->callback_args->frame写法即可

我看过510还有350这两个版本,都是支持p_frame和frame这两个成员的,估计后面瑞萨也认识到此处重复,所以我们保留frame就可以了

@kurisaW
Copy link
Member

kurisaW commented Sep 29, 2025

另外bsp fsp默认只保留一个串口用于控制台即可,其他的可以删掉,默认保持最小体量,你这边其他外设测试过后给个运行截图发到评论区就可以了

@hywing
Copy link
Contributor Author

hywing commented Oct 9, 2025

image image 其它动态图片参考【RA4M1】文章:https://club.rt-thread.org/ask/article/40573ef7345b90de.html

@hywing
Copy link
Contributor Author

hywing commented Oct 14, 2025 via email

@kurisaW
Copy link
Member

kurisaW commented Oct 14, 2025

我的意思是把configuration.xml里只保留一个串口配置,其他外设stack都删掉,这样就不用生成额外的原厂驱动,默认主线不要提过多的额外代码

image

@hywing
Copy link
Contributor Author

hywing commented Oct 14, 2025 via email

@Rbb666 Rbb666 merged commit bc2fca5 into RT-Thread:master Oct 15, 2025
55 checks passed
@Rbb666 Rbb666 added this to the v5.2.2 milestone Oct 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action github action yml imporve BSP: Renesas BSP related with Renesas BSP

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants