From 5cd795a421b1c7120b6b05001c0c9e373999bac7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noah=20H=C3=BCsser?= Date: Wed, 24 Nov 2021 21:07:04 +0100 Subject: [PATCH 1/5] Prepare for 0.12.0 --- CHANGELOG.md | 9 ++++++++- Cargo.toml | 6 +++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 27f02ae..69eb7c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +## [0.12.0] + +### Changed + +- Updated probe-rs to 0.12.0. + ## [0.11.0] ### Added @@ -145,7 +151,8 @@ Improved flashing for `cargo-flash` considering speed and useability. ## [0.2.0] - Introduce cargo-flash which can automatically build & flash the target elf file. -[Unreleased]: https://github.com/probe-rs/cargo-flash/compare/v0.11.0...master +[Unreleased]: https://github.com/probe-rs/cargo-flash/compare/v0.12.0...master +[0.12.0]: https://github.com/probe-rs/cargo-flash/releases/tag/v0.11.0..v0.12.0 [0.11.0]: https://github.com/probe-rs/cargo-flash/releases/tag/v0.10.1..v0.11.0 [0.10.1]: https://github.com/probe-rs/cargo-flash/releases/tag/v0.10.0..v0.10.1 [0.10.0]: https://github.com/probe-rs/cargo-flash/compare/v0.9.0...v0.10.0 diff --git a/Cargo.toml b/Cargo.toml index 792ff2b..82df4f7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cargo-flash" -version = "0.11.0" +version = "0.12.0" authors = ["Noah Hüsser ", "Dominik Boehi "] edition = "2018" description = "A utility to flash ARM cores with ELFs directly from within cargo." @@ -22,8 +22,8 @@ structopt = "0.3.25" env_logger = "0.9.0" lazy_static = "1.4.0" colored = "2.0.0" -probe-rs = { version = "0.11.0", git = "https://github.com/probe-rs/probe-rs" } -probe-rs-cli-util = { version = "0.11.0", git = "https://github.com/probe-rs/probe-rs", default-features = false, features=["anyhow"] } +probe-rs = { version = "0.12.0", git = "https://github.com/probe-rs/probe-rs" } +probe-rs-cli-util = { version = "0.12.0", git = "https://github.com/probe-rs/probe-rs", default-features = false, features=["anyhow"] } git-version = "0.3.5" anyhow = "1.0.48" bytesize = "1.1.0" From a14f1b3426ca48bcf8f64b790e7aea896e4c079b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noah=20H=C3=BCsser?= Date: Wed, 24 Nov 2021 22:11:15 +0100 Subject: [PATCH 2/5] Update to newest probe-rs --- Cargo.lock | 116 +++++++++++++++++++++++++++++----------------------- src/main.rs | 12 ++---- 2 files changed, 69 insertions(+), 59 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2098c18..7eb86e9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,12 +1,14 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +version = 3 + [[package]] name = "addr2line" version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3e61f2b7f93d2c7d2b08263acaa4a363b3e276806c68af6134c44f523bf1aacd" dependencies = [ - "gimli", + "gimli 0.25.0", ] [[package]] @@ -64,10 +66,10 @@ checksum = "e7a905d892734eea339e896738c14b9afce22b5318f64b951e70bf3844419b01" dependencies = [ "addr2line", "cc", - "cfg-if 1.0.0", + "cfg-if", "libc", "miniz_oxide", - "object", + "object 0.26.0", "rustc-demangle", ] @@ -100,9 +102,9 @@ checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" [[package]] name = "bitvec" -version = "0.19.5" +version = "0.22.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8942c8d352ae1838c9dda0b0ca2ab657696ef2232a20147cf1b30ae1a9cb4321" +checksum = "5237f00a8c86130a0cc317830e558b966dd7850d48a953d998c813f01a41b527" dependencies = [ "funty", "radium", @@ -145,7 +147,7 @@ dependencies = [ [[package]] name = "cargo-flash" -version = "0.11.0" +version = "0.12.0" dependencies = [ "anyhow", "bytesize", @@ -184,9 +186,9 @@ dependencies = [ [[package]] name = "cargo_toml" -version = "0.9.2" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c3596addfb02dcdc06f5252ddda9f3785f9230f5827fb4284645240fa05ad92" +checksum = "c6d613611c914a7db07f28526941ce1e956d2f977b0c5e2014fbfa42230d420f" dependencies = [ "serde", "serde_derive", @@ -199,12 +201,6 @@ version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e70cc2f62c6ce1868963827bd677764c62d07c3d9a3e1fb1177ee1a9ab199eb2" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -314,7 +310,7 @@ version = "0.8.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "80df024fbc5ac80f87dfef0d9f5209a252f2a497f7f42944cff24d8253cac065" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -380,9 +376,9 @@ dependencies = [ [[package]] name = "funty" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fed34cd105917e91daa4da6b3728c47b068749d6a62c59811f06ed2ac71d9da7" +checksum = "1847abb9cb65d566acd5942e94aea9c8f547ad02c98e1649326fc0e8910b8b1e" [[package]] name = "futures-channel" @@ -439,7 +435,7 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "wasi", ] @@ -449,6 +445,12 @@ name = "gimli" version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0a01e0497841a3b2db4f8afa483cce65f7e96a3498bd6c541734792aeac8fe7" + +[[package]] +name = "gimli" +version = "0.26.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78cc372d058dcf6d5ecd98510e7fbc9e5aec4d21de70f65fea8fecebcd881bd4" dependencies = [ "fallible-iterator", "stable_deref_trait", @@ -683,9 +685,9 @@ dependencies = [ [[package]] name = "jep106" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "939876d20519325db0883757e29e9858ee02919d0f03e43c74f69296caa314f4" +checksum = "e80f965a2a659a7a4d9cdb9821a869d6e33c10f3e094e8f7d01648063c425953" dependencies = [ "serde", ] @@ -713,11 +715,11 @@ checksum = "320cfe77175da3a483efed4bc0adc1968ca050b098ce4f2f1c13a56626128790" [[package]] name = "libftdi1-sys" -version = "1.0.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48d4806b4692bd438807416a9a297e1c8f778a47c2ea900a606a175137dfb1fb" +checksum = "4f115599b5073d108edfcc32daa1a673193323fc10559c33bed6cc20f2f0bf4d" dependencies = [ - "cfg-if 0.1.10", + "cfg-if", "libc", "pkg-config", "vcpkg", @@ -747,7 +749,7 @@ version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -764,9 +766,9 @@ checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" [[package]] name = "memchr" -version = "2.4.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b16bd47d9e329435e309c58469fe0791c2d0d1ba96ec0954152a5ae2b04387dc" +checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" [[package]] name = "mime" @@ -877,6 +879,15 @@ dependencies = [ "memchr", ] +[[package]] +name = "object" +version = "0.27.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67ac1d3f9a1d3616fd9a60c8d74296f22406a238b6a72f5cc1e6f314df4ffbf9" +dependencies = [ + "memchr", +] + [[package]] name = "once_cell" version = "1.8.0" @@ -890,7 +901,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "549430950c79ae24e6d02e0b7404534ecf311d94cc9f861e9e4020187d13d885" dependencies = [ "bitflags", - "cfg-if 1.0.0", + "cfg-if", "foreign-types", "libc", "once_cell", @@ -948,8 +959,8 @@ checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" [[package]] name = "probe-rs" -version = "0.11.0" -source = "git+https://github.com/probe-rs/probe-rs#7417aa38aefb4f8e8d8336eb9c2dc040351749c1" +version = "0.12.0" +source = "git+https://github.com/probe-rs/probe-rs#ed0275593639031a6301ba47734b428b2ba609f8" dependencies = [ "anyhow", "base64", @@ -957,7 +968,7 @@ dependencies = [ "bitfield", "bitvec", "enum-primitive-derive", - "gimli", + "gimli 0.26.1", "hidapi", "ihex", "jaylink", @@ -965,7 +976,7 @@ dependencies = [ "libftdi1-sys", "log", "num-traits", - "object", + "object 0.27.1", "once_cell", "probe-rs-target", "rusb", @@ -980,8 +991,8 @@ dependencies = [ [[package]] name = "probe-rs-cli-util" -version = "0.11.0" -source = "git+https://github.com/probe-rs/probe-rs#7417aa38aefb4f8e8d8336eb9c2dc040351749c1" +version = "0.12.0" +source = "git+https://github.com/probe-rs/probe-rs#ed0275593639031a6301ba47734b428b2ba609f8" dependencies = [ "anyhow", "cargo_metadata", @@ -1003,8 +1014,8 @@ dependencies = [ [[package]] name = "probe-rs-target" -version = "0.11.0" -source = "git+https://github.com/probe-rs/probe-rs#7417aa38aefb4f8e8d8336eb9c2dc040351749c1" +version = "0.12.0" +source = "git+https://github.com/probe-rs/probe-rs#ed0275593639031a6301ba47734b428b2ba609f8" dependencies = [ "base64", "jep106", @@ -1061,9 +1072,9 @@ dependencies = [ [[package]] name = "radium" -version = "0.5.3" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "941ba9d78d8e2f7ce474c015eea4d9c6d25b6a3327f9832ee29a4de27f91bbb8" +checksum = "643f8f41a8ebc4c5dc4515c82bb8abd397b527fc20fd681b7c011c2aee5d44fb" [[package]] name = "rand" @@ -1349,18 +1360,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.126" +version = "1.0.130" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec7505abeacaec74ae4778d9d9328fe5a5d04253220a85c4ee022239fc996d03" +checksum = "f12d06de37cf59146fbdecab66aa99f9fe4f78722e3607577a5375d66bd0c913" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.126" +version = "1.0.130" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "963a7dbc9895aeac7ac90e74f34a5d5261828f79df35cbed41e10189d3804d43" +checksum = "d7bc1a1ab1961464eae040d96713baa5a724a8152c1222492465b54322ec508b" dependencies = [ "proc-macro2", "quote", @@ -1404,9 +1415,9 @@ dependencies = [ [[package]] name = "simplelog" -version = "0.10.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59d0fe306a0ced1c88a58042dc22fc2ddd000982c26d75f6aa09a394547c41e0" +checksum = "8baa24de25f3092d9697c76f94cf09f67fca13db2ea11ce80c2f055c1aaf0795" dependencies = [ "chrono", "log", @@ -1473,9 +1484,9 @@ dependencies = [ [[package]] name = "svg" -version = "0.9.3" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1206d132b55a9c93e12b7e6f9044a27b563a8dea3a39d9bc1764d613a7dd3fa" +checksum = "e72d8b19ab05827afefcca66bf47040c1e66a0901eb814784c77d4ec118bd309" [[package]] name = "syn" @@ -1500,7 +1511,7 @@ version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "rand", "redox_syscall", @@ -1648,7 +1659,7 @@ version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09adeb8c97449311ccd28a427f96fb563e7fd31aabf994189879d9da2394b89d" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "pin-project-lite", "tracing-core", ] @@ -1776,7 +1787,7 @@ version = "0.2.74" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d54ee1d4ed486f78874278e63e4069fc1ab9f6a18ca492076ffb90c5eb2997fd" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "serde", "serde_json", "wasm-bindgen-macro", @@ -1803,7 +1814,7 @@ version = "0.4.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5fba7978c679d53ce2d0ac80c8c175840feb849a161664365d1287b41f2e67f1" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "js-sys", "wasm-bindgen", "web-sys", @@ -1890,9 +1901,12 @@ dependencies = [ [[package]] name = "wyz" -version = "0.2.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85e60b0d1b5f99db2556934e21937020776a5d31520bf169e851ac44e6420214" +checksum = "129e027ad65ce1453680623c3fb5163cbf7107bfe1aa32257e7d0e63f9ced188" +dependencies = [ + "tap", +] [[package]] name = "yaml-rust" diff --git a/src/main.rs b/src/main.rs index 9c5af9b..ec45ed7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -6,8 +6,7 @@ use std::{env, path::PathBuf, process, sync::Arc}; use std::{panic, sync::Mutex}; use structopt::StructOpt; -use probe_rs_cli_util::argument_handling; -use probe_rs_cli_util::common_options::{self, cargo_help_message, FlashOptions, OperationError}; +use probe_rs_cli_util::common_options::{CargoOptions, FlashOptions, OperationError}; use probe_rs_cli_util::flash; #[cfg(feature = "sentry")] @@ -75,7 +74,7 @@ fn main_try() -> Result<(), OperationError> { // Parse the commandline options with structopt. let matches = FlashOptions::clap() .bin_name("cargo flash") - .after_help(cargo_help_message("cargo flash").as_str()) + .after_help(CargoOptions::help_message("cargo flash").as_str()) .get_matches_from(&args); let opt = FlashOptions::from_clap(&matches); @@ -116,9 +115,6 @@ fn main_try() -> Result<(), OperationError> { })?; log::debug!("Changed working directory to {}", work_dir.display()); - args.remove(0); // remove executable name - argument_handling::remove_arguments(&common_options::common_arguments(), &mut args); - // Get the path to the ELF binary we want to flash. // This can either be give from the arguments or can be a cargo build artifact. let path: PathBuf = if let Some(path) = &opt.elf { @@ -136,7 +132,7 @@ fn main_try() -> Result<(), OperationError> { } else { OperationError::FailedToBuildCargoProject(error) } - })? + })?.path().into() }; logging::println(format!( @@ -175,7 +171,7 @@ fn main_try() -> Result<(), OperationError> { // Flash the binary let flashloader = opt.probe_options.build_flashloader(&mut session, &path)?; - flash::run_flash_download(&mut session, &path, &opt, flashloader)?; + flash::run_flash_download(&mut session, &path, &opt, flashloader, false)?; // Reset target according to CLI options { From 21bf1d26eb15518ffbe39d591a4af90d6db91b9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noah=20H=C3=BCsser?= Date: Wed, 24 Nov 2021 22:14:01 +0100 Subject: [PATCH 3/5] Run rustfmt --- src/main.rs | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/main.rs b/src/main.rs index ec45ed7..54abbb1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -121,18 +121,21 @@ fn main_try() -> Result<(), OperationError> { path.into() } else { // Build the project, and extract the path of the built artifact. - build_artifact(&work_dir, &args).map_err(|error| { - if let Some(ref work_dir) = opt.work_dir { - OperationError::FailedToBuildExternalCargoProject { - source: error, - // This unwrap is okay, because if we get this error, the path was properly canonicalized on the internal - // `cargo build` step. - path: work_dir.canonicalize().unwrap(), + build_artifact(&work_dir, &args) + .map_err(|error| { + if let Some(ref work_dir) = opt.work_dir { + OperationError::FailedToBuildExternalCargoProject { + source: error, + // This unwrap is okay, because if we get this error, the path was properly canonicalized on the internal + // `cargo build` step. + path: work_dir.canonicalize().unwrap(), + } + } else { + OperationError::FailedToBuildCargoProject(error) } - } else { - OperationError::FailedToBuildCargoProject(error) - } - })?.path().into() + })? + .path() + .into() }; logging::println(format!( From 7da30a7c0be420185d5ff286213c10186922dbee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noah=20H=C3=BCsser?= Date: Wed, 24 Nov 2021 22:44:51 +0100 Subject: [PATCH 4/5] Fix broken args --- src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 54abbb1..44061f7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -121,7 +121,7 @@ fn main_try() -> Result<(), OperationError> { path.into() } else { // Build the project, and extract the path of the built artifact. - build_artifact(&work_dir, &args) + build_artifact(&work_dir, &args[1..]) .map_err(|error| { if let Some(ref work_dir) = opt.work_dir { OperationError::FailedToBuildExternalCargoProject { From a08486adbed75179397c669709da2b3c44d8d46d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noah=20H=C3=BCsser?= Date: Wed, 24 Nov 2021 23:09:10 +0100 Subject: [PATCH 5/5] Fix broken args --- src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 44061f7..c65f38f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -121,7 +121,7 @@ fn main_try() -> Result<(), OperationError> { path.into() } else { // Build the project, and extract the path of the built artifact. - build_artifact(&work_dir, &args[1..]) + build_artifact(&work_dir, &opt.cargo_options.to_cargo_options()) .map_err(|error| { if let Some(ref work_dir) = opt.work_dir { OperationError::FailedToBuildExternalCargoProject {