302
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() implemen-
tations and does not require heap and only a configurable amount of stack.
The SEGGER RTT implementation is fully configurable at compile time with pre-processor
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() routines.
13.4.1
API functions
The following API functions are available in the RTT Implementation. To use them SEG-
GER_RTT.h has to be included in the calling sources.
SEGGER_RTT_ConfigDownBuffer()
SEGGER_RTT_ConfigUpBuffer()
SEGGER_RTT_GetKey()
SEGGER_RTT_HasKey()
SEGGER_RTT_Init()
SEGGER_RTT_printf()
SEGGER_RTT_Read()
SEGGER_RTT_SetTerminal()
SEGGER_RTT_TerminalOut()
SEGGER_RTT_WaitKey()
SEGGER_RTT_Write()
SEGGER_RTT_WriteString()
13.4.1.1
SEGGER_RTT_ConfigDownBuffer()
Configure or add a down buffer by specifying its name, size and flags.
Syntax
int SEGGER_RTT_ConfigDownBuffer (unsigned BufferIndex, const char* sName,
char* pBuffer, int BufferSize, int Flags);
Parameter
BufferIndex
sName
pBuffer
BufferSize
Flags
J-Link / J-Trace (UM08001)
CHAPTER 13
API functions
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).
Meaning
© 2004-2017 SEGGER Microcontroller GmbH & Co. KG
Implementation
Need help?
Do you have a question about the J-Link and is the answer not in the manual?