3 Commits
Author SHA1 Message Date
gnxlxnxx d7daa0fd3d Bump up Version to 0.1.1 2022-02-26 13:40:35 +01:00
gnxlxnxx 31e5205683 Update cargo-project 2022-02-26 13:39:47 +01:00
gnxlxnxx 2523cc8503 use download_from_slice function
this closes #4
2022-02-26 13:37:49 +01:00
3 changed files with 6 additions and 16 deletions
Generated
+3 -3
View File
@@ -72,7 +72,7 @@ checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8"
[[package]]
name = "cargo-dfu"
version = "0.0.4"
version = "0.1.1"
dependencies = [
"cargo-project",
"clap",
@@ -168,9 +168,9 @@ dependencies = [
[[package]]
name = "dfu-core"
version = "0.2.0"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3b82ffc1790e4af9371dbc3399c6c068a3ee506357632e21eb7111df199c59f3"
checksum = "00fab7382221c801db4853a1ff338bb1281e8f2f9b456e888793fef61c4d890c"
dependencies = [
"bytes",
"displaydoc",
+2 -2
View File
@@ -1,7 +1,7 @@
[package]
name = "cargo-dfu"
authors = ["Roman Kretschmer <roman@kretschmer.email>"]
version = "0.1.0"
version = "0.1.1"
edition = "2021"
description = "cargo extension for flashing embedded rust programs via dfu"
license = "MIT"
@@ -18,7 +18,7 @@ goblin = "0.2.3"
colored = "2.0.0"
rusb = "0.9.0"
pretty_env_logger = "0.3.0"
cargo-project = "0.2.4"
cargo-project = "0.2.7"
clap = {version = "3.0.10", features=["derive"]}
maplit = "1.0.2"
log = "0.4.6"
+1 -11
View File
@@ -64,17 +64,7 @@ pub fn flash_bin(binary: &[u8], d: &rusb::Device<GlobalContext>) -> Result<(), U
)
.map_err(|e| UtilError::Dfu(e))?;
std::fs::write("target/out.bin", binary).map_err(|e| UtilError::File(e))?;
dfu.download(
&mut std::fs::OpenOptions::new()
.read(true)
.open("target/out.bin")
.map_err(|e| UtilError::File(e))?,
std::fs::metadata("target/out.bin")
.map_err(|e| UtilError::File(e))?
.len() as u32,
)
.unwrap();
dfu.download_from_slice(binary).unwrap();
Ok(())
}