Repository navigation
Conversation
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.
Contributor
There was a problem hiding this comment.
🟡 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 on lines
+67
to
+68
| void tiny_printf(const char* fmt, ...); | ||
| # define wolfBoot_printf(_f_, ...) tiny_printf(_f_, ##__VA_ARGS__) |
| CFLAGS+=-DDEBUG_RTT | ||
| CFLAGS+=-I$(DEBUG_RTT) | ||
| CFLAGS+=-DPRINTF_ENABLED | ||
| OBJS+=$(DEBUG_RTT)/RTT/SEGGER_RTT.o |
| CFLAGS+=-DDEBUG_RTT | ||
| CFLAGS+=-I$(DEBUG_RTT) | ||
| CFLAGS+=-DPRINTF_ENABLED | ||
| OBJS+=$(DEBUG_RTT)/RTT/SEGGER_RTT.o |
| CFLAGS+=-DWOLFCRYPT_BENCHMARK | ||
| WOLFCRYPT_SUPPORT=1 | ||
| UART_PRINTF_FLOAT?=1 | ||
| PRINTF_FLOAT?=1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


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.