Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for SEGGER RTT STDIO (updated) #1411

Merged
merged 4 commits into from
Jul 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/rp2_common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ if (NOT PICO_BARE_METAL)
pico_add_subdirectory(pico_stdio)
pico_add_subdirectory(pico_stdio_semihosting)
pico_add_subdirectory(pico_stdio_uart)
pico_add_subdirectory(pico_stdio_rtt)

pico_add_subdirectory(cmsis)
pico_add_subdirectory(tinyusb)
Expand Down Expand Up @@ -85,4 +86,4 @@ set(CMAKE_EXECUTABLE_SUFFIX "${CMAKE_EXECUTABLE_SUFFIX}" PARENT_SCOPE)
pico_add_doxygen(${CMAKE_CURRENT_LIST_DIR})
pico_add_doxygen_exclude(${CMAKE_CURRENT_LIST_DIR}/cmsis)

pico_promote_common_scope_vars()
pico_promote_common_scope_vars()
6 changes: 3 additions & 3 deletions src/rp2_common/pico_stdio/include/pico/stdio.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ typedef struct stdio_driver stdio_driver_t;
/*! \brief Initialize all of the present standard stdio types that are linked into the binary.
* \ingroup pico_stdio
*
* Call this method once you have set up your clocks to enable the stdio support for UART, USB
* and semihosting based on the presence of the respective libraries in the binary.
* Call this method once you have set up your clocks to enable the stdio support for UART, USB,
* semihosting, and RTT based on the presence of the respective libraries in the binary.
*
* When stdio_usb is configured, this method can be optionally made to block, waiting for a connection
* via the variables specified in \ref stdio_usb_init (i.e. \ref PICO_STDIO_USB_CONNECT_WAIT_TIMEOUT_MS)
*
* \return true if at least one output was successfully initialized, false otherwise.
* \see stdio_uart, stdio_usb, stdio_semihosting
* \see stdio_uart, stdio_usb, stdio_semihosting, stdio_rtt
*/
bool stdio_init_all(void);

Expand Down
11 changes: 10 additions & 1 deletion src/rp2_common/pico_stdio/stdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
#include "pico/stdio_semihosting.h"
#endif

#if LIB_PICO_STDIO_RTT
#include "pico/stdio_rtt.h"
#endif

#define STDIO_HANDLE_STDIN 0
#define STDIO_HANDLE_STDOUT 1
#define STDIO_HANDLE_STDERR 2
Expand Down Expand Up @@ -295,6 +299,11 @@ bool stdio_init_all(void) {
rc = true;
#endif

#if LIB_PICO_STDIO_RTT
stdio_rtt_init();
rc = true;
#endif

#if LIB_PICO_STDIO_USB
rc |= stdio_usb_init();
#endif
Expand Down Expand Up @@ -331,7 +340,7 @@ void stdio_set_translate_crlf(stdio_driver_t *driver, bool enabled) {
// Suppress -Wunused-parameter
(void)driver;
(void)enabled;

panic_unsupported();
#endif
}
Expand Down
15 changes: 15 additions & 0 deletions src/rp2_common/pico_stdio_rtt/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
pico_add_library(pico_stdio_rtt)

target_sources(pico_stdio_rtt INTERFACE
${CMAKE_CURRENT_LIST_DIR}/stdio_rtt.c
${CMAKE_CURRENT_LIST_DIR}/SEGGER/RTT/SEGGER_RTT.c)

set_source_files_properties(${CMAKE_CURRENT_LIST_DIR}/SEGGER/RTT/SEGGER_RTT.c
PROPERTIES COMPILE_OPTIONS "-Wno-cast-qual;-Wno-cast-align")

target_include_directories(pico_stdio_rtt_headers INTERFACE
${CMAKE_CURRENT_LIST_DIR}/include
${CMAKE_CURRENT_LIST_DIR}/SEGGER/RTT
${CMAKE_CURRENT_LIST_DIR}/SEGGER/Config)

pico_mirrored_target_link_libraries(pico_stdio_rtt INTERFACE pico_stdio)
429 changes: 429 additions & 0 deletions src/rp2_common/pico_stdio_rtt/SEGGER/Config/SEGGER_RTT_Conf.h

Large diffs are not rendered by default.

Loading
Loading