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.
Cheers
Hi,
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
https://developer.arm.com/docs/ihi0064/g/embedded-trace-macrocell-architecture-specification-etmv40-to-etm45
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
https://github.com/ARM-software/CSAL
You may also find code extracts useful if you are doing this bare-metal.
Hope this helps ?
Regards,
Stuart
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.
The trick was the OS_Lock Register.