Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add file config support for ravedude #522

Merged
merged 20 commits into from
Sep 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
f6abf30
ravedude: add temporary file config support
Creative0708 Mar 18, 2024
cc4e6fc
ravedude: fix incorrect substitution in get_board
Creative0708 Mar 18, 2024
08fefee
ravedude: move board configs to a toml file, implement --dump-config,…
Creative0708 Mar 25, 2024
f5f9f83
ravedude: add options for command-line args in Ravedude.toml
Creative0708 Mar 25, 2024
a29c093
ravedude: that should be kebab case
Creative0708 Mar 25, 2024
b80cfb4
ravedude: add board inheritance, change baudrate syntax, add test for…
Creative0708 Apr 7, 2024
f1251f1
ravedude: remove warnings for command-line overrides + fix some comma…
Creative0708 Apr 7, 2024
d5ff4fc
ravedude: make BoardConfig not say that nonexistent options are bugs …
Creative0708 Apr 7, 2024
e8f3fd1
ravedude: change config format, tweak error messages, add warning for…
Creative0708 Apr 7, 2024
425eca4
ravedude: add direct board name option in [general] for Ravedude.toml…
Creative0708 Apr 8, 2024
da0e890
ravedude: fix chip erase error message
Creative0708 Apr 8, 2024
2defa5e
ravedude: fix serial-baudrate not working in Ravedude.toml
Creative0708 Apr 17, 2024
f958dd2
ravedude: make ravedude search in parent dirs for manifest, also fix …
Creative0708 May 10, 2024
a150c82
ravedude: change board arg to OsString, add error messages to asserts…
Creative0708 May 10, 2024
a4e2213
ravedude: remove error message field from ResetOptions & change open_…
Creative0708 May 18, 2024
34d2a9d
ravedude: fix open_console serialization & tweak error messages
Creative0708 May 18, 2024
5374693
ravedude: make board reset prompt only display when a binary is given
Creative0708 May 18, 2024
a680ede
ravedude: add comments for possibly confusing code
Creative0708 May 18, 2024
410a676
ravedude: make legacy configuration deprecated & make ravedude respec…
Creative0708 Jul 10, 2024
e775420
ravedude: Fix backwards compatibility with legacy configuration
Rahix Sep 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,6 @@ jobs:
- name: Check ravedude
run: |
cargo check --manifest-path ravedude/Cargo.toml
- name: Test ravedude
run: |
cargo test --manifest-path ravedude/Cargo.toml
136 changes: 128 additions & 8 deletions ravedude/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions ravedude/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ serialport = "4.0.0"
anyhow = "1.0.38"
git-version = "0.3.4"
ctrlc = "3.2.1"
serde = { version = "1.0.197", features = ["serde_derive"] }
toml = "0.8.11"
either = "1.10.0"

[dependencies.structopt]
version = "0.3.21"
Expand Down
31 changes: 19 additions & 12 deletions ravedude/src/avrdude/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,7 @@ use std::process;

use std::io::Write;

#[derive(Debug)]
pub struct AvrdudeOptions<'a> {
pub programmer: &'a str,
pub partno: &'a str,
pub baudrate: Option<u32>,
pub do_chip_erase: bool,
}
use crate::config::BoardAvrdudeOptions;

#[derive(Debug)]
pub struct Avrdude {
Expand Down Expand Up @@ -50,7 +44,7 @@ impl Avrdude {
}

pub fn run(
options: &AvrdudeOptions,
options: &BoardAvrdudeOptions,
port: Option<impl AsRef<path::Path>>,
bin: &path::Path,
debug: bool,
Expand Down Expand Up @@ -79,15 +73,25 @@ impl Avrdude {

let mut command = command
.arg("-c")
.arg(options.programmer)
.arg(
options
.programmer
.as_ref()
.ok_or_else(|| anyhow::anyhow!("board has no programmer"))?,
)
.arg("-p")
.arg(options.partno);
.arg(
options
.partno
.as_ref()
.ok_or_else(|| anyhow::anyhow!("board has no part number"))?,
);

if let Some(port) = port {
command = command.arg("-P").arg(port.as_ref());
}

if let Some(baudrate) = options.baudrate {
if let Some(baudrate) = options.baudrate.flatten() {
command = command.arg("-b").arg(baudrate.to_string());
}

Expand All @@ -96,7 +100,10 @@ impl Avrdude {
flash_instruction.push(bin);
flash_instruction.push(":e");

if options.do_chip_erase {
if options
.do_chip_erase
.ok_or_else(|| anyhow::anyhow!("board doesn't specify whether to erase the chip"))?
{
command = command.arg("-e");
}

Expand Down
Loading