This crate collection provides support to write Rust applications for the VA108XX family of devices.
This workspace contains the following released crates:
- The
va108xxPAC crate containing basic low-level register definition. - The
va108xx-halHAL crate containing higher-level abstractions on top of the PAC register crate. - The
va108xx-embassycrate containing support for running the embassy-rs RTOS. - The
vorago-reb1BSP crate containing support for the REB1 development board.
It also contains the following helper crates:
- The
bootloadercrate contains a sample bootloader strongly based on the one provided by Vorago. - The
flashloadercrate contains a sample flashloader which is able to update the redundant images in the NVM which is compatible to the provided bootloader as well. - The
board-testscontains an application which can be used to test the libraries on the board. - The
examplesfolder contains various example applications crates using the HAL and the PAC. This folder also contains dedicated example applications using theRTICandembassynative Rust RTOSes.
The majority of the HAL implementation and the Embassy-rs support are contained in the external
vorago-shared-periphs crate.
Use the following command to have a starting config.toml file
cp .cargo/config.toml.template .cargo/config.tomlYou then can adapt the config.toml to your needs. For example, you can configure runners
to conveniently flash with cargo run.
Use the following command to have a starting configuration for VS Code:
cp -rT vscode .vscodeYou can then adapt the files in .vscode to your needs.
Building an application requires the thumbv6m-none-eabi cross-compiler toolchain.
If you have not installed it yet, you can do so with
rustup target add thumbv6m-none-eabiAfter that, you can use cargo build to build the development version of the crate.
For example, you can use
cargo build --example blinkyto build a simple blinky app.
You can use CLI or VS Code for flashing, running and debugging.
Install probe-rs first.
You can use probe-rs to run the software and display RTT log output. However, debugging does not
work yet.
After installation, you can run the following command
probe-rs run --chip VA108xx_RAM --protocol jtag target/thumbv6m-none-eabi/debug/examples/blinkyto flash and run the blinky program on the RAM. There is also a VA108xx chip target
available for persistent flashing.
Runner configuration is available in the .cargo/def-config.toml file to use probe-rs for
convenience. probe-rs is also able to process and display defmt strings directly.
Assuming a working debug connection to your VA108xx board, you can debug using VS Code with
the Cortex-Debug plugin.
Please make sure that objdump-multiarch and nm-multiarch
are installed as well.
Some sample configuration files for VS code were provided and can be used by running
cp -rT vscode .vscode like specified above. After that, you can use Run and Debug
to automatically rebuild and flash your application.
If you would like to use a custom GDB application, you can specify the gdb binary in the following
configuration variables in your settings.json:
"cortex-debug.gdbPath""cortex-debug.gdbPath.linux""cortex-debug.gdbPath.windows""cortex-debug.gdbPath.osx"
The provided VS Code configurations also provide an integrated RTT logger, which you can access
via the terminal at RTT Ch:0 console. In order for the RTT block address detection to
work properly, objdump-multiarch and nm-multiarch need to be installed.
Install the following two tools first:
- SEGGER J-Link tools installed
- gdb-multiarch or similar
cross-architecture debugger installed. All commands here assume
gdb-multiarch.
You can build the blinky example application with the following command
cargo build --example blinkyStart the GDB server first. The server needs to be started with a certain configuration and with
a JLink script to disable ROM protection.
For example, on Debian based system the following command can be used to do this (this command
is also run when running the jlink-gdb.sh script)
JLinkGDBServer -select USB -device Cortex-M0 -endian little -if JTAG-speed auto \
-LocalhostOnly -jtagconf -1,-1After this, you can flash and debug the application with the following command
gdb-mutliarch -q -x jlink/jlink.gdb target/thumbv6m-none-eabihf/debug/examples/blinky -tuiPlease note that you can automate all steps except starting the GDB server by using a cargo
runner configuration, for example with the following lines in your .cargo/config.toml file:
[target.'cfg(all(target_arch = "arm", target_os = "none"))']
runner = "gdb-multiarch -q -x jlink/jlink.gdb"After that, you can simply use cargo run --example blinky to flash the blinky
example.
The Segger RTT viewer can be used to display log messages received from the target. The base address for the RTT block placement is 0x10000000. It is recommended to use a search range of 0x1000 around that base address when using the RTT viewer.
The RTT viewer will not be able to process defmt printouts. However, you can view the defmt
logs by installing defmt-print first and then running
defmt-print -e <pathToElfFile> tcpThe path of the ELF file which is being debugged needs to be specified for this to work.
If you are unfamiliar with Rust on Embedded Systems or Rust in general, the following resources are recommended: