Repository navigation
[bsp][artinchip] Add initial D213ECV-DEMO-V4-0 support - #12058
Conversation
|
👋 感谢您对 RT-Thread 的贡献!Thank you for your contribution to RT-Thread! 为确保代码符合 RT-Thread 的编码规范,请在你的仓库中执行以下步骤运行代码格式化工作流(如果格式化CI运行失败)。 🛠 操作步骤 | Steps
完成后,提交将自动更新至 如有问题欢迎联系我们,再次感谢您的贡献!💐 |
📌 Code Review Assignment🏷️ Tag: workflowReviewers: @Rbb666 @kurisaW @supperthomas Changed Files (Click to expand)
📊 Current Review Status (Last Updated: 2026-11-16 13:58 CST)
📝 Review Instructions
|
Rbb666
left a comment
There was a problem hiding this comment.
复核当前 head 4b464f10:默认 UART0 115200 配置暂未发现阻塞问题,以下两项 P2 涉及可配置功能。低速发送问题通过提取实际驱动及 serial-v1 发送代码的主机 MMIO 模拟复现;UTest 问题经链接依赖静态确认。本轮未重新交叉构建或运行板级测试。
| struct aic_uart *uart = serial->parent.user_data; | ||
|
|
||
| /* Bound a stalled transmitter without depending on scheduler state. */ | ||
| rt_uint64_t deadline = riscv_timer_rdtime() + BSP_CLINT_FREQ / 10; |
There was a problem hiding this comment.
[P2] 按波特率和帧长设置发送等待上限
这里固定等待 100 ms,但 aic_uart_configure() 接受的低波特率可能需要更长时间发送一帧。默认 48 MHz 时钟下,50 baud 对应 divisor=60000,配置会返回成功,而 8N1 每帧需要 200 ms;FIFO 填满后,等到下一个空位可能超过 100 ms,硬件仍正常发送时这里就返回 -1,serial-v1 的 _serial_poll_tx() 随即结束本次写入并返回短写。抽取当前驱动和发送路径进行 MMIO 模拟后,64 字节 FIFO 加一个移位寄存器的模型中,请求写入 66 字节只接受 65 字节;115200 baud 对照能完整写入。请根据实际波特率和帧长设置至少覆盖一帧传输时间的等待上限,或在 configure 中明确拒绝无法支持的低速配置。
There was a problem hiding this comment.
根据实际波特率和帧格式调整发送超时,并通过主机端模拟测试验证了低波特率下的发送行为
| . = ALIGN(8); | ||
| __fsymtab_start = .; | ||
| KEEP(*(FSymTab)) | ||
| __fsymtab_end = .; |
There was a problem hiding this comment.
[P2] 补齐 UTest 注册段及边界符号
此自定义链接脚本保留了 FinSH 和初始化表,但遗漏了 UtestTcTab 以及 __rt_utest_tc_tab_start/end。在菜单中启用 RT_USING_UTESTCASES 会选中 RT_USING_UTEST,components/utilities/utest/utest.c:121–124 的初始化代码直接引用这两个符号,且 INIT_COMPONENT_EXPORT(utest_init) 会保留该函数,因此该配置会链接失败。请参照公共 libcpu/risc-v/link.lds.S:71–75,按指针对齐补充两个边界符号和 KEEP(*(UtestTcTab));仅补符号而不保留注册段,测试项仍可能被 --gc-sections 丢弃。默认配置未启用 UTest,所以当前默认构建不能覆盖这个问题。
There was a problem hiding this comment.
已补充 UTest 注册段、边界符号及 KEEP,并验证启用 UTest 后可以正常编译链接
拉取/合并请求描述:(PR description)
为什么提交这份PR (why to submit this PR)
Add initial RT-Thread support for the ArtInChip D213ECV-DEMO-V4-0 board (T-Head C906, RV64GC, 128 MiB DDR3), with a UART0 console for basic board bring-up.
你的解决方案是什么 (what is your solution)
Reuse the RISC-V common port for M-mode startup, context switching, FPU state, PLIC handling and system ticks. Add the D213 platform initialization, linker layout, GPIO/UART0 clock and reset setup, and a serial-v1 UART0 adapter. An external loader initializes DDR, PLLs and memory/cache attributes before loading RT-Thread at
0x40000000.UART0 uses polling TX and a receive thread feeding the standard serial-v1 FIFO. The receive thread runs above FinSH priority and the default receive buffer is 512 bytes. TX and configuration waits are bounded, and divisor writes require successful LCR/DLAB readback. Other UARTs, UART hardware IRQ reception, DMA and additional peripheral drivers are outside this PR.
Include English and Chinese READMEs, independent SCons/dist build support, the BSP index entry and CI registration. The two commits separate BSP contents from repository integration. Packaging utilities and firmware binaries are kept outside the BSP.
请提供验证的bsp和config (provide the config and bsp)
BSP:
bsp/artinchip/d213ecv-demo-v4-0.config: checked-in default configuration (
CONFIG_BSP_USING_UART0=y, Serial-v1, MSH, 1000 Hz system tick, 512-byte serial RX buffer). No configuration changes are needed for the default UART0 console at 115200 8N1.action: https://github.com/boa-z/rt-thread/actions/runs/43586807528 (passed on the final two-commit revision; build and dist export)
Validation:
D213ECV-DEMO-V4-0 hardware: startup to MSH; UART0 TX/RX; repeated
help,ps,list deviceandlist timer; onlyuart0registered. Full power-off/on reliably reaches MSH. Repeated entry of the next command duringhelp/psoutput also works.versionandfreewere verified on the preceding UART0 revision.GCC 10.2.0: default UART0, no-UART and Serial-v2 exclusion configurations build successfully; dist export and independent rebuild pass.
Host MMIO simulation: 21 valid UART0 formats, invalid parameters, divisor boundaries, TX timeout, RX close/reopen and BUSY/DLAB failure handling pass. These simulations do not establish hardware acceptance of every serial format.
Repository clang-format checks and configuration/generated-header consistency checks pass.
The fork workflow succeeds, but its bundled cppcheck reports preprocessing errors in common headers (
not supported tool chainandUnexpected __riscv_xlen); this does not establish a clean cppcheck result.Tick accuracy, FPU/FCSR preservation under preemption/IRQs, external PLIC delivery and long-duration stress tests remain unverified on hardware. UART0 console polling does not exercise external PLIC delivery.
当前拉取/合并请求的状态 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
已经使用clang-format 源码格式化工具确保格式符合RT-Thread代码规范 This PR has been formatted with clang-format and complies with RT-Thread code specification
如果是新增bsp, 已经添加ci检查到.github/ALL_BSP_COMPILE.json 详细请参考链接BSP自查