Skip to content
Snippets Groups Projects
Commit 8c346413 authored by Per's avatar Per
Browse files

with programming

parent 21b69784
Branches master
No related tags found
No related merge requests found
...@@ -9,3 +9,4 @@ edition = "2018" ...@@ -9,3 +9,4 @@ edition = "2018"
[dependencies] [dependencies]
probe-rs = { path = "../../probe-rs/probe-rs", version = "0.3.0" } probe-rs = { path = "../../probe-rs/probe-rs", version = "0.3.0" }
ktest = { path = "../ktest", version = "0.1.0" } ktest = { path = "../ktest", version = "0.1.0" }
failure = "0.1.6"
use failure::format_err;
use ktest::{read_ktest, KTEST}; use ktest::{read_ktest, KTEST};
use probe_rs::{ use probe_rs::{
config::registry::{Registry, SelectionStrategy}, config::registry::{Registry, SelectionStrategy},
coresight::access_ports::AccessPortError, coresight::access_ports::AccessPortError,
flash::download::FileDownloadError, flash::download::{
download_file, download_file_with_progress_reporting, FileDownloadError, Format,
},
probe::{stlink, DebugProbe, DebugProbeError, DebugProbeType, MasterProbe, WireProtocol}, probe::{stlink, DebugProbe, DebugProbeError, DebugProbeType, MasterProbe, WireProtocol},
session::Session, session::Session,
target::info::{self, ChipInfo}, target::info::{self, ChipInfo},
...@@ -16,6 +19,8 @@ fn main() { ...@@ -16,6 +19,8 @@ fn main() {
let strategy = SelectionStrategy::ChipInfo(ChipInfo::read_from_rom_table(&mut probe).unwrap()); let strategy = SelectionStrategy::ChipInfo(ChipInfo::read_from_rom_table(&mut probe).unwrap());
println!("strategy {:?}", strategy); println!("strategy {:?}", strategy);
let strategy = SelectionStrategy::TargetIdentifier("stm32f411".into());
let registry = Registry::from_builtin_families(); let registry = Registry::from_builtin_families();
let target = registry.get_target(strategy).unwrap(); let target = registry.get_target(strategy).unwrap();
...@@ -23,6 +28,19 @@ fn main() { ...@@ -23,6 +28,19 @@ fn main() {
let mut session = Session::new(target, probe); let mut session = Session::new(target, probe);
let mm = session.target.memory_map.clone();
let path_str = "../target/thumbv7em-none-eabihf/debug/examples/f401_break";
// programming
download_file(
&mut session,
std::path::Path::new(&path_str.to_string().as_str()),
Format::Elf,
&mm,
)
.map_err(|e| format_err!("failed to flash {}: {}", path_str, e))
.unwrap();
// session.probe.target_reset().unwrap(); // session.probe.target_reset().unwrap();
let cpu_info = session let cpu_info = session
.target .target
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment