Skip to content

Add SEGGER RTT debug output support - #969

Open
vhdirk wants to merge 1 commit into
wolfSSL:masterfrom
vhdirk:rtt
Open

vhdirk wants to merge 1 commit into
wolfSSL:masterfrom
vhdirk:rtt

Conversation

@vhdirk

@vhdirk vhdirk commented Nov 3, 2026

Copy link
Copy Markdown

This PR adds support for SEGGER RTT as an alternative output backend for print statements. It piggy-backs onto the existing minimal UART printf implementation, sharing the formatter rather than introducing a separate one. RTT output uses up-channel 0; UART takes precedence when both backends are enabled.

To enable RTT, check out https://github.com/SEGGERMicro/RTT and build with DEBUG_RTT=/path/to/segger_rtt and DEBUG_UART=0. Supply the configuration header as SEGGER_RTT_Conf.h and add its directory using CFLAGS_EXTRA=-I/path/to/rtt_config/. The build links the RTT implementation and enables PRINTF_ENABLED automatically.

Add RTT as an alternative output backend for the existing minimal UART printf implementation, sharing the formatter rather than introducing a separate one. RTT output uses up-channel 0; UART takes precedence when both backends are enabled.

To enable RTT, check out https://github.com/SEGGERMicro/RTT and build with DEBUG_RTT=/path/to/segger_rtt and DEBUG_UART=0. Supply the configuration header as SEGGER_RTT_Conf.h and add its directory using CFLAGS_EXTRA=-I/path/to/rtt_config/. The build links the RTT implementation and enables PRINTF_ENABLED automatically.
Copilot AI balanced review requested due to automatic review settings November 3, 2026 14:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The entry-point rename and incomplete RTT integration break unit-test, stage-1, and test-app builds, while the benchmark default no longer enables floating-point output.

4 open issues
What changed in this PR

Adds SEGGER RTT as an alternative logging backend, reusing wolfBoot’s minimal formatter and preserving UART precedence when both backends are enabled.

Changes:

  • Routes the shared formatter to UART or RTT up-channel 0.
  • Adds RTT build settings and setup documentation.
  • Renames formatter entry points and updates float-formatting guards and existing tests.
File Description
tools/​unit-tests/​unit-string.c Updates tests to use the renamed formatter functions.
test-app/​syscalls.c Uses the backend-neutral float-formatting guard.
test-app/​Makefile Adjusts float-formatting defaults and compiler definitions.
src/​string.c Shares formatting code between UART and RTT output.
options.mk Adds RTT include paths, compiler flags, and implementation object.
include/​printf.h Routes logging through tiny_printf for either backend.
docs/​compile.md Documents RTT configuration and UART precedence.
arch.mk Adds a DEBUG_RTT=1 compiler-definition check.

Review effort: Balanced

Comment thread include/printf.h
Comment on lines +67 to +68
void tiny_printf(const char* fmt, ...);
# define wolfBoot_printf(_f_, ...) tiny_printf(_f_, ##__VA_ARGS__)
Comment thread options.mk
CFLAGS+=-DDEBUG_RTT
CFLAGS+=-I$(DEBUG_RTT)
CFLAGS+=-DPRINTF_ENABLED
OBJS+=$(DEBUG_RTT)/RTT/SEGGER_RTT.o
Comment thread options.mk
CFLAGS+=-DDEBUG_RTT
CFLAGS+=-I$(DEBUG_RTT)
CFLAGS+=-DPRINTF_ENABLED
OBJS+=$(DEBUG_RTT)/RTT/SEGGER_RTT.o
Comment thread test-app/Makefile
CFLAGS+=-DWOLFCRYPT_BENCHMARK
WOLFCRYPT_SUPPORT=1
UART_PRINTF_FLOAT?=1
PRINTF_FLOAT?=1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants