Bare-metal runtime entry support for HiSilicon RISC-V firmware.
This crate keeps the user-facing runtime interface small and stable:
- re-exports
riscv-rtentry attributes (entry,pre_init); - re-exports the selected PAC interrupt enum;
- registers the single-hart critical-section implementation through the
riscvcrate; - selects chip startup/linker adapters behind Cargo features.
chip-ws63: WS63 reset/trap startup, linker layout,ws63-pac/rtinterrupt symbols, and the optional link-timeboot-headerimage header.chip-bs21+unstable: BS2X compatibility path. This crate provides a BS21/BS2X defaultmemory.x, BS2X linker layout, legacy startup, andbs2x-pac/rtprovides BS2Xdevice.x. BS20/custom boards can override the default by disablingbundled-memory-xand providing their ownmemory.x.
Hi3322 is intentionally not exposed as a startup feature yet. The vendor platform
uses TES/TEE CSRs (tmtvec, tmstatus, tmedeleg, tmesvec), CLIC setup, and a
different memory/image model, so it needs a dedicated adapter after PAC/linker/board
evidence exists.
#![no_std]
#![no_main]
use hisi_riscv_rt::entry;
#[entry]
fn main() -> ! {
loop {}
}Downstream binaries should link with:
-Thisi-riscv-link.x
ws63-link.x is still generated as a temporary compatibility alias for older
applications, but new code should use the neutral name.
Stable runtime surface:
entry/pre_initfacade overriscv-rt;chip-ws63default startup/linker path;- WS63
boot-headerwhenchip-ws63is enabled.
Unstable runtime surface:
chip-bs21BS2X compatibility adapter;riscv-rt-start-experiment.
bundled-memory-x emits the active chip's default memory.x: WS63 for
chip-ws63, or BS21/BS2X 160K L2RAM for chip-bs21. BS20 has 128K L2RAM and
should provide its own memory.x.
| Region | Base | Size | Description |
|---|---|---|---|
| BOOTROM | 0x100000 | 36K | Mask ROM boot code |
| ROM | 0x109000 | 268K | Application ROM support code |
| ITCM | 0x14C000 | 16K default | Instruction TCM |
| DTCM | 0x180000 | 16K default | Data TCM |
| FLASH | 0x200000 | 8MB | External SPI NOR flash |
| PROGRAM | 0x230300 | ~2.25MB | Application code after WS63 boot header |
| SRAM | 0xA00000 | 576K default | Main system RAM |
| Region | Base | Size | Description |
|---|---|---|---|
| BOOTROM | 0x00000000 | 32K | Mask ROM window |
| ROM | 0x00008000 | 480K | Remaining ROM window |
| ITCM | 0x00080000 | 448K | Instruction TCM before DTCM carve-out |
| DTCM | 0x000F0000 | 64K | Data TCM carve-out |
| FLASH | 0x10000000 | 1MB | XIP NOR flash |
| PROGRAM | 0x10000000 | 1MB | Application code |
| SRAM | 0x00100000 | 160K | BS21/BS2X L2RAM default |
MIT