ravedude is a tool I created to seamlessly run Rust code on AVR
microcontrollers with nothing more than the usual cargo run. This is very
much inspired by the great cargo-embed tool!
How To Use
Keep in mind that this is no mature software yet. So if anything behaves
weirdly, please send a bug report! That said, to use ravedude, first
install it from crates.io:
cargo install ravedude
And then you only need to include it in your project's .cargo/config.toml
(not in Cargo.toml!):
[target.'cfg(target_arch = "avr")']
runner = "ravedude uno --open-console --baudrate 57600"
uno refers to the board and the remaining parameters in this case instruct
ravedude to open the board's serial console after flashing the program. After
that, all you need to do is to call cargo run:
avr-hal/examples/arduino-uno on ravedude via v1.51.0-nightly
❯ cargo run --bin uno-i2cdetect
Compiling arduino-uno-examples v0.0.0 (avr-hal/examples/arduino-uno)
Finished dev [optimized + debuginfo] target(s) in 1.26s
Running `ravedude uno -cb 57600 avr-hal/target/avr-atmega328p/debug/uno-i2cdetect.elf`
Board Arduino Uno
Programming avr-hal/target/avr-atmega328p/debug/uno-i2cdetect.elf => /dev/ttyACM0
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.00s
avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: erasing chip
avrdude: reading input file "avr-hal/target/avr-atmega328p/debug/uno-i2cdetect.elf"
avrdude: writing flash (1654 bytes):
Writing | ################################################## | 100% 0.27s
avrdude: 1654 bytes of flash written
avrdude: verifying flash memory against avr-hal/target/avr-atmega328p/debug/uno-i2cdetect.elf:
avrdude: load data flash data from input file avr-hal/target/avr-atmega328p/debug/uno-i2cdetect.elf:
avrdude: input file avr-hal/target/avr-atmega328p/debug/uno-i2cdetect.elf contains 1654 bytes
avrdude: reading on-chip flash data:
Reading | ################################################## | 100% 0.21s
avrdude: verifying ...
avrdude: 1654 bytes of flash verified
avrdude: safemode: Fuses OK (E:00, H:00, L:00)
avrdude done. Thank you.
Programmed avr-hal/target/avr-atmega328p/debug/uno-i2cdetect.elf
Console /dev/ttyACM0 at 57600 baud
Write direction test:
- 0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- 38 39 -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- 48 -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
Read direction test:
- 0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- 38 39 -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- 48 -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
Contribute
If you have any ideas how ravedude could be even more useful or if you notice
anything not working, please join the development over in the avr-hal
repository's next branch.
The Name
ravedude uses avrdude under the hood and umm... it was very late at night,
okay?