Chapter 221. Configuration

This chapter shows how to incorporate the RTT support into an eCos configuration, and how to configure it once included.

221.1. Configuration Overview

The RTT support is contained in a single eCos package CYGPKG_RTT. However, some functionality may be dependant on other eCos features. e.g. the Cortex-M HAL.

221.1.1. Quick Start

Incorporating the RTT support into your application is straightforward. The essential starting point is to incorporate the RTT eCos package (CYGPKG_RTT) into your configuration.

This may be achieved directly using ecosconfig add on the command line, or the Build->Packages… menu item within the eCos Configuration Tool.

Depending on the RTT package configuration, and the other packages present in the configuration, further package specific configuration may be required. For example, the CYGPKG_HAL_CORTEXM packages allows for the use of RTT for HAL diagnostics, but the option needs to be explicitly selected.

221.1.2. Options

Various package specific configuration settings define how the RTT world is present.

CYGNUM_RTT_MAX_UP_BUFFERS
This option configures the number of UP buffers (Target->Host) available. This value should be at least 2 if also using CYGPKG_SYSTEMVIEW for event tracing.
CYGNUM_RTT_BUFFER_SIZE_UP
This option configures the size (in bytes) of the buffer used for terminal output (UP channel 0) from the Target to the Host.
CYGNUM_RTT_MAX_DOWN_BUFFER
This option configures the number of DOWN buffers (Host->Target) available.
CYGNUM_RTT_BUFFER_SIZE_DOWN
This option configures the size (in bytes) of the buffer for terminal input from the Host to the Target. For exampe this could be used for keyboard input. Normally the terminal DOWN buffer can be significantly smaller than the corresponding terminal UP buffer since external tool interaction is going to be less than diagnostics generated.
CYGNUM_RTT_BUFFER_SIZE_PRINTF
This option configures the size of the internal buffer used for RTT bulk-send of printf characters via RTT.
CYG_RTT_MODE
This option sets the default, initial, operation mode for Target->Host buffers. Use NO_BLOCK_SKIP for non-blocking TX where data not yet uploaded is overwritten. Use NO_BLOCK_TRIM for non-blocking TX where further data is dropped if the upload buffer is full. Use BLOCK_IF_FIFO_FULL when the RTT calls should block until space is available in the upload buffer, so no data is lost. The default setting can be over-ridden at run-time by an application if required, via the SEGGER_RTT_ConfigUpBuffer() function.
CYGNUM_RTT_MEMCPY_BYTELOOP
If required this option replaces the standard memcpy() usage with a byte loop. The byte loop can have a lower overhead than memcpy() if small amounts of data are being copied, and may be required for some architectures where memory access restrictions are in place.
CYGNUM_RTT_MAX_INTR_PRI
The priority for the RTT lock.
CYGDAT_RTT_SECTION

This option defines a string with the name of the section to be used for the RTT data objects. If relevent for a target configuration this will allow the explicit placing of the RTT structures into a specific memory area (e.g. SRAM). It is the responsibility of the developer to choose a section name supported by the target architecture linker script. For example, for most target architectures this can be a section named with the prefix “.sram”, e.g. “.sram.rtt”. If the option is not enabled then the RTT data structures are linked to the normal data section for the target configuration.

If this option is enabled then the further option CYGDAT_RTT_BUFFER_SECTION is available, which can be set to allow the explicit placement of RTT buffers. The CYGDAT_RTT_BUFFER_SECTION option defines the string with the name of the section to be used for the RTT up and down “Terminal” buffers. If this option is not enabled, but CYGDAT_RTT_SECTION is, then the buffers will be placed in the named CYGDAT_RTT_SECTION.

CYGBLD_RTT_PRINTF
The SEGGER_RTT_printf() implementation is not normally required, since the standard eCos diag_printf() provides similar functionality. This option can be enabled if required by the application.