17 unstable releases (7 breaking)
0.8.0 | Sep 30, 2024 |
---|---|
0.7.0 | Jul 4, 2024 |
0.6.0 | Jun 16, 2024 |
0.5.1 | Jun 18, 2022 |
0.2.1 | Nov 13, 2021 |
#1441 in Embedded development
279 downloads per month
Used in vorago-reb1
240KB
5K
SLoC
HAL for the Vorago VA108xx MCU family
This repository contains the Hardware Abstraction Layer (HAL), which is an additional hardware abstraction on top of the peripheral access API.
It is the result of reading the datasheet for the device and encoding a type-safe layer over the raw PAC. This crate also implements traits specified by the embedded-hal project, making it compatible with various drivers in the embedded rust ecosystem.
In contrats to other HAL implementations, there is only one chip variant available here so there is no need to pass the chip variant as a feature.
Building
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-eabi
After that, you can use cargo build
to build the development version of the crate.
If you have not done this yet, it is recommended to read some of the excellent resources available to learn Rust:
Setting up your own binary crate
If you have a custom board, you might be interested in setting up a new binary crate for your project. These steps aim to provide a complete list to get a binary crate working to flash your custom board.
The hello world of embedded development is usually to blinky a LED. This example is contained within the examples folder.
-
Set up your Rust cross-compiler if you have not done so yet. See more in the build chapter
-
Create a new binary crate with
cargo init
-
To ensure that
cargo build
cross-compiles, it is recommended to create a.cargo/config.toml
file. A sample.cargo/config.toml
file is provided in this repository as well -
Copy the
memory.x
file into your project. This file contains information required by the linker. -
Copy the
blinky.rs
file to thesrc/main.rs
file in your binary crate -
You need to add some dependencies to your
Cargo.toml
file[dependencies] cortex-m = "<Compatible Version>" cortex-m-rt = "<Compatible Version>" panic-halt = "<Compatible Version>" embedded-hal = "<Compatible Version>" [dependencies.va108xx-hal] version = "<Most Recent Version>" features = ["rt"]
-
Build the application with
cargo build
-
Flashing the board might work differently for different boards and there is usually more than one way. You can find example instructions in primary README.
Dependencies
~1.7–2.3MB
~44K SLoC