Using SWO for Character Output in Production with J-Link Commander (No Debug)

  • I’m working in a production setup (not a development/debug session), where each board must be prepared before its main flash image is programmed. Our process is (simulated with EVK):

    1. Connect to the MIMXRT1021-EVK via a Segger J-Link (SWD + SWO).
    2. Use J-Link Commander (JLink.exe / JLinkCommander) to load our custom firmware into RAM.
    3. Start execution immediately with the g command.

    In this context I do not attach a debugger or IDE—everything runs “headless” via J-Link Commander scripts. What I’d like to do is have the running firmware emit simple status or log messages over the SWO pin (ITM port 0 → TPIU), so that our production test station can capture and display these messages without stopping the CPU.
    My questions are:

    1. Is it possible to enable and view SWO output purely from J-Link Commander, without starting a full debug session?
    2. If so, what is the exact sequence of J-Link Commander commands to

      • configure the SWO pin protocol and baud rate,
      • enable the ITM stimulus port,
      • and capture the output in the console?

    I’m already comfortable initializing SWO in firmware (DEMCR, TPIU, ITM regs, etc.), but I need to know the proper J-Link Commander commands to turn on the trace port and route its output to the stdout of J-Link Commander.
    Any example scripts or pointers to the relevant manual sections would be greatly appreciated!
    Thank you in advance,

    Max

  • Hello,

    The SWO Viewer should be a suitable tool for this use case.
    It is included as part of the J-Link Software & Documentation Pack.
    For instructions on how to attach it to your target, please refer to:
    https://kb.segger.com/J-Link_SWO_Viewer#-swoattach

    Best regards,
    Simon

    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: https://www.segger.com/ticket/

    Or you can contact us via e-mail.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!