|0.3.0||Feb 7, 2021|
|0.2.3||Oct 19, 2020|
|0.2.2||Aug 20, 2020|
|0.1.1||Jul 31, 2020|
#442 in Embedded development
785 downloads per month
Auto-generated wrappers around registers for AVR microcontrollers.
Add the following to
[dependencies.avr-device] version = "0.3.0" features = ["atmega32u4"]
Via the feature you can select which chip you want the register specifications for. The following list is what is currently supported:
The version on
crates.io is pre-built. The following is only necessary when trying to build this crate from source.
cargo install atdf2svd cargo install svd2rust cargo install form rustup component add --toolchain nightly rustfmt pip3 install --user svdtools
Next, clone this repo and build the device definitions:
git clone https://github.com/Rahix/avr-device cd avr-device make # You can build for just one specific chip using # make atmega32u4 # I suggest building documentation as well cargo +nightly doc --features <chip> --open
avr-device is generated using
svd2rust. The vendor-provided atdf files can be found in
vendor/. The intermediate svd files are patched by
svdpatch.py (Adapted from
svdpatch.py in stm32-rs) with device-dependent patches in
patch/, mainly to improve undescriptive names and missing descriptions.
To add a new chip, download the atdf from http://packs.download.atmel.com/ (or avr-mcu/packs/) and place it in
vendor/. Be sure to name it like the Rust module that should be generated. Next, you need to integrate it into the base crate and build system. Follow what was done in commit 290613454fbd ("Add basic support for ATmega64"). Please adhere to the alphabetical sorting that is present so far.
Next, you must create a
patch/ which has at least the following content:
If more patches need to be applied (most likely!), they should be added into this file as well. The patching format is documented in the
svdtools README. Ideally, try to reuse the exisiting patches in
Finally, try building the crate for your MCU with
avr-device is licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
The vendored atdf files are licensed under the Apache License, Version 2.0 (LICENSE-VENDOR).