Add the following configuration to the prj.conf file:
CONFIG_TRACING=y
CONFIG_SEGGER_SYSTEMVIEW=y
Then build and flash the template for the target board, or pass the configurations directly on the west build command line:
west build -p -b <board> -- -DCONFIG_TRACING=y -DCONFIG_SEGGER_SYSTEMVIEW=y
Alternatively, use the RTT tracing snippet:
west build -p -b <board> -- -Dapp_SNIPPET=rtt-tracing