This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How to use RTT Viewer (or similar) on GNU/Linux?

It is pretty straight-forward to use J-Link RTT Viewer on Windows (as described in the Debugging with Real Time Terminal tutorial). Is there a similar viewer to use with GNU/Linux?

  • I assume that you have already installed the latest Software and documentation pack from SEGGER.

    To use the RTT Viewer equivalent on GNU/Linux, you must first set up the connection using JLinkExe. Provided that your DK or dongle is connected, starting JLinkExe from a terminal should look something like this:

    you@yourcomputer:~$ JLinkExe
    SEGGER J-Link Commander V5.10u (Compiled Mar 17 2016 19:06:22)
    DLL version V5.10u, compiled Mar 17 2016 19:06:19
    
    Connecting to J-Link via USB...O.K.
    Firmware: J-Link OB-SAM3U128-V2-NordicSemi compiled Mar 15 2016 18:03:17
    Hardware version: V1.00
    VTref = 3.300V
    
    
    Type "connect" to establish a target connection, '?' for help
    J-Link>
    

    JLinkExe may decide to update the firmware on the Segger programmer IC, which will give additional information between "Connecting to J-Link via USB..." and "O.K."

    The final line is a prompt. The "connect" command will present some choices along with default values and options. Defaults are mostly fine, but use "SWD" for target interface.

    If a connection is established the final lines of output should state "Cortex-M0 identified" (for nRF51) or "Cortex-M4 identified" (for nRF52), followed by the "J-Link>" prompt:

    (...)
    Cortex-M4 identified.
    J-Link>
    

    Now, from another terminal, start JLinkRTTClient. This program should connect automatically:

    you@yourcomputer:~$ JLinkRTTClient
    ###RTT Client: ************************************************************
    ###RTT Client: *           SEGGER MICROCONTROLLER GmbH & Co KG            *
    ###RTT Client: *   Solutions for real time microcontroller applications   *
    ###RTT Client: ************************************************************
    ###RTT Client: *                                                          *
    ###RTT Client: *  (c) 2012 - 2014  SEGGER Microcontroller GmbH & Co KG    *
    ###RTT Client: *                                                          *
    ###RTT Client: *     www.segger.com     Support: [email protected]       *
    ###RTT Client: *                                                          *
    ###RTT Client: ************************************************************
    ###RTT Client: *                                                          *
    ###RTT Client: * SEGGER J-Link RTT Client   Compiled May 27 2016 17:03:51 *
    ###RTT Client: *                                                          *
    ###RTT Client: ************************************************************
    
    ###RTT Client: -----------------------------------------------
    ###RTT Client: Connecting to J-Link RTT Server via localhost:19021  Connected.
    SEGGER J-Link V5.12g - Real time terminal output
    J-Link OB-SAM3U128-V2-NordicSemi compiled Mar 15 2016 18:03:17 V1.0, SN=682852586
    Process: JLinkExe
    

    You will now receive RTT output.

    If you happen to like telnet you can use it instead of JLinkRTTClient:

    you@yourcomputer:~$ telnet localhost 19021
    Trying 127.0.0.1...
    Connected to localhost.
    Escape character is '^]'.
    SEGGER J-Link V5.12g - Real time terminal output
    J-Link OB-SAM3U128-V2-NordicSemi compiled Mar 15 2016 18:03:17 V1.0, SN=682852586
    Process: JLinkExe
    

    You will now receive RTT output.

  • Note that to get the tab completion behavior to work correctly via the telnet client, we need to enter 'character at a time' mode.  To do this, after connecting, enter "^]", then "mode character":

    rtt_cli:~$ ^]
    telnet> mode character
    
    rtt_cli:~$ 
      app_size        balloc          clear           cli
      counter         dynamic         error           flashlog
      history         log             log_msg         nordic
      print           python          queue           reset
      resize          stack_overflow

  • Nice! "mode character" enables tab completion. But on my system it disables the backspace functionality (I cannot delete already written characters). Strangely enough, Ctrl+Backspace does the trick. Is it possible to enable normal backspace behaviour?

Related