bsp: allwinner: fix RT-Smart boot on D1 - #11714
Conversation
|
👋 感谢您对 RT-Thread 的贡献!Thank you for your contribution to RT-Thread! 为确保代码符合 RT-Thread 的编码规范,请在你的仓库中执行以下步骤运行代码格式化工作流(如果格式化CI运行失败)。 🛠 操作步骤 | Steps
完成后,提交将自动更新至 如有问题欢迎联系我们,再次感谢您的贡献!💐 |
|
@rcitach 麻烦帮忙review下 |
There was a problem hiding this comment.
Pull request overview
This PR updates the Allwinner D1 RT-Smart BSP bring-up path so it can boot and run reliably on real D1/C906 hardware, aligning the BSP with RT-Thread’s current RISC-V common64 MMU model and refreshing console/storage integration.
本 PR 旨在修复全志 D1(C906)RT-Smart BSP 的启动与运行问题,使其与当前 RT-Thread RISC-V common64 MMU 模型对齐,并更新串口控制台与存储/文件系统集成,以支持真实硬件稳定启动与交互。
Changes / 变更点:
- Update D1 board init to common64 MMU mapping flow, and adjust kernel VA start/load assumptions (identity mapping around the real load address).
更新 D1 板级初始化到 common64 MMU 初始化流程,并修正内核虚拟地址起始/加载地址假设(按实际加载地址进行恒等映射)。 - Switch console configuration to
uart0and adjust UART default baudrate handling; migrate to Serial V2 config for D1.
将控制台切换到uart0,并支持通过 BSP 配置设置默认波特率;D1 侧启用 Serial V2 配置。 - Restore SDMMC usage selection behavior and add a D1 partition port + ROMFS root mount path.
恢复/修正 SDMMC 使用选择逻辑,新增 D1 分区适配代码,并以 ROMFS 挂载为确定性根文件系统。
PR checklist note / PR 清单提示:
- Title format: current title
bsp: allwinner: fix RT-Smart boot on D1does not match the repository guideline “[module/vendor][subsystem] Description(lowercase)”. Consider something like:[allwinner][d1] Fix RT-Smart boot on D1.
标题格式:当前标题不符合仓库建议的“[模块/厂商][子系统] 描述(小写)”格式,可考虑例如:[allwinner][d1] Fix RT-Smart boot on D1。
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| bsp/allwinner/libraries/libos/src/os.c | Adjust used_card_no default for D1 SDMMC selection. |
| bsp/allwinner/libraries/drivers/sdmmc/drv_sdmmc.c | Initialize only selected SDMMC hosts; return explicit status. |
| bsp/allwinner/libraries/drivers/Kconfig | Avoid selecting FAL for D1 when enabling FS. |
| bsp/allwinner/libraries/drivers/drv_uart.c | Allow BSP-configured default UART baudrate (fallback preserved). |
| bsp/allwinner/d1/rtconfig.py | Add -D__ASSEMBLY__ for assembler-with-cpp builds. |
| bsp/allwinner/d1/rtconfig.h | Update console name, kernel VA start, Serial V2, SDMMC options, baudrate macro. |
| bsp/allwinner/d1/.config | Sync menuconfig outputs with new console/MMU/serial/SDMMC settings. |
| bsp/allwinner/d1/Kconfig | Add BSP_UART_DEFAULT_BAUDRATE Kconfig option. |
| bsp/allwinner/d1/link.lds | Export text range symbols for potential runtime use. |
| bsp/allwinner/d1/board/board.c | Migrate to common64 MMU setup; adjust init ordering; console device selection. |
| bsp/allwinner/d1/applications/mnt.c | Mount ROMFS on / as deterministic root FS. |
| bsp/allwinner/d1/README.md | Document validated hardware, console settings, load address, and build steps. |
| bsp/allwinner/d1/ports/SConscript | New ports aggregation SConscript for submodules. |
| bsp/allwinner/d1/ports/partition/SConscript | Build glue for partition port under SDMMC dependency. |
| bsp/allwinner/d1/ports/partition/partition.h | Partition API/types for the BSP port. |
| bsp/allwinner/d1/ports/partition/partition.c | Partition block-device adapter implementation for D1. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| /* open the block device */ | ||
| rt_device_open(device, RT_DEVICE_OFLAG_RDWR); | ||
| /* get block device geometry */ | ||
| rt_device_control(device, RT_DEVICE_CTRL_BLK_GETGEOME, &geometry); | ||
|
|
| objs = [] | ||
| cwd = GetCurrentDir() | ||
| list = os.listdir(cwd) | ||
|
|
||
| for item in list: | ||
| if os.path.isfile(os.path.join(cwd, item, 'SConscript')): | ||
| objs = objs + SConscript(os.path.join(item, 'SConscript')) |
Problem
The Allwinner D1 RT-Smart BSP retained stale startup, MMU, serial, and storage integration code which prevented successful operation on real D1/C906 hardware.
Problems included an obsolete MMU initialization path and kernel address assumptions, allocation before heap initialization, duplicate BSS and UART initialization, Serial V1 configuration, an incorrect console device and baud default, and missing D1 SDMMC partition integration.
Resolution
Validation
The functional bring-up was tested on real Allwinner D1 / T-Head C906 hardware in the Sipeed Lichee RV 86 Panel class and reached an interactive RT-Smart shell:
Runtime testing covered scheduler operation, system ticks, thread sleep/wakeup, UART0 console, SDMMC block access, ROMFS/devfs, lwIP initialization, and kernel heap/page allocation.
The master-based series builds successfully with the RT-Thread RISC-V musl toolchain:
The hardware-validated prototype was based on RT-Thread v5.0.2. This current-master adaptation still requires a final board regression using firmware with the corrected T-Head CLINT devicetree binding; that firmware change is separate from this RT-Thread series.