9 个版本
0.1.8 | 2024 年 3 月 15 日 |
---|---|
0.1.7 | 2024 年 2 月 24 日 |
0.1.6 | 2023 年 11 月 6 日 |
0.1.5 | 2022 年 9 月 18 日 |
0.1.2 | 2021 年 3 月 21 日 |
#49 在 嵌入式开发
228 每月下载量
515KB
12K SLoC
ravedude 
ravedude
是一个 CLI 工具,可让 Rust 在 AVR 微控制器上的开发变得非常顺畅。它是 avrdude
的包装器,并提供了对目标串行控制台的便捷访问,类似于 Arduino IDE。
ravedude
旨在用作 cargo "运行器"。这允许您只需使用 cargo run
来构建、部署和运行您的 AVR 代码!
如果您遇到 Error: no matching serial port found, use -P 或在您的环境中设置 RAVEDUDE_PORT in
,请使用设置环境变量或在 .cargo/config.toml
中调整 runner = "ravedude {X} -cb {X} -P /dev/ttyUSB{X}"
(将 {X} 替换为您相应的值)
安装
在 Linux 系统上,您需要安装 pkg-config 和 libudev 开发文件
- Archlinux:
pacman -S systemd pkgconf
- Ubuntu/Debian:
apt install libudev-dev pkg-config
- Fedora:
dnf install systemd-devel pkgconf-pkg-config
接下来,使用以下命令安装来自 crates.io 的最新版本
cargo install ravedude
或者,如果您正在使用 Nix(包管理器)+ Flakes,您可以通过添加 inputs.ravedude.url = "github:Rahix/avr-hal?dir=ravedude";
和使用包 ravedude.packages."${system}".default
来安装 ravedude
。
现在您需要将 ravedude 添加到您的项目中。例如,在 Arduino Uno 项目中,将以下内容放入您的 .cargo/config.toml
(不要放在 Cargo.toml
中)
[target.'cfg(target_arch = "avr")']
runner = "ravedude uno --open-console --baudrate 57600"
就是这样,现在只需调用 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: -- -- -- -- -- -- -- --
许可证
ravedude 的许可证可以是以下之一
- Apache License,版本 2.0(LICENSE-APACHE 或 https://apache.ac.cn/licenses/LICENSE-2.0)
- MIT 许可证(LICENSE-MIT 或 http://opensource.org/licenses/MIT)
由您选择。
依赖项
~6–15MB
~196K SLoC