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

with programming

parent 21b69784
Branches
No related tags found
No related merge requests found
......@@ -8,4 +8,5 @@ edition = "2018"
[dependencies]
probe-rs = { path = "../../probe-rs/probe-rs", version = "0.3.0" }
ktest = { path = "../ktest", version = "0.1.0" }
\ No newline at end of file
ktest = { path = "../ktest", version = "0.1.0" }
failure = "0.1.6"
use failure::format_err;
use ktest::{read_ktest, KTEST};
use probe_rs::{
config::registry::{Registry, SelectionStrategy},
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},
session::Session,
target::info::{self, ChipInfo},
......@@ -16,6 +19,8 @@ fn main() {
let strategy = SelectionStrategy::ChipInfo(ChipInfo::read_from_rom_table(&mut probe).unwrap());
println!("strategy {:?}", strategy);
let strategy = SelectionStrategy::TargetIdentifier("stm32f411".into());
let registry = Registry::from_builtin_families();
let target = registry.get_target(strategy).unwrap();
......@@ -23,6 +28,19 @@ fn main() {
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();
let cpu_info = session
.target
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment