Skip to content

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

License

Notifications You must be signed in to change notification settings

speelbarrow/weensy.rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

weensy.rs CI/CD Crates.io

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

NOTE: This package is meant to be used as an extension of 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:

[build]
target = "thumbv7em-none-eabihf"

[target.thumbv7em-none-eabihf]
rustflags = ["-C", "link-arg=-Tt4link.x"]

This code should be placed in <CRATE_ROOT>/.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 for more details. The t4link.x file will be generated by teensy4-bsp's 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 and then run the following in the root directory of your executable crate:

cargo objcopy --release -- -o ihex out.hex

You can then flash out.hex to your Teensy board using the Teensy's provided tools.