From ee41d245c8b8c230e7ec2b65a0dc3f24899c33ee Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 23 Jan 2026 14:42:43 +0100 Subject: [PATCH] issues with RTT --- firmware/.cargo/config.toml | 2 +- firmware/examples/defmt/Cargo.toml | 2 +- probe-rs-test/src/main.rs | 19 ++++++++++++++++++- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/firmware/.cargo/config.toml b/firmware/.cargo/config.toml index e95c744..62912ba 100644 --- a/firmware/.cargo/config.toml +++ b/firmware/.cargo/config.toml @@ -11,7 +11,7 @@ rustflags = [ # If this is not enabled, debugging / stepping can become problematic. "-Cforce-frame-pointers=yes", # Can be useful for debugging. - # "-Clink-args=-Map=app.map" + "-Clink-args=-Map=app.map" ] [build] diff --git a/firmware/examples/defmt/Cargo.toml b/firmware/examples/defmt/Cargo.toml index 178db63..358b431 100644 --- a/firmware/examples/defmt/Cargo.toml +++ b/firmware/examples/defmt/Cargo.toml @@ -9,7 +9,7 @@ repository = "https://egit.irs.uni-stuttgart.de/rust/zynq7000-rs" license = "MIT OR Apache-2.0" [dependencies] -aarch32-cpu = { version = "0.1" } +aarch32-cpu = { version = "0.1", features = ["critical-section-single-core"] } zynq7000-rt = { path = "../../zynq7000-rt" } zynq7000 = { path = "../../zynq7000" } zynq7000-hal = { path = "../../zynq7000-hal", features = ["defmt"] } diff --git a/probe-rs-test/src/main.rs b/probe-rs-test/src/main.rs index 55ac0f6..df9fbd8 100644 --- a/probe-rs-test/src/main.rs +++ b/probe-rs-test/src/main.rs @@ -2,10 +2,11 @@ use std::{path::Path, time::Duration}; use anyhow::Context; use probe_rs::{ - Permissions, + MemoryInterface, Permissions, architecture::arm::{FullyQualifiedApAddress, core::registers::cortex_m::PC}, flashing::{ElfOptions, Format, build_loader}, probe::list::Lister, + rtt::{Rtt, RttChannel, ScanRegion}, vendor::amd::sequences::x7z::AccessPort, }; @@ -55,7 +56,23 @@ fn main() -> anyhow::Result<()> { core.write_core_reg(PC.id, loader.vector_table_addr().unwrap()) .with_context(|| "setting PC")?; core.run().with_context(|| "resuming core")?; + println!("trying to find CB"); + let range = vec![(0x100000_u64..0x110000)]; + let rtt_cb = Rtt::find_contol_block(&mut core, &ScanRegion::Ranges(range))?; + println!("RTT CB: {:#x}", rtt_cb); + let mut rtt = Rtt::attach_at(&mut core, rtt_cb)?; + let mut buf: [u8; 1024] = [0; 1024]; + core.read(rtt_cb, &mut buf[0..12])?; + println!("RTT CB: {:#x?}", &buf[0..12]); loop { + /* + for up_ch in rtt.up_channels() { + let read_bytes = up_ch.read(&mut core, &mut buf)?; + if read_bytes > 0 { + println!("read bytes {} on UP channel", read_bytes); + } + } + */ std::thread::sleep(Duration::from_millis(100)); } }