Repository navigation
Conversation
|
👋 感谢您对 RT-Thread 的贡献!Thank you for your contribution to RT-Thread! 为确保代码符合 RT-Thread 的编码规范,请在你的仓库中执行以下步骤运行代码格式化工作流(如果格式化CI运行失败)。 🛠 操作步骤 | Steps
完成后,提交将自动更新至 如有问题欢迎联系我们,再次感谢您的贡献!💐 |
📌 Code Review Assignment🏷️ Tag: bsp_renesasReviewers: @kurisaW Changed Files (Click to expand)
🏷️ Tag: workflowReviewers: @Rbb666 @kurisaW @supperthomas Changed Files (Click to expand)
📊 Current Review Status (Last Updated: 2026-11-19 00:26 CST)
📝 Review Instructions
|
|
Rbb666
left a comment
There was a problem hiding this comment.
English: Please address the selectable Serial V2 build failure and resolve the documented picolibc dependency before merging. The RH850 hard- and soft-float build checks passed, but the three RH850 utest jobs in run 42290504980 failed during compilation and did not execute QEMU. Validation here consists of static review, a minimal host-compiler reproduction of the UART operations initializer, and inspection of the existing CI logs; a full RH850/QEMU run was not repeated locally.
中文:请修复可选 Serial V2 配置下的编译失败,并在合并前解决 PR 已声明的 picolibc 依赖。RH850 硬浮点、软浮点构建检查已通过,但运行 42290504980 中的三个 RH850 utest 任务都在编译阶段失败,尚未执行 QEMU。本次验证包括静态审查、UART 操作表的宿主编译器最小复现和现有 CI 日志核查,未在本地重跑完整 RH850/QEMU 测试。
| .control = rh850_uart_control, | ||
| .putc = rh850_uart_putc, | ||
| .getc = rh850_uart_getc, | ||
| .dma_transmit = RT_NULL, |
There was a problem hiding this comment.
[P2][Serial/串口] Restrict the configuration to V1 or implement V2 support / 限制为 V1 或补齐 V2 支持
English: The BSP sources the common serial Kconfig, which allows selecting RT_USING_SERIAL_V2, while this driver is compiled whenever RT_USING_SERIAL is enabled. The V2 struct rt_uart_ops has a transmit member rather than dma_transmit, so selecting V2 fails to compile here. A minimal compilation using the PR's operations-structure definitions and this initializer passes for V1 and fails for V2 with has no member named 'dma_transmit'. Please constrain the selectable configuration to the supported V1 driver, or implement the V2 operations and control handling.
中文:BSP 引入的公共串口 Kconfig 允许选择 RT_USING_SERIAL_V2,而本驱动只判断 RT_USING_SERIAL。V2 的 struct rt_uart_ops 成员为 transmit,没有 dma_transmit,因此切换到 V2 会在这里编译失败。使用 PR 中的操作表结构定义与此初始化代码做最小编译复现,V1 通过,V2 报 has no member named 'dma_transmit'。请将可选配置约束到已支持的 V1,或完整实现 V2 的操作表及控制逻辑。
There was a problem hiding this comment.
Restricted to V1. BSP_USING_UART now depends on RT_USING_SERIAL_V1, so V2 cannot be selected with this driver. V2 support can come later as a separate change.
| - { UTEST: "AARCH64-rtsmart", RTT_BSP: "bsp/zynqmp-a53-dfzu2eg", QEMU_ARCH: "aarch64", QEMU_MACHINE: "xlnx-zcu102", SD_FILE: "None", KERNEL: "rtsmart", "SMP_RUN":"" } | ||
| - { UTEST: "AARCH64-smp", RTT_BSP: "bsp/zynqmp-a53-dfzu2eg", QEMU_ARCH: "aarch64", QEMU_MACHINE: "xlnx-zcu102", SD_FILE: "None", KERNEL: "standard", "SMP_RUN":"smp" } | ||
|
|
||
| - { UTEST: "RH850", RTT_BSP: "bsp/renesas/rh850/qemu-rh850-u2c", QEMU_ARCH: "rh850", QEMU_MACHINE: "rh850-u2c", SD_FILE: "None", KERNEL: "standard", "SMP_RUN":"" } |
There was a problem hiding this comment.
[CI/持续集成] Resolve the documented picolibc dependency before merging / 合并前解决已声明的 picolibc 依赖
English: This records the dependency already acknowledged in the PR description. In run 42290504980, all three RH850 jobs (default.cfg, kernel/kernel_basic.cfg, and kernel/mem.cfg) fail at Build BSP, so the new QEMU test entries have no execution results. The kernel_basic build log shows ctime.c failing under --strict with -Werror=array-parameter for asctime_r/ctime_r and -Werror=nonnull-compare. Please land the separate picolibc compatibility fix, update this branch to include it, and rerun these jobs successfully before merging, keeping the strict checks enabled.
中文:此评论记录 PR 描述中已说明的依赖问题。运行 42290504980 中三个 RH850 任务(default.cfg、kernel/kernel_basic.cfg、kernel/mem.cfg)均在 Build BSP 阶段失败,新增 QEMU 测试尚无运行结果。kernel_basic 编译日志 显示 ctime.c 在 --strict 下触发 asctime_r/ctime_r 的 -Werror=array-parameter 以及 -Werror=nonnull-compare。请先合入独立的 picolibc 兼容修复,将其纳入本分支,再保持严格检查重跑这些任务,通过后再合并。
There was a problem hiding this comment.
The picolibc fix landed as #11999 and this branch is now rebased on master with it. Strict checks are kept. The RH850 utest jobs build and run on QEMU now: https://github.com/RT-Thread/rt-thread/actions/runs/44156842325
|
Thanks for the quick review. I will address it during this week. |
Thread switch through TRAP0 and nested EIINT, FPU context and fault dumps. Signed-off-by: Parthiban Nallathambi <parthiban@linumiz.com>
a769d59 to
32e6434
Compare
@Rbb666 Both points are addressed. Serial is restricted to V1, and the branch is rebased on master with the picolibc fix from #11999. The RH850 utest jobs now build and run on QEMU with strict checks: https://github.com/RT-Thread/rt-thread/actions/runs/44156842325 |
|
|
||
| if (div == 0U) | ||
| { | ||
| div = 1U; |
There was a problem hiding this comment.
[P2] Reject baud rates outside the divider range
With the BSP's 20 MHz clock and 16 samples per bit, the highest attainable rate is 1.25 Mbaud. BAUD_RATE_4000000 produces a rounded divisor of zero. Clamping it to one makes configuration report success at 1.25 Mbaud, so a peer configured for 4 Mbaud cannot receive the stream reliably.
Please validate the rate before writing any registers. Compute 16 * baud and the rounded divisor in 64-bit arithmetic, reject rates outside the hardware range, and check that the divisor is in 1..65536 before storing div - 1 in LBRP01. Propagate -RT_EINVAL to the caller. A boundary test can check that 1250000 succeeds and 4000000 fails with the default clock.
There was a problem hiding this comment.
Fixed. Out of range rates now return -RT_EINVAL before any register write.
| if (cfg->data_bits != DATA_BITS_8 || cfg->stop_bits != STOP_BITS_1 || | ||
| cfg->parity != PARITY_NONE || cfg->baud_rate == 0) |
There was a problem hiding this comment.
[P2] Reject serial options the driver does not program
A caller can request RTS/CTS on an open port and receive RT_EOK even though rlin3_setup() never enables flow control. Serial V1 then records the requested settings in serial->config. MSB-first and inverted mode also pass this check without being applied. Extend the existing validation so these requests return -RT_EINVAL before the UART is reconfigured.
| if (cfg->data_bits != DATA_BITS_8 || cfg->stop_bits != STOP_BITS_1 || | |
| cfg->parity != PARITY_NONE || cfg->baud_rate == 0) | |
| if (cfg->data_bits != DATA_BITS_8 || cfg->stop_bits != STOP_BITS_1 || | |
| cfg->parity != PARITY_NONE || cfg->baud_rate == 0 || | |
| cfg->bit_order != BIT_ORDER_LSB || cfg->invert != NRZ_NORMAL || | |
| cfg->flowcontrol != RT_SERIAL_FLOWCONTROL_NONE) |
There was a problem hiding this comment.
Applied as suggested.
| ___rt_utest_tc_tab_end = .; | ||
| } > FLASH | ||
|
|
||
| .rodata : |
There was a problem hiding this comment.
[P2] Retain the C++ constructor table in flash
This BSP links with -nostartfiles and its startup code calls entry directly. When RT_USING_CPLUSPLUS is enabled, cplusplus_system_init() walks constructor tables using weak boundary symbols. This script defines neither range, so the firmware can link successfully and reach main() with global C++ objects still uninitialized.
Please inspect a global object's sections with v850-elf-objdump -h and retain the emitted table with KEEP. For .init_array, place KEEP(*(SORT_BY_INIT_PRIORITY(.init_array.*))) and KEEP(*(.init_array)) between ___init_array_start and ___init_array_end in a 4-byte-aligned flash section. If the toolchain emits .ctors, provide the corresponding ___ctors_start__ and ___ctors_end__ range. The extra leading underscore matches this target's C symbol prefix. A QEMU smoke test can have a global constructor set a value and check it in main().
I verified the missing table with an ARM GNU ELF link using the same section layout. The RH850 C++ build and runtime still need verification.
There was a problem hiding this comment.
Fixed. Both .ctors and .init_array are kept now, with a utest for a global constructor.
Startup code, INTC, OSTM and RLIN3 UART drivers and the U2C SoC setup. Signed-off-by: Parthiban Nallathambi <parthiban@linumiz.com>
RH850/U2C8 on the QEMU rh850-u2c machine, msh on RLIN311. BSP utest cases check the UART config and C++ global constructors. Signed-off-by: Parthiban Nallathambi <parthiban@linumiz.com>
Hard and soft float builds, kernel and C++ utests with toolchain v1.2.0. The toolchain and QEMU downloads are checked with SHA-256. Signed-off-by: Parthiban Nallathambi <parthiban@linumiz.com>
32e6434 to
6309b2b
Compare
|
@Rbb666 thanks for your review. Addressed, kindly revisit. |
|
增量复核 / Incremental check at
CI at this head:RH850 job 与 The three P2 items are addressed at this head. The only red check is ESP32C6 failing on an empty-token GitHub API call (401), unrelated to this PR. 完整 review 仍未进行;待 CI 恢复后继续。 |
Thanks for checking @BernardXiong. The ESP32C6 job failed while downloading its toolchain, so it is unrelated to this PR. Could you re-run it? |
为什么提交这份PR (why to submit this PR)
Add support for the Renesas RH850 G4KH core, tested on the QEMU rh850-u2c machine.
你的解决方案是什么 (what is your solution)
Tested with toolchain v1.2.0 (GCC 14.3, picolibc) and qemu-rh850 v1.2.0:
Common fixes found while testing this port, sent separately:
Releases, with sources and build scripts:
请提供验证的bsp和config (provide the config and bsp)
BSP: bsp/renesas/rh850/qemu-rh850-u2c
.config: default. Soft float: RT_USING_FPU=n
action: https://github.com/RT-Thread/rt-thread/actions/runs/44156842325