Reading ETB from software

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

Parents
  • 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 :

    1. enable the trace sink (ETB) first,
    2. then the ETM,
    3. then run the code that is to be traced
    4. then halt ETM
    5. halt ETB,
    6. flush through any trace outstanding in the ETB.

    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

Reply
  • 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 :

    1. enable the trace sink (ETB) first,
    2. then the ETM,
    3. then run the code that is to be traced
    4. then halt ETM
    5. halt ETB,
    6. flush through any trace outstanding in the ETB.

    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

Children
More questions in this forum