Is it possible to use HW tracing from software?
Means enable trace and read the contents of the ETB from the code running on the same core.
Ok, found something, now need to try how it works:infocenter.arm.com/.../Cjhbdbfe.html
This should be possible, as long as the CoreSight trace components (the trace macrocell generating the tracedata i.e.ETM or PTM, the associated trace link and sink components) are all contained within the main system memory map.
If they are then you can access then programmatically.
If you are attempting to do this 'bare-metal' or under an RTOS, then we have an example of how to program up an ETM at
in sec. 4.5 'Program Examples'
As you have already found the programmers model for the Cortex-M33 ETB then I am guessing this is a Cortex-M33 system so 1 core, no trace funnels (i.e. trace links) so a fairly straightforward system to deal with.
You would want to :
Note that the trace is highly compressed so you would need to decode it <somehow>, import it into a tool or create an anaysis tool.
If however, you wanted to do the same under Linux, then you would use the CoreSIght Access Library (CSAL) which can be found on Arm's github account at
You may also find code extracts useful if you are doing this bare-metal.
Hope this helps ?
It is acutally on a Cortex-A9 (i.MX6Quad). I could read the trace registers with the debugger but currently have problems to activate the trace from software.I'll some more reading.
Thank you so far.
If you are using a Cortex-A9 then it uses Program Flow Trace (PFT) to provide instruction flow (trace) via a Program Trace Macrocell (PTM).
To program up the PTM to trace all, take a look here :
Of course, you will have to look at the NXP documentation to find the memory addresses. And I am assuming you are doing this under an RTOS, otherwise if it's Linux then use CSAL as described earlier.
strange, your earlier answer (and my reply to it) vanished. And with it the link to the CSAL, so I repeat it here:github.com/.../CSAL
Yes, I also see the same problem as well. I will see what had happened internally. Please bear with me.
In the meantime I hope all the previous information helped.
The trick was the OS_Lock Register.
View all questions in Cortex-A / A-Profile forum