Embassy NEORV32 HAL
HALs implement safe, idiomatic Rust APIs to use the hardware capabilities, so raw register manipulation is not needed.
The embassy-neorv32 HAL targets the open-source NEORV32
RISC-V microcontroller and implements both blocking and async APIs/drivers for most of the peripherals.
Additionally, async and blocking traits from embedded-hal
are implemented where appropriate.
Support
The HAL currently supports the following peripherals and features:
Peripherals
- SPI
- TWI
- GPIO
- UART
- DMA
- PWM
- TRNG
- WDT
- SYSINFO
Additional Features
- Dual-hart support
- Embassy time-driver via CLINT
mtimer
Additional peripheral support and features may be added if there is community interest!
Usage
Please see the examples folder for ideas on how to use this HAL in your own projects.
To run these examples, follow these steps:
- Install cargo-binutils
- Modify build target in
examples/.cargo/config.tomlto match your configuration - Modify
examples/memory.xto match the size of your configuredDMEMandIMEM - Modify
examples/Cargo.tomlfeaturessimandfpgasuch that thetick-hzfeature forembassy-timematches your configuration - Modify
UART_BAUDinexamples/src/lib.rsto match your host UART - Clone neorv32 v1.12.8
- In the cloned neorv32 folder, run
cd sw/image_gen && gcc image_gen.c -o image_gen - Continue with one of the series of steps below depending on if running in simulation or on FPGA
Simulation
- Modify
BASEinexamples/run-simto yourneorv32repo path (default in$HOMEfolder) - Install GHDL simulator
- From examples folder, run
cargo run-sim --release --bin hello-world - For more help, see simulating the processor
FPGA over UART bootloader
- Modify
BASEinexamples/run-fpgato yourneorv32repo path (default in$HOMEfolder) - Install
picocom(or modifyrun-fpgato use your preferred tool) - From the
examplesfolder, runcargo run-fpga --release --bin hello-world - Press reset button on FPGA
- If using
picocom, manually follow these steps within host terminal: - Type: Any key
- Type:
u(Upload) - Type:
<Ctrl+A> <Ctrl+S>(send file) - Type:
hello-world-fpga <Enter> - Wait for upload to complete (should see
*** exit status: 0 *** OK) - Type:
e(Execute) - For more help, see bootloader
Version
This HAL targets NEORV32 v1.12.8. There is no guarantee it will work for different versions.