probe-rs: 0.25 STM32U0 regression
Describe the bug
Hi all,
this used to work before just fine, but I’m now getting a SwdApFault error after flashing is finished on version 0.25.
This is for the U0 nucleo64 dev board with the on-board STLink v2.1 programmer.
Updating the Stlink firmware did not change anything.
It seems to do with reading data for RTT. Maybe a timeout was shortened or some process got faster so it’s now catching the AP at a bad time?
To Reproduce
- Run
probe-rs run --chip stm32u083rctxas the runner inconfig.toml - Call
cargo run --release - See the erase and flash succeed
- Error:
WARN probe_rs::probe::stlink: send_jtag_command 242 failed: SwdApFault
Error: Error communicating with the probe.
Caused by:
0: An ARM specific error occurred.
1: The debug probe encountered an error.
2: An error which is specific to the debug probe in use occurred.
3: Command failed with status SwdApFault.
This can be fixed by lowering the speed:
probe-rs run --chip stm32u083rctx --speed 950- Everything succeeds and RTT/Defmt logs can be seen
Expected behavior
No response
Stacktrace
Erasing ✔ 100% [####################] 52.00 KiB @ 38.24 KiB/s (took 1s)
Programming ✔ 100% [####################] 51.00 KiB @ 13.88 KiB/s (took 4s)
Finished in 3.68s
DEBUG probe_rs::architecture::arm::ap::memory_ap: reading IDR: IDR { REVISION: 8, DESIGNER: JEP106Code({ cc: 0x04, id: 0x3b } => Some("ARM Ltd")), CLASS: MemAp, _RES0: 0, VARIANT: 0, TYPE: AmbaAhb3 }
DEBUG probe_rs::architecture::arm::ap: Writing register CSW, value=CSW { DbgSwEnable: true, HNONSEC: false, MasterType: true, Allocate: false, Cacheable: true, Bufferable: false, Privileged: true, Data: true, SPIDEN: true, TrInProg: false, DeviceEn: true, AddrInc: Single, Size: U32, _reserved_bits: 0 }
DEBUG reset_and_halt: probe_rs::architecture::arm::core::armv6m: Reason for halt has changed, old reason was Halted(Breakpoint(Unknown)), new reason is Exception timeout=100ms
DEBUG probe_rs::architecture::arm::ap::memory_ap: reading IDR: IDR { REVISION: 8, DESIGNER: JEP106Code({ cc: 0x04, id: 0x3b } => Some("ARM Ltd")), CLASS: MemAp, _RES0: 0, VARIANT: 0, TYPE: AmbaAhb3 }
DEBUG probe_rs::architecture::arm::ap: Writing register CSW, value=CSW { DbgSwEnable: true, HNONSEC: false, MasterType: true, Allocate: false, Cacheable: true, Bufferable: false, Privileged: true, Data: true, SPIDEN: true, TrInProg: false, DeviceEn: true, AddrInc: Single, Size: U32, _reserved_bits: 0 }
DEBUG probe_rs::rtt: Scanning at exact address: 0x20000000
DEBUG probe_rs::util::rtt::client: RTT control block corrupted (write pointer is 1217181298 while buffer size is 1174648080 for channel 0 (☺$$♦ @))
DEBUG probe_rs::cmd::run: Cleared RTT header
DEBUG probe_rs::architecture::arm::ap::memory_ap: reading IDR: IDR { REVISION: 8, DESIGNER: JEP106Code({ cc: 0x04, id: 0x3b } => Some("ARM Ltd")), CLASS: MemAp, _RES0: 0, VARIANT: 0, TYPE: AmbaAhb3 }
DEBUG probe_rs::architecture::arm::ap: Writing register CSW, value=CSW { DbgSwEnable: true, HNONSEC: false, MasterType: true, Allocate: false, Cacheable: true, Bufferable: false, Privileged: true, Data: true, SPIDEN: true, TrInProg: false, DeviceEn: true, AddrInc: Single, Size: U32, _reserved_bits: 0 }
DEBUG probe_rs::architecture::arm::core::armv6m: Cached halt reason: Halted(Exception)
DEBUG probe_rs::architecture::arm::core::armv6m: Cached halt reason: Halted(Exception)
DEBUG run: probe_rs::architecture::arm::core::armv6m: Reason for halt has changed, old reason was Halted(Exception), new reason is Request
DEBUG probe_rs::rtt: Scanning at exact address: 0x20000000
WARN probe_rs::probe::stlink: send_jtag_command 242 failed: SwdApFault
DEBUG session_drop: probe_rs::architecture::arm::ap::memory_ap: reading IDR: IDR { REVISION: 8, DESIGNER: JEP106Code({ cc: 0x04, id: 0x3b } => Some("ARM Ltd")), CLASS: MemAp, _RES0: 0, VARIANT: 0, TYPE: AmbaAhb3 }
DEBUG session_drop: probe_rs::architecture::arm::ap: Writing register CSW, value=CSW { DbgSwEnable: true, HNONSEC: false, MasterType: true, Allocate: false, Cacheable: true, Bufferable: false, Privileged: true, Data: true, SPIDEN: true, TrInProg: false, DeviceEn: true, AddrInc: Single, Size: U32, _reserved_bits: 0 }
INFO session_drop: probe_rs::session: Halting core 0...
INFO session_drop: probe_rs::session: Clearing breakpoints for core 0
DEBUG session_drop: probe_rs::architecture::arm::ap::memory_ap: reading IDR: IDR { REVISION: 8, DESIGNER: JEP106Code({ cc: 0x04, id: 0x3b } => Some("ARM Ltd")), CLASS: MemAp, _RES0: 0, VARIANT: 0, TYPE: AmbaAhb3 }
DEBUG session_drop: probe_rs::architecture::arm::ap: Writing register CSW, value=CSW { DbgSwEnable: true, HNONSEC: false, MasterType: true, Allocate: false, Cacheable: true, Bufferable: false, Privileged: true, Data: true, SPIDEN: true, TrInProg: false, DeviceEn: true, AddrInc: Single, Size: U32, _reserved_bits: 0 }
DEBUG session_drop: probe_rs::session: Resuming core...
DEBUG session_drop: probe_rs::architecture::arm::ap::memory_ap: reading IDR: IDR { REVISION: 8, DESIGNER: JEP106Code({ cc: 0x04, id: 0x3b } => Some("ARM Ltd")), CLASS: MemAp, _RES0: 0, VARIANT: 0, TYPE: AmbaAhb3 }
DEBUG session_drop: probe_rs::architecture::arm::ap: Writing register CSW, value=CSW { DbgSwEnable: true, HNONSEC: false, MasterType: true, Allocate: false, Cacheable: true, Bufferable: false, Privileged: true, Data: true, SPIDEN: true, TrInProg: false, DeviceEn: true, AddrInc: Single, Size: U32, _reserved_bits: 0 }
DEBUG session_drop:run: probe_rs::architecture::arm::core::armv6m: Reason for halt has changed, old reason was Halted(Request), new reason is Request
DEBUG session_drop: probe_rs::architecture::arm::ap::memory_ap: reading IDR: IDR { REVISION: 8, DESIGNER: JEP106Code({ cc: 0x04, id: 0x3b } => Some("ARM Ltd")), CLASS: MemAp, _RES0: 0, VARIANT: 0, TYPE: AmbaAhb3 }
DEBUG session_drop: probe_rs::architecture::arm::ap: Writing register CSW, value=CSW { DbgSwEnable: true, HNONSEC: false, MasterType: true, Allocate: false, Cacheable: true, Bufferable: false, Privileged: true, Data: true, SPIDEN: true, TrInProg: false, DeviceEn: true, AddrInc: Single, Size: U32, _reserved_bits: 0 }
DEBUG probe_rs::probe::stlink: Current device mode: Jtag
Error: Error communicating with the probe.
Operating System
Windows
Additional context
Project on which I’m encountering this: https://github.com/diondokter/s2lp/tree/351a00b3f5fc0289e7ed07f2d1c5ff3e253f2a3d/examples
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 21 (20 by maintainers)
Hmmmm, the return address that’s set for the called flash functions is always set to the load address: https://github.com/probe-rs/probe-rs/blob/5e006737e70206a9852c9f3bcc656294f245987a/probe-rs/src/flashing/flasher.rs#L691-L700
So I don’t see why a change in load address would matter…
Alright, a git bisect later and the single commit in this PR is the first bad version: https://github.com/probe-rs/probe-rs/pull/2883
I don’t know of any tooling 😦 Maybe we should add some tooling for this 😃 But truth be told, dependent on command you might need to change a lot. I think git bisect should be able to take a shellscript and dependent on status code find out by itself. Since the command surface in probe-rs did not change since 0.24.0 for what you do, you should be able to do it this way 😃
I’ll do when I have time! Is there any specific probe-rs tooling for this? Or is doing it manually the best option?