modm API documentation
|
Classes | |
class | modm::platform::Rtt |
lbuild module: modm:platform:rtt
This module implements the RTT protocol compatible with OpenOCD. RTT works by placing multiple ring-buffers in RAM which the debugger read and writes using background memory accesses via SWD. It therefore works on any Cortex-M devices without extra pins except for the SWDCLK and SWDIO.
See https://www.segger.com/jlink-rtt.html
The RTT channels are exposed as a UART interface which you can use like so:
You can define the number of channels and their buffer size by setting the buffer.tx
and buffer.rx
set options. Note that you can define multiple buffer sizes indexed by channel. Here is an example of three channels:
You can set the buffer size to 0
if you don't want to use this channel direction. This won't allocate a buffer and save a little RAM.
OpenOCD has built-in support for RTT and modm generates a config that opens each RTT channel as a TCP port starting at 9090 (ie. 9090=channel 0, 9091=channel 1, etc).
You can also call this from inside GDB via the monitor
command:
You can then use for example telnet 127.0.0.1 9090
to connect to the stream.
Note that this connection does not halt the target, you should therefore be able to use this at any point during program execution.
A simple telnet client is integrated into the build system generator, however, it can only connect to one stream at a time (disconnect with Ctrl+D).
If you want to use this as a proper communication channel with a custom protocol you should implement the OpenOCD config yourself (with different ports).
You can also use JLink to access the RTT data, which may be significantly faster than OpenOCD if the debug probe has hardware support for the protocol.
Generated with: [512] in [0 ... 64Ki]
Generated with: [0] in [0 ... 64Ki]