{"id":13668324,"url":"https://github.com/rustsbi/rustsbi-d1","last_synced_at":"2025-10-19T17:28:34.483Z","repository":{"id":45208597,"uuid":"513106141","full_name":"rustsbi/rustsbi-d1","owner":"rustsbi","description":"RustSBI bootloader firmware and debug suite for Allwinner D1 SoC boards, including Nezha, Lichee and more","archived":false,"fork":false,"pushed_at":"2024-10-09T23:10:16.000Z","size":169,"stargazers_count":18,"open_issues_count":1,"forks_count":4,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-11T04:38:00.656Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rustsbi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-07-12T10:57:38.000Z","updated_at":"2024-10-09T23:10:14.000Z","dependencies_parsed_at":"2024-02-26T09:27:20.520Z","dependency_job_id":"0cd544e8-7a37-4a3b-84ef-de1f94661bc1","html_url":"https://github.com/rustsbi/rustsbi-d1","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rustsbi%2Frustsbi-d1","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rustsbi%2Frustsbi-d1/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rustsbi%2Frustsbi-d1/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rustsbi%2Frustsbi-d1/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rustsbi","download_url":"https://codeload.github.com/rustsbi/rustsbi-d1/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241852145,"owners_count":20030969,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T08:00:30.685Z","updated_at":"2025-10-19T17:28:29.405Z","avatar_url":"https://github.com/rustsbi.png","language":"Rust","funding_links":[],"categories":["Uncategorized"],"sub_categories":["Uncategorized"],"readme":"﻿# RustSBI implementation for Allwinner D1\n\n[![CI](https://github.com/rustsbi/rustsbi-d1/actions/workflows/workflow.yml/badge.svg?branch=main)](https://github.com/rustsbi/rustsbi-d1/actions)\n[![issue](https://img.shields.io/github/issues/rustsbi/rustsbi-d1)](https://github.com/rustsbi/rustsbi-d1/issues)\n\n全志 D1 引导程序及其调试工具。\n\n## 模块\n\n### SPL\n\n运行在 SRAM，单独调试时产生如下输出：\n\n```text\nDRAM only have internal ZQ!!\nget_pmu_exist() = 4294967295\nddr_efuse_type: 0x0\n[AUTO DEBUG] two rank and full DQ!\nddr_efuse_type: 0x0\n[AUTO DEBUG] rank 0 row = 16\n[AUTO DEBUG] rank 0 bank = 8\n[AUTO DEBUG] rank 0 page size = 2 KB\n[AUTO DEBUG] rank 1 row = 16\n[AUTO DEBUG] rank 1 bank = 8\n[AUTO DEBUG] rank 1 page size = 2 KB\nrank1 config same as rank0\nDRAM BOOT DRIVE INFO: %s\nDRAM CLK = 792 MHz\nDRAM Type = 3 (2:DDR2,3:DDR3)\nDRAMC ZQ value: 0x7b7bfb\nDRAM ODT value: 0x42.\nddr_efuse_type: 0x0\nDRAM SIZE =2048 M\nDRAM simple test OK.\n\n   _  __        __          ___            __    __  ____  _ __\n  / |/ /__ ___ / /  ___ _  / _ )___  ___  / /_  / / / / /_(_) /\n /    / -_)_ // _ \\/ _ `/ / _  / _ \\/ _ \\/ __/ / /_/ / __/ / /\n/_/|_/\\__//__/_//_/\\_,_/ /____/\\___/\\___/\\__/  \\____/\\__/_/_/🦀\nno payload |                     \u003c\u003c                           |\n```\n\n### SEE\n\n运行在 DRAM，单独调试时产生如下输出：\n\n```text\n[rustsbi] no dtb file detected\n[rustsbi] RustSBI version 0.3.0-alpha.1, adapting to RISC-V SBI v1.0.0\n.______       __    __      _______.___________.  _______..______   __\n|   _  \\     |  |  |  |    /       |           | /       ||   _  \\ |  |\n|  |_)  |    |  |  |  |   |   (----`---|  |----`|   (----`|  |_)  ||  |\n|      /     |  |  |  |    \\   \\       |  |      \\   \\    |   _  \u003c |  |\n|  |\\  \\----.|  `--'  |.----)   |      |  |  .----)   |   |  |_)  ||  |\n| _| `._____| \\______/ |_______/       |__|  |_______/    |______/ |__|\n[rustsbi] Implementation     : RustSBI-D1 Version 0.1.0\n[rustsbi] Extensions         : [legacy console, timer, reset, ipi]\n[rustsbi] Platform Name      : unknown\n[rustsbi] Platform SMP       : 1\n[rustsbi] Platform Memory    : 0x0..0x0\n[rustsbi] Boot HART          : 0\n[rustsbi] Device Tree Region : 0x0..0x0\n[rustsbi] Firmware Address   : 0x40000000\n[rustsbi] Supervisor Address : 0x0\n[rustsbi] no kernel |                                      \u003c\u003c         |\n```\n\n### TEST-KERNEL\n\n用于测试 SEE 的 Supervisor，若 SEE 工作正常，产生如下输出：\n\n```text\n _____         _     _  __                    _\n|_   _|__  ___| |_  | |/ /___ _ __ _ __   ___| |\n  | |/ _ \\/ __| __| | ' // _ \\ '__| '_ \\ / _ \\ |\n  | |  __/\\__ \\ |_  | . \\  __/ |  | | | |  __/ |\n  |_|\\___||___/\\__| |_|\\_\\___|_|  |_| |_|\\___|_|\n================================================\n| boot hart id          |                    0 |\n| smp                   |                    1 |\n| timebase frequency    |          24000000 Hz |\n| dtb physical address  |           0x7fe00000 |\n------------------------------------------------\n[ INFO] Testing Base\n[ INFO] sbi spec version = 1.0\n[ INFO] sbi impl = RustSBI\n[ INFO] sbi impl version = 0x300\n[ INFO] sbi extensions = [Base, TIME, sPI, SRST]\n[ INFO] mvendor id = 0x5b7\n[ INFO] march id = 0x0\n[ INFO] mimp id = 0x0\n[ INFO] Sbi Base Test Pass\n[ INFO] Testing TIME\n[ INFO] read time register successfuly, set timer +1s\n[ INFO] timer interrupt delegate successfuly\n[ INFO] Sbi TIME Test Pass\n[ INFO] Testing sPI\n[ INFO] send ipi successfuly\n[ INFO] Sbi sPI Test Pass\n[ERROR] Sbi HSM Not Exist\n[ INFO] marchid duration = 13468308\n[ INFO] ipi duration = 28632525\n[rustsbi] system reset |                   \u003e\u003e  |\n```\n\n## 加载过程\n\n支持以下模式：\n\n1. xfel -\u003e spl -\u003e see -\u003e kernel\n\n   \u003e 这个模式目前不能工作，因为一旦使用 `xfel ddr d1`，就没法从 sram 运行了，原因不明\n\n2. xfel --------\u003e see -\u003e kernel\n\n3. brom -\u003e spl -\u003e see -\u003e kernel\n\n每种模式都支持在没有后续环节时停住。\n\n## 命令\n\n环境参数：\n\n- **`--spl`**：命令指定的操作将加载 spl。\n- **`--see`**：命令指定的操作将加载 see。\n- **`--kernel \u003cfile/::test\u003e`**：命令指定的操作将加载指定内核文件或测试内核。\n- **`--dt \u003cfile\u003e`**：命令指定的操作将加载指定设备树文件。\n\n命令：\n\n- **`cargo make`**\n\n  生成各阶段目标文件。\n\n  示例：\n\n  - `cargo make --spl` 生成 spl.bin\n  - `cargo make --spl --see` 生成 spl.bin 和 see.bin\n  - `cargo make --spl --see --dt nezha.dts` 生成 spl.bin、see.bin 和 nezha.dtb\n\n- **`cargo asm`**\n\n  生成各阶段反汇编文件。\n\n  参数：\n\n  - `-o`/`--output` 文件保存位置，默认保存到 target 目录下。\n\n  示例：\n\n  - `cargo asm` 生成 `target/spl.asm` 和 `target/see.asm`\n  - `cargo asm --see -o sbi.asm` 在当前目录生成 `sbi.asm`\n\n  \u003e **NOTICE**\n  \u003e\n  \u003e - `cargo asm` 视作 `cargo asm --spl --see`\n  \u003e - `--kernel` 和 `--dt` 目前无效\n\n- **`cargo debug`**\n\n  调试，不使用 flash。\n\n  示例：\n\n  - `cargo debug --spl` 调试 spl\n  - `cargo debug --see` 调试 see\n  - `cargo debug --see --dt nezha.dts` 调试可见设备树文件的 see\n  - `cargo debug --see --kernel zcore.bin --dt nezha.dts` 调试 see + kernel\n\n- **`cargo flash`**\n\n  烧写到 flash。\n\n  环境参数的 4 块对于此命令是独立的。\n\n  参数：\n\n  - `--reset` 重置元数据，即格式化 flash\n  - `--boot` 此次烧写完成后从 brom 重启\n\n  示例：\n\n  - `cargo flash --spl --boot` 烧写 spl，完成后立即重启\n  - `cargo flash --see --reset` 烧写 see，并格式化 flash，丢弃以前的 kernel 和 dtb\n  - `cargo flash --dt nezha.dts` 烧写设备树\n  - `cargo flash --kernel zcore.bin` 烧写内核\n  - `cargo flash --boot` 立即从 brom 重启\n\n## 换行问题\n\n如果你使用 minicom 连接开发板，出现显示时光标不回行首的情况（类似[这样](https://github.com/rustsbi/rustsbi-d1/issues/1)），需要改 minicom 配置，参考[此问答](https://unix.stackexchange.com/questions/283924/how-can-minicom-permanently-translate-incoming-newline-n-to-crlf)。\n\n## 错误提示 ERROR xtask::xfel] xfel not found\n\nxfel: https://github.com/xboot/xfel\n\nWindows配置: 下载[`xfel-windows-v1.3.2.7z`](https://github.com/xboot/xfel/releases/download/v1.3.2/xfel-windows-v1.3.2.7z)后解压，并将解压目录路径添加至系统环境变量 Path 中，于重新打开的终端中运行`xfel`命令验证成功。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frustsbi%2Frustsbi-d1","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frustsbi%2Frustsbi-d1","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frustsbi%2Frustsbi-d1/lists"}