Add support for SEGGER RTT STDIO #775
No reviewers
Labels
No labels
bazel
bluetooth
board settings
boot_stage2
bug
build
c++
can't reproduce
clang
clib-interface
cmsis
code cleanliness
code size
compiler version issues
cyw43_driver
debug
discussion
documentation
duplicate
dynamic_clock
elf2uf2
enhancement
errata
filesystem
flash layout
floating point
FreeRTOS
hardware_adc
hardware_claim
hardware_clocks
hardware_dma
hardware_exception
hardware_flash
hardware_gpio
hardware_i2c
hardware_irq
hardware_pio
hardware_pwm
hardware_rcp
hardware_rtc
hardware_spi
hardware_sync
hardware_uart
hardware_vreg
hardware_watchdog
hardware_xosc
help wanted
host
IAR
installation
invalid
linker scripts
lto
lwip
mbedtls
missing API
needs reporter detail
networking
newlib
newlib-multicore
non-c
non-cmake
non-gcc
openocd
orphan PR
OS integration
pico_async_context
pico_base
pico_binary_info
pico_flash
picolibc
pico_lwip
pico_malloc
pico_multicore
pico_printf
pico_runtime
pico_stdio
pico_stdio_usb
pico_sync
pico_time
pico_util
pioasm
port
question
review
review2
rtos interop
runtime init
static library
svd
test
tinyusb
vscode
wifi integration
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-raspberrypi/pico-sdk!775
Loading…
Reference in a new issue
No description provided.
Delete branch "rtt-stdio-support"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #774
This PR adds support for using SEGGER RTT as an STDIO driver.
The code for the stdio_rtt implementation is quite simple and copies the structure of the other STDIO drivers. RTT support can be enabled in the same way as the other STDIO drivers, simply add
pico_enable_stdio_rtt(${TARGET_NAME} 1)to your CMakeLists.txt and callstdio_init_all()in your initialisation code.The official SEGGER_RTT code is included in the lib directory (the latest version, V762c). I have copied all files exactly as-is, despite many of the files being unnecessary/code samples/etc. I did this to make updates to newer versions more simple (just overwrite the entire directory with the latest version). Unfortunately SEGGER does not distribute this code as a git repo which could have been included as a submodule.
Happy to make improvements/adjustments to this implementation based on feedback.
Why don't you re-package the Segger code as a git repository yourself (or clone (and update?) https://github.com/PromyLOPh/rtt)?
Did you ask them to please publish their code to github?
I find the problem with third parties hosting a clone of the official code is that they become out of date very quickly. To be fair, this problem would be the same by keeping the code copy in the pico-sdk, so I'm not sure what the best solution is...
The version you linked is 5 years old. I found another repo that seems to do a better job of keeping the code up to date: https://github.com/adfernandes/segger-rtt. I am happy to update my PR to use this third-party repo, but I would also like a maintainer of this project to chime in and advise what approach would most likely get merged.
I emailed SEGGER this morning to see if they would consider publicly hosting the code on a git repo.
I was just searching for something else, but i think they already have the RTT source code on GitHub. Didn't checked if the version is the newest one (they always change the header on a release, but code often doesn't have any changes)
https://github.com/SEGGERMicro/RTT
Hope i could help a little bit
FYSA I keep the unmodified RTT sources maintained and properly tagged here: https://github.com/adfernandes/segger-rtt (been doing it for a while)
I'm reasonably certain that Segger doesn't "maintain" any release of RTT outside of the JLink releases. Other projects that Segger does follow, like the Zephyr RTOS from the Linux Foundation, use relatively old libraries, too.
The attitude, much like the
SEGGERMicrorepository linked above, is to do a code dump "once in a while", ignoring bugfix and patches.So about once a month (waves hands in the air) I download the latest Segger JLink software distribution and upload to my repository.
This PR has been added to the 1.6.0 milestone. Anything speaking against merging this into develop in the not too far future?
FWIW, I just pushed Version V7.86h (2023-04-12) to my unmodified, pristine mirror of Seggger's RTT distribution.
Segger's release notes are usually pretty complete, and there were some minor changes to to RTT backend in recent history.
@anaoum I would ask (please!) that the most recent-possible RTT sources, like mine from above, be merged into the Pico SDK since this can make a difference as the debuggers and protocol (slowly) evolve!
I think we would want to avoid copying a bunch of Segger code into this repo... so would prefer to build with code from a submodule and have that submodule be optional
@kilograham, I agree with your "use a submodule" sentiment 100%
The issue is that there is no official source, as far as I know, RTT repository - that's why I maintain this, which is very carefully exactly what Segger distributes.
@anaoum, if you agree, I'd be happy to rework your PR to use a submodule...
no objection from me. I would have done it myself but am quite time poor at the moment.
(ping @kilograham and @anaoum)
Superseded by #1411
@kilograham, I have vendored in
RTTand removed the submodule.However, no matter what I do, I cannot apply the compiler flags.
You'll see that I have
and
cmakedoes appear to apply those properties, but ... they're not in the actual compile commands, and the build fails.Any idea what might be wrong?
You'll have to specify the full path to the source file for set_source_files_properties to take effect.
I pushed my suggested changes that seem to fix the issue - hope that was ok
missing "rc = true;"?
question: why don't you put the SysView files into the SEGGER subdirectory. Those are part of the more or less generic RTT support and would allow a user to easyly integrate SysView support.
closed in favor of #1411
Pull request closed