I debug NRF52 chip with JLink real time terminal. It’s pretty to use J-Link RTT viewer on my macOS. For example, I ran this command for open a RTT viewer window.
you@yourcomputer:~$JLinkExe -device nRF52 -speed 4000 -if SWD -autoconnect 1 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
We can use JLinkRTTClient to check the RTT output. But sometimes JLinkRTTClient will not reconnect if the JLinkExe reopened. A simple script can do this job
while true; do nc localhost 19021; sleep 2; done;
I’ve written this line in my makefile.