On 13/07/2023 23:06, Liviu Ionescu wrote:

On 13 Jul 2023, at 23:48, Tommy Murphy <tommy_mur...@hotmail.com> wrote:

I presume that the breakpoints used to implement semihosting (e.g. 0xBEAB for Cortex-M7) 
do actually cause the target to go into debug halt for a period of time even if they're 
subsequently automatically resumed as part of the semihosting mechanism? And it is those 
periods in debug halt mode (which will necessarily be "long" in terms of target 
execution time/cycles?) that Tomas is referring to as being intrusive to program 
execution on the target?
Tomas, is this what you are referring to? Can you elaborate?

Yes, exactly as Tommy explained.
With a modern MCU an application can easily keep the interrupt latency in microseconds or even less. Servicing a semihosting BKPT involves debug entry, the semihosting xfer itself and resume: it takes at least 30 milliseconds on average adapter and Cortex-M - all that time the core is in debug halt and interrupts cannot be serviced.

I mentioned it as a possible reason the silicon errata is not documented yet - I assume very few developers combine interrupts and semihosting together.


This is definitely not a problem for unit tests, the only interrupt of interest 
is SysTick, and the slight inaccuracy in time keeping is perfectly acceptable.
Agree, this is probably the only possible use case.
BTW did you consider using RTT channel instead of semihosted stdout? It suits much better for an app with enabled interrupts.


On 13/07/2023 23:43, Tommy Murphy wrote:
> and I thought that perhaps OpenOCD can do it. Was I too optimistic?

As a workaround could you configure a `debug-halted` handler to resume execution when this rogue breakpoint is hit?

Not 'debug-halted' but 'halted' (the 'debug-halted' event is issued at the end of a target algo, we have to fix the doc)

Unfortunately (if I'm not completely wrong guessing the mechanism of the errata) each rogue break also means that one semihosting operation gets skipped. So your test will keep running, time to time some semihosted output get lost.

T

Reply via email to