13.4 Implementation
The SEGGER RTT implementation code is written in ANSI C and can be integrated into
any embedded application by simply adding the available sources.
RTT can be used via a simple and easy to use API. It is even possible to override the
standard printf() functions to be used with RTT. Using RTT reduces the time taken for
output to a minimum and allows printing debug information to the host computer
while the application is performing time critical real time tasks.
The implementation code also includes a simple version of printf() which can be used
to write formatted strings via RTT. It is smaller than most standard library printf()
implementations and does not require heap and only a configureable ammount of
stack.
The SEGGER RTT implementation is fully configureable at compile time with pre-pro-
cessor defines. The number of channels, the size of the default channels can be set.
Reading and writing can be made task-safe with definable Lock() and Unlock() rou-
tines.
13.4.1 API functions
The following API functions are available in the RTT Implementation. To use them
SEGGER_RTT.h has to be included in the calling sources.
13.4.1.1 SEGGER_RTT_ConfigDownBuffer()
Description
Configure or add a down buffer by specifying its name, size and flags.
Prototype
int SEGGER_RTT_ConfigDownBuffer (unsigned BufferIndex, const char* sName,
char* pBuffer, int BufferSize, int Flags);
Parameters
Parameter
BufferIndex
sName
pBuffer
BufferSize
Flags
Table 13.1: SEGGER_RTT_ConfigDownBuffer() parameter list
Return value
>= 0
O.K.
< 0
Error.
Example
//
// Configure down channel 1
//
SEGGER_RTT_ConfigDownChannel(1, "DataIn", &abDataIn[0], sizeof(abDataIn),
Additional information
Once a channel is configured only the flags of the channel should be changed.
J-Link / J-Trace (UM08001)
Index of the buffer to configure. Must be lower than
SEGGER_RTT_MAX_NUM_DOWN_CHANNELS.
Pointer to a 0-terminated string to be displayed as the name of the
channel.
Pointer to a buffer used by the channel.
Size of the buffer in Bytes.
Flags of the channel (blocking or non-blocking).
SEGGER_RTT_MODE_NO_BLOCK_SKIP);
Meaning
© 2004-2017 SEGGER Microcontroller GmbH & Co. KG
361
Need help?
Do you have a question about the J-Link and is the answer not in the manual?