[ABANDONED] PC sampling

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [ABANDONED] PC sampling

    Hello,
    I currently think about how I could profile my code. The target is an arm cortex m0 (Nordic nrf51422). I like program counter sampling as a statistical method, because the code doesn't have to be instrumented. Now I wonder, if I could use my Jlink-Debugger to sample the program counter (event at a very low rate) and the call stack (possible with some inconsistencies), without halting the CPU?

    Does some of you have experience with using the JLink for profiling?

    cheers,
    Torsten
  • Hi,

    Now I wonder, if I could use my Jlink-Debugger to sample the program counter (event at a very low rate) and the call stack (possible with some inconsistencies), without halting the CPU?

    No, not really without instrumenting the code.
    It is somewhat possible (but not really usable) via SWO, but this is not supported by the Cortex-M0.

    Possible solutions:
    Instrumented program code, using SEGGER RTT (segger.com/jlink-real-time-terminal.html)
    If you are using an OS, this might be an option: percepio.com/tz/


    Best regards
    Alex
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • Hi Alex,
    thanks for replying. Instrumenting code is to much hassle and impacts performance to much. I'm a big fan of statistic pc sampling, because it is usually easy to implement, more accurate and less intrusive. Unfortunately therefor I need a spare timer on the target, or some other mean to sample the pc and the stack.

    Cheers,
    Torsten