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

Update documentation #368

Merged
merged 38 commits into from
Mar 27, 2023
Merged
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
dbe4d89
ci: ✨ Add Rasberry CI
SergioGasquez Oct 4, 2022
a89b6f4
ci: 🐛 Fix typo
SergioGasquez Oct 4, 2022
a21b484
ci: 🐛 Fix args order
SergioGasquez Oct 4, 2022
8580fa0
ci: 🐛 Fix args order
SergioGasquez Oct 4, 2022
89f76fa
ci: ⬆️ Bump actions/checkout
SergioGasquez Feb 2, 2023
5f79d13
ci: ⬆️ Bump Swatinem/rust-cache
SergioGasquez Feb 2, 2023
9d38af9
ci: ⚡️ Avoid using actions-rs
SergioGasquez Feb 2, 2023
c1ef7e3
ci: ⚡️ Replace actions-rs/toolchain by dtolnay/rust-toolchain
SergioGasquez Feb 2, 2023
4669ac0
ci: ⚡️ Fix CI warnings
SergioGasquez Feb 2, 2023
019cd61
ci: 🎨 Fix inputs
SergioGasquez Feb 2, 2023
86881d2
ci: ⚡️ Update mad9000/actions-find-and-replace-string and remove acti…
SergioGasquez Feb 2, 2023
aa42bd2
ci: ⚡️ Update mad9000/actions-find-and-replace-string and remove acti…
SergioGasquez Feb 2, 2023
a650d61
Merge branch 'esp-rs:main' into master
SergioGasquez Mar 18, 2023
d80501e
style: 🚨 Fix clippy warning
SergioGasquez Mar 18, 2023
aa8d25a
docs: 🎨 Fix links
SergioGasquez Mar 18, 2023
52c08dc
build: 🎨 Format includes
SergioGasquez Mar 18, 2023
16647c6
style: 🎨 Sort dependencies
SergioGasquez Mar 18, 2023
8220c00
build: ⬆️ Bump dependencies
SergioGasquez Mar 18, 2023
d55596c
build: ⬆️ Bump dependencies
SergioGasquez Mar 18, 2023
d24c5d5
ci: ⚡️ Fail if there is a clippy warning
SergioGasquez Mar 18, 2023
edf8e88
docs: 📝 Remove docstrings
SergioGasquez Mar 18, 2023
b0c8c47
docs: 📝 Update docstrings
SergioGasquez Mar 18, 2023
d775e22
docs: 📝 Update monitor docstrings
SergioGasquez Mar 18, 2023
b685548
docs: 📝 Update monitor docstrings
SergioGasquez Mar 18, 2023
77520a7
docs: 📝 Update config docstrings
SergioGasquez Mar 18, 2023
4d73b86
docs: 📝 Update cli mod docstrings
SergioGasquez Mar 18, 2023
a198790
docs: 📝 Update docstrings
SergioGasquez Mar 18, 2023
002310c
style: 🔊 Update log
SergioGasquez Mar 18, 2023
aa0947f
revert: ⏪️ Revert cargo version upgrade
SergioGasquez Mar 18, 2023
f6ad642
revert: ⏪️ Revert cargo version upgrade
SergioGasquez Mar 18, 2023
67378de
ci: ⚡️ Fail on clippy warnings
SergioGasquez Mar 18, 2023
1645731
build: ⬇️ Downgrade dependencies to maintain msrv
SergioGasquez Mar 20, 2023
0b74729
build: ⏪️ Rever pinned dependency
SergioGasquez Mar 20, 2023
533a072
Merge branch 'main' into master
SergioGasquez Mar 24, 2023
d18d92f
Update espflash/src/flasher/mod.rs
SergioGasquez Mar 24, 2023
ddb4556
Merge branch 'master' of https://github.com/SergioGasquez/espflash
SergioGasquez Mar 24, 2023
0a823ec
docs: 📝 Add refences to types
SergioGasquez Mar 24, 2023
345b2db
docs: 📝 Fix typo
SergioGasquez Mar 24, 2023
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
2 changes: 1 addition & 1 deletion .github/workflows/raspberry_rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
toolchain: stable
components: clippy
cargo-command: clippy
args: --features=raspberry -- -A clippy::too_many_arguments
args: --features=raspberry -- -D warnings -A clippy::too_many_arguments
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@v1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,4 @@ jobs:
components: clippy
- uses: Swatinem/rust-cache@v2
# `too_many_arguments` is relatively arbitrary
- run: cargo clippy -- -A clippy::too_many_arguments
- run: cargo clippy -- -A clippy::too_many_arguments -D warnings
89 changes: 84 additions & 5 deletions Cargo.lock

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

