mirror of
https://github.com/gnxlxnxx/cargo-dfu.git
synced 2026-07-27 07:13:02 +02:00
remove address
dfu-libusb does that internally so I don't need to specify that here
This commit is contained in:
+2
-4
@@ -137,14 +137,12 @@ fn main() {
|
|||||||
|
|
||||||
println!(" {} {:?}", "Flashing".green().bold(), path);
|
println!(" {} {:?}", "Flashing".green().bold(), path);
|
||||||
|
|
||||||
let (binary, address) = elf_to_bin(path).unwrap();
|
let (binary, _) = elf_to_bin(path).unwrap();
|
||||||
|
|
||||||
// Start timer.
|
// Start timer.
|
||||||
let instant = Instant::now();
|
let instant = Instant::now();
|
||||||
|
|
||||||
// let bininfo = hf2::bin_info(&d).expect("bin_info failed");
|
flash_bin(&binary, &d.device()).unwrap();
|
||||||
// log::debug!("{:?}", bininfo);
|
|
||||||
flash_bin(&binary, address, &d.device()).unwrap();
|
|
||||||
|
|
||||||
// Stop timer.
|
// Stop timer.
|
||||||
let elapsed = instant.elapsed();
|
let elapsed = instant.elapsed();
|
||||||
|
|||||||
+1
-5
@@ -54,11 +54,7 @@ pub fn elf_to_bin(path: PathBuf) -> Result<(Vec<u8>, u32), UtilError> {
|
|||||||
Ok((data, start_address as u32))
|
Ok((data, start_address as u32))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn flash_bin(
|
pub fn flash_bin(binary: &[u8], d: &rusb::Device<GlobalContext>) -> Result<(), UtilError> {
|
||||||
binary: &[u8],
|
|
||||||
address: u32,
|
|
||||||
d: &rusb::Device<GlobalContext>,
|
|
||||||
) -> Result<(), UtilError> {
|
|
||||||
let mut dfu = dfu_libusb::DfuLibusb::open(
|
let mut dfu = dfu_libusb::DfuLibusb::open(
|
||||||
&rusb::Context::new().unwrap(),
|
&rusb::Context::new().unwrap(),
|
||||||
d.device_descriptor().unwrap().vendor_id(),
|
d.device_descriptor().unwrap().vendor_id(),
|
||||||
|
|||||||
Reference in New Issue
Block a user