This repository has been archived on 2024-06-16. You can view files and clone it, but cannot push or open issues or pull requests.
Go to file
bors[bot] 5c00459f23
Merge #23
23: Added PWM implementation and example r=robamu a=robamu

- Type safe API for the PWM peripheral

Co-authored-by: Robin Mueller <robin.mueller.m@gmail.com>
2021-12-05 16:47:38 +00:00
.cargo added utility files 2021-11-08 01:14:25 +01:00
.github Merge remote-tracking branch 'origin/main' into mueller/test-examples-ci 2021-11-08 11:30:58 +01:00
examples Added PWM implementation and example 2021-12-05 17:44:18 +01:00
src Added PWM implementation and example 2021-12-05 17:44:18 +01:00
.gitignore ignoring Cargo.lock now 2021-11-08 01:32:39 +01:00
Cargo.toml Added PWM implementation and example 2021-12-05 17:44:18 +01:00
CHANGELOG.md Added PWM implementation and example 2021-12-05 17:44:18 +01:00
jlink.gdb added utility files 2021-11-08 01:14:25 +01:00
LICENSE-APACHE added license files 2021-11-08 01:03:06 +01:00
LICENSE-MIT added license files 2021-11-08 01:03:06 +01:00
memory.x added utility files 2021-11-08 01:14:25 +01:00
README.md applied cargo fmt and fixed link 2021-12-04 21:35:11 +01:00

Crates.io ci docs.rs

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.

Supported Boards

The first way to use this HAL will probably be with the REB1 development board. The BSP provided for this board also contains instructions how to flash the board.

Crate Version
vorago-reb1 Crates.io

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:

Examples

Some examples, which are not specific to a particular board were provided as well. You can build the timer example with

cargo build --example timer-ticks

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.

  1. Set up your Rust cross-compiler if you have not done so yet. See more in the build chapter

  2. Create a new binary crate with cargo init

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

  4. Copy the memory.x file into your project. This file contains information required by the linker.

  5. Copy the blinky.rs file to the src/main.rs file in your binary crate

  6. You need to add some dependencies to your Cargo.toml file

     [dependencies]
     cortex-m = "0.7.3"
     cortex-m-rt = "0.7.0"
     panic-halt = "0.2"
     embedded-hal = "0.2.6"
    
     [dependencies.va108xx-hal]
     version = "0.2"
     features = ["rt"]
    
  7. Build the application with

    cargo build
    
  8. Flashing the board might work differently for different boards and there is usually more than one way. You can find example instructions for the REB1 development board here.