14 changes: 3 additions & 11 deletions cargo-espflash/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,21 +1,13 @@
[package]
name = "cargo-espflash"
version = "2.0.0-rc.3"
authors = [
"Robin Appelman <[email protected]>",
"Jesse Braham <[email protected]>",
]
authors = ["Robin Appelman <[email protected]>", "Jesse Braham <[email protected]>"]
edition = "2021"
rust-version = "1.63"
description = "Cargo subcommand for flashing Espressif devices over serial"
repository = "https://github.com/esp-rs/espflash"
license = "MIT OR Apache-2.0"
keywords = [
"cargo",
"cli",
"embedded",
"esp",
]
keywords = ["cargo", "cli", "embedded", "esp"]
categories = [
"command-line-utilities",
"development-tools",
Expand All @@ -33,7 +25,7 @@ cargo = { version = "0.66.0", features = ["vendored-openssl"] }
cargo_metadata = "0.15.2"
clap = { version = "4.0.32", features = ["derive"] }
env_logger = "0.10.0"
esp-idf-part = "0.1.2"
esp-idf-part = "0.2.0"
espflash = { version = "=2.0.0-rc.3", path = "../espflash" }
log = "0.4.17"
miette = { version = "5.5.0", features = ["fancy"] }
Expand Down
2 changes: 0 additions & 2 deletions cargo-espflash/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ enum CargoSubcommand {

#[derive(Debug, Subcommand)]
enum Commands {
/// Display information about the connected board and exit without flashing
BoardInfo(ConnectArgs),
/// Flash an application to a target device
Flash(FlashArgs),
Monitor(MonitorArgs),
PartitionTable(PartitionTableArgs),
Expand Down
37 changes: 18 additions & 19 deletions espflash/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,25 +1,14 @@
[package]
name = "espflash"
version = "2.0.0-rc.3"
authors = [
"Robin Appelman <[email protected]>",
"Jesse Braham <[email protected]>",
]
authors = ["Robin Appelman <[email protected]>", "Jesse Braham <[email protected]>"]
edition = "2021"
rust-version = "1.63"
description = "A command-line tool for flashing Espressif devices over serial"
repository = "https://github.com/esp-rs/espflash"
license = "MIT OR Apache-2.0"
keywords = [
"cli",
"embedded",
"esp",
]
categories = [
"command-line-utilities",
"development-tools",
"embedded",
]
keywords = ["cli", "embedded", "esp"]
categories = ["command-line-utilities", "development-tools", "embedded"]

[package.metadata.binstall]
pkg-url = "{ repo }/releases/download/v{ version }/{ name }-{ target }.{ archive-format }"
Expand All @@ -41,11 +30,11 @@ binread = "2.2.0"
bytemuck = { version = "1.12.3", features = ["derive"] }
clap = { version = "4.0.32", features = ["derive", "env"], optional = true }
comfy-table = { version = "6.1.4", optional = true }
crossterm = { version = "0.25.0", optional = true }
crossterm = { version = "0.26.1", optional = true }
dialoguer = { version = "0.10.2", optional = true }
directories-next = { version = "2.0.0", optional = true }
esp-idf-part = "0.1.2"
env_logger = { version = "0.10.0", optional = true }
esp-idf-part = "0.2.0"
flate2 = "1.0.25"
indicatif = { version = "0.17.2", optional = true }
lazy_static = { version = "1.4.0", optional = true }
Expand All @@ -68,8 +57,18 @@ xmas-elf = "0.9.0"
[features]
default = ["cli"]
cli = [
"dep:addr2line", "dep:clap", "dep:comfy-table", "dep:crossterm", "dep:dialoguer",
"dep:directories-next", "dep:env_logger", "dep:indicatif", "dep:lazy_static",
"dep:parse_int", "dep:regex", "dep:serde-hex", "dep:update-informer"
"dep:addr2line",
"dep:clap",
"dep:comfy-table",
"dep:crossterm",
"dep:dialoguer",
"dep:directories-next",
"dep:env_logger",
"dep:indicatif",
"dep:lazy_static",
"dep:parse_int",
"dep:regex",
"dep:serde-hex",
"dep:update-informer",
]
raspberry = ["dep:rppal"]
4 changes: 2 additions & 2 deletions espflash/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ If you would like to flash from a Raspberry Pi using the built-in UART periphera
cargo install espflash --features=raspberry
```

[libuv]: (https://libuv.org/)
[cargo-binstall]: (https://github.com/cargo-bins/cargo-binstall)
[libuv]: https://libuv.org/
[cargo-binstall]: https://github.com/cargo-bins/cargo-binstall
[releases]: https://github.com/esp-rs/espflash/releases

## Usage
Expand Down
21 changes: 11 additions & 10 deletions espflash/src/bin/espflash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ struct Cli {

#[derive(Debug, Subcommand)]
enum Commands {
/// Display information about the connected board and exit without flashing
BoardInfo(ConnectArgs),
/// Flash an application to a target device
Flash(FlashArgs),
Monitor(MonitorArgs),
PartitionTable(PartitionTableArgs),
Expand All @@ -42,30 +40,32 @@ enum Commands {

#[derive(Debug, Args)]
struct FlashArgs {
/// ELF image to flash
image: PathBuf,

/// Connection configuration
#[clap(flatten)]
connect_args: ConnectArgs,
/// Flashing configuration
#[clap(flatten)]
pub flash_config_args: FlashConfigArgs,
/// Flashing arguments
#[clap(flatten)]
flash_args: cli::FlashArgs,
/// ELF image to flash
image: PathBuf,
}

#[derive(Debug, Args)]
struct SaveImageArgs {
/// ELF image to flash
image: PathBuf,
/// Image format to flash
#[arg(long, value_enum)]
format: Option<ImageFormatKind>,

/// Flashing configuration
#[clap(flatten)]
pub flash_config_args: FlashConfigArgs,
/// Sage image arguments
#[clap(flatten)]
save_image_args: cli::SaveImageArgs,

/// ELF image to flash
image: PathBuf,
}

/// Writes a binary file to a specific address in the chip's flash
Expand All @@ -76,11 +76,12 @@ struct WriteBinArgs {
pub addr: u32,
/// File containing the binary data to write
pub bin_file: String,

/// Connection configuration
#[clap(flatten)]
connect_args: ConnectArgs,
}

/// Parses a string as a 32-bit unsigned integer.
fn parse_uint32(input: &str) -> Result<u32, ParseIntError> {
parse_int::parse(input)
}
Expand Down
3 changes: 3 additions & 0 deletions espflash/src/cli/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ pub struct UsbDevice {
}

impl UsbDevice {
/// Check if the given USB port matches this device
pub fn matches(&self, port: &UsbPortInfo) -> bool {
self.vid == port.vid && self.pid == port.pid
}
Expand All @@ -57,6 +58,7 @@ pub struct Config {
/// Preferred USB devices
#[serde(default)]
pub usb_device: Vec<UsbDevice>,
/// Path of the file to save the config to
#[serde(skip)]
save_path: PathBuf,
}
Expand All @@ -76,6 +78,7 @@ impl Config {
Ok(config)
}

/// Save the config to the config file
pub fn save_with<F: Fn(&mut Self)>(&self, modify_fn: F) -> Result<()> {
let mut copy = self.clone();
modify_fn(&mut copy);
Expand Down
Loading