Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/speelbarrow/weensy.rs

A collection of useful bits and bobs for programming the Teensy 4.1 microcontroller using Rust.
https://github.com/speelbarrow/weensy.rs

embedded embedded-rust library proc-macro rs rust teensy teensy-board teensy41 util utilities utility utils

Last synced: 4 days ago
JSON representation

A collection of useful bits and bobs for programming the Teensy 4.1 microcontroller using Rust.

Awesome Lists containing this project

README

        

# weensy.rs [![CI/CD](https://github.com/speelbarrow/weensy.rs/actions/workflows/cicd.yml/badge.svg)](https://github.com/speelbarrow/weensy.rs/actions/workflows/cicd.yml) [![Crates.io](https://img.shields.io/crates/v/weensy?logo=rust)](https://crates.io/crates/weensy)

A collection of useful bits and bobs for programming the
[Teensy 4.1 microcontroller](https://www.pjrc.com/store/teensy41.html) using [Rust](https://rust-lang.org).

**NOTE**:
This package is meant to be used as an extension of [`teensy4-bsp`](https://docs.rs/teensy4-bsp/latest/teensy4_bsp/).
It is *strongly* recommended that you familiarize yourself with that library's API before using this package.

## USAGE
This package should be used by an executable crate targetting the Teensy 4.1. The following configuration of `cargo`
is required to build your executable properly:
```toml
[build]
target = "thumbv7em-none-eabihf"

[target.thumbv7em-none-eabihf]
rustflags = ["-C", "link-arg=-Tt4link.x"]
```
This code should be placed in `/.cargo/config.toml`. It can also be passed directly to the `cargo` command
using CLI flags, but this is not recommended because it's clunky.

See [`cargo`'s documentation](https://doc.rust-lang.org/cargo/reference/config.html) for more details. The `t4link.x`
file will be generated by [`teensy4-bsp`](https://docs.rs/teensy4-bsp/latest/teensy4_bsp/)'s
[`build.rs`](https://github.com/mciantyre/teensy4-rs/blob/master/build.rs) file. `teensy4-bsp` is included by this
package, and thus the build script will run when building any crate importing this package. All feature flags for this package's dependencies are re-exported, and enables `teensy4-bsp`'s `rt` feature by default.

Once this is done, `cargo install` [`cargo-binutils`](https://github.com/mciantyre/teensy4-rs/blob/master/build.rs) and
then run the following in the root directory of your executable crate:
```sh
cargo objcopy --release -- -o ihex out.hex
```

You can then flash `out.hex` to your Teensy board using the
[Teensy's provided tools](https://www.pjrc.com/teensy/loader.html).