Rust support for the VA108xx family of MCUs
Go to file
Robin Mueller ff7ac62a8d
Some checks failed
Rust/va108xx-rs/pipeline/pr-main There was a failure building this commit
update package
- Add embassy example
- improve timer API
- restructure examples
2024-09-18 16:08:53 +02:00
.cargo Update and improve HAL library and docs 2024-07-04 18:07:34 +02:00
.github/workflows update doc build settings 2024-06-26 22:58:12 +02:00
automation update doc build settings 2024-06-26 22:58:12 +02:00
board-tests update package 2024-09-18 16:08:53 +02:00
defmt-testapp New VA108xx Rust workspace structure + dependency updates 2024-06-16 16:16:45 +02:00
docs adc code added 2021-12-12 01:25:50 +01:00
examples update package 2024-09-18 16:08:53 +02:00
scripts update flasher script file 2024-07-11 11:52:56 +02:00
sections update all dependencies. separate LTO profile 2021-12-16 11:27:21 +01:00
va108xx update doc build settings 2024-06-26 22:58:12 +02:00
va108xx-hal update package 2024-09-18 16:08:53 +02:00
vorago-reb1 README correction 2024-07-04 18:41:33 +02:00
vscode update package 2024-09-18 16:08:53 +02:00
.gitignore New VA108xx Rust workspace structure + dependency updates 2024-06-16 16:16:45 +02:00
.gitmodules New VA108xx Rust workspace structure + dependency updates 2024-06-16 16:16:45 +02:00
Cargo.toml update package 2024-09-18 16:08:53 +02:00
jlink-gdb.sh update all dependencies. separate LTO profile 2021-12-16 11:27:21 +01:00
jlink.gdb added jlink.gdb file and updated submodules 2021-11-06 20:22:25 +01:00
LICENSE-APACHE relicensed 2021-12-10 10:16:21 +01:00
memory.x first compiling blinky 2021-11-03 01:25:13 +01:00
NOTICE relicensed 2021-12-10 10:16:21 +01:00
README.md update package 2024-09-18 16:08:53 +02:00

build

Vorago VA108xx Rust Support

This crate collection provides support to write Rust applications for the VA108XX family of devices.

List of crates

This workspace contains the following released crates:

  • The va108xx PAC crate containing basic low-level register definition.
  • The va108xx-hal HAL crate containing higher-level abstractions on top of the PAC register crate.
  • The vorago-reb1 BSP crate containing support for the REB1 development board.

It also contains the following helper crates:

  • The board-tests contains an application which can be used to test the libraries on the board.
  • The examples folder contains various example applications crates using the HAL and the PAC. This folder also contains dedicated example applications using the RTIC and embassy native Rust RTOSes.

Using the .cargo/config.toml file

Use the following command to have a starting config.toml file

cp .cargo/def-config.toml .cargo/config.toml

You then can adapt the config.toml to your needs. For example, you can configure runners to conveniently flash with cargo run.

Using the sample VS Code files

Use the following command to have a starting configuration for VS Code:

cp -rT vscode .vscode

You can then adapt the files in .vscode to your needs.

Flashing, running and debugging the software

You can use CLI or VS Code for flashing, running and debugging. In any case, take care of installing the pre-requisites first.

Pre-Requisites

  1. SEGGER J-Link tools installed
  2. gdb-multiarch or similar cross-architecture debugger installed. All commands here assume gdb-multiarch.

Using CLI

You can build the blinky example application with the following command

cargo build --example blinky

Start 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

After 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

Please 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.

Using VS Code

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.