RT-Thread / RT-Thread/rt-thread
[Feature] RISC-V 近期调整
Open
Nobody has claimed this yet.
Arch: RISC-V
- Dominant language
- C
- Stars
- 12.2k
- Forks
- 5.4k
- Avg merge
- 4d 12h
- Merged PRs (30d)
- 40
Description
Describe problem solved by the proposed feature
已有问题
只列当前 ISSUE 会解决的问题
- HARTID 保存:https://github.com/RT-Thread/rt-thread/issues/11226
- Timer 统一:https://github.com/RT-Thread/rt-thread/issues/11019
- TLS 支持:https://github.com/RT-Thread/rt-thread/issues/7820
- 降低移植门槛:https://github.com/RT-Thread/rt-thread/issues/8675
- 中断框架解耦:https://github.com/RT-Thread/rt-thread/issues/10457
- 地址空间管理:https://github.com/RT-Thread/rt-thread/issues/9178,https://github.com/RT-Thread/rt-thread/issues/9521
- PIC 统一:https://github.com/RT-Thread/rt-thread/issues/9566
- MMU 标准统一:https://github.com/RT-Thread/rt-thread/issues/9567
- RV32 S-Mode:https://github.com/RT-Thread/rt-thread/issues/9571
- SMP 支持:https://github.com/RT-Thread/rt-thread/issues/10722
Describe your preferred solution
已有提交
- 进迭 Spacemit K1 支持:
- RISC-V 重启系统调用:https://github.com/RT-Thread/rt-thread/pull/10520
- RISC-V 重构和支持:https://github.com/RT-Thread/rt-thread/pull/10320
后续计划
对于架构本身的改进,https://github.com/RT-Thread/rt-thread/pull/10320#issuecomment-2906928709 已经做了详细规划,在与社区的协商下,进行了一定的调整(带 MMU 的 SoC 平台)。
- 支持动态 ISA 管理
- 合并 32/64 位公共代码
- 支持统一 cache 操作
- MMU 支持到标准
- 合并 M/S 模式公共代码
- 支持 SMP
- 支持 DM
- 合并 T-HEAD Vendor 代码
- RT-Thread 支持非 0 核启动
- libcpu 目录改进
- common 实现仍然作为切入点和统一目录
- 原本的 common 改名为 legacy_common,使用原本 common 的 bsp 如果没有采用新添加的宏 RT_USING_RISCV_NEW_COMMON 就会自动使用 legacy_common,t-head 目录同理
- qemu-virt64-riscv 是第一个使用新 common 的 BSP,并在同一目录支持 RV32 和 RV64 S-mode,同时 DM 在 32位下部分数据打印截断问题也修复。
- 对于非 0 核启动问题,不再修改内核 master CPU 语义,而是 RISC-V 架构层维护 physical HART ID 与 logical CPU ID 的转换表:
- 最先启动的 HART 注册为 logical CPU0。
- 其余 HART 按平台枚举顺序映射为 CPU1、CPU2 等。
- SBI HSM、IPI、timer 和 per-CPU 中断初始化统一经过该映射。
- 后续继续在维护的 BSP,开源逐个接入新的 common,同时按照现实要求完善 common,最终没有 BSP 引用 legacy_ 时,即可删除 legacy_ 和全部 BSP 的RT_USING_RISCV_NEW_COMMON,RISC-V 架构则算重构完成。
需要维护(Sync)的 BSP
RV32
- bluetrum
- bouffalo_lab
- core-v-mcu
- hpmicro
- nuclei
- xuantie/smartl
- rv32m1_vega
- wch/riscv
- gd32/risc-v
- sparkfun-redv
- ES-PDS-ES32VF2264
RV64
- allwinner
- cvitek
- K230
- qemu-virt64-riscv
- xuantie/xiaohui
- spacemit/k1
Describe possible alternatives
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the RISC-V architecture plan in PR #10320 and the libcpu/common and legacy_common notes. The issue lists many planned changes and BSPs to sync, but does not define one bounded task or a single completion test, so the scope must be narrowed before work can be considered done.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- embedded-iot, operating-systems
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100