Skip to content

[bsp][artinchip] Add initial D213ECV-DEMO-V4-0 support - #12058

Merged
Rbb666 merged 3 commits into
RT-Thread:masterfrom
boa-z:bsp/artinchip-d213-base
Nov 17, 2026
Merged

Rbb666 merged 3 commits into
RT-Thread:masterfrom
boa-z:bsp/artinchip-d213-base

Conversation

@boa-z

@boa-z boa-z commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

拉取/合并请求描述:(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 device and list timer; only uart0 registered. Full power-off/on reliably reaches MSH. Repeated entry of the next command during help / ps output also works. version and free were 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 chain and Unexpected __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自查

@github-actions

Copy link
Copy Markdown

👋 感谢您对 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

  • Use workflow from 保持默认分支(通常为 master)
    Keep the default branch (usually master) in Use workflow from
  • 在 branch 输入框填写 PR 分支 bsp/artinchip-d213-base
    Enter PR branch bsp/artinchip-d213-base in the branch field
  • 设置需排除的文件/目录(目录请以"/"结尾)
    Set files/directories to exclude (directories should end with "/")
  1. 等待工作流完成 | Wait for the workflow to complete
    格式化后的代码将作为独立提交推送至你的分支。
    The formatting changes will be pushed to your branch as a separate commit.

完成后,提交将自动更新至 bsp/artinchip-d213-base 分支,关联的 Pull Request 也会同步更新。
Once completed, commits will be pushed to the bsp/artinchip-d213-base 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 labels Nov 14, 2026
@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

📌 Code Review Assignment

🏷️ Tag: workflow

Reviewers: @Rbb666 @kurisaW @supperthomas

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

📊 Current Review Status (Last Updated: 2026-11-16 13:58 CST)


📝 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 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

复核当前 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;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

[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 中明确拒绝无法支持的低速配置。

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

根据实际波特率和帧格式调整发送超时,并通过主机端模拟测试验证了低波特率下的发送行为

Comment on lines +26 to +29
. = ALIGN(8);
__fsymtab_start = .;
KEEP(*(FSymTab))
__fsymtab_end = .;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

[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,所以当前默认构建不能覆盖这个问题。

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

已补充 UTest 注册段、边界符号及 KEEP,并验证启用 UTest 后可以正常编译链接

@Rbb666
Rbb666 merged commit 9ddb024 into RT-Thread:master Nov 17, 2026
48 checks passed
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants