use anyhow::Result;
use probe_rs::{architecture::arm::DpAddress, Probe};
fn main() -> Result<()> {
pretty_env_logger::init();
let probes = Probe::list_all();
let mut probe: Probe = probes[0].open()?;
probe.set_speed(100)?;
probe.attach_to_unspecified()?;
let mut iface = probe
.try_into_arm_interface()
.unwrap()
.initialize_unspecified()
.unwrap();
let core0 = DpAddress::Multidrop(0x01002927);
let core1 = DpAddress::Multidrop(0x11002927);
println!(
"core0 DPIDR: {:08x}",
iface.read_raw_dp_register(core0, 0x00)?
);
println!(
"core0 TARGETID: {:08x}",
iface.read_raw_dp_register(core0, 0x24)?
);
println!(
"core1 DPIDR: {:08x}",
iface.read_raw_dp_register(core1, 0x00)?
);
println!(
"core1 TARGETID: {:08x}",
iface.read_raw_dp_register(core1, 0x24)?
);
Ok(())
}