Add support for SEGGER RTT STDIO (updated) #1411

Merged
adfernandes merged 4 commits from rtt-stdio-support into develop 2024-07-20 20:52:41 -05:00
adfernandes commented 2023-06-04 00:16:34 -05:00 (Migrated from github.com)

Supersedes #775, fixes #774 (ping @kilograham, @anaoum)

  • Segger's RTT is now included as a submodule

  • RTT is enabled via pico_enable_stdio_rtt(${TARGET_NAME} 1)

    • cr/lf conversion is supported via PICO_STDIO_RTT_DEFAULT_CRLF
    • a pico_stdio_test_rtt target was added to the test suite

Note the strange #include "../../../lib/rtt/RTT/SEGGER_RTT.c" in segger_rtt.c.

I did this because, as documented in the source file, cmake will not let us change the COMPILE_OPTIONS for a single source file if the target has one source file in the current directory tree and another source file in a directory outside the current directory tree.

Sadly, SEGGER_RTT.c produces warnings that are treated as errors, and without this fanciness, RTT will not compile with arm-gnu-toolchain-12.2.mpacbti-rel1.

**Supersedes** #775, **fixes** #774 (ping @kilograham, @anaoum) * Segger's RTT is now included as a submodule * RTT is enabled via `pico_enable_stdio_rtt(${TARGET_NAME} 1)` * `cr/lf` conversion is supported via `PICO_STDIO_RTT_DEFAULT_CRLF` * a `pico_stdio_test_rtt` target was added to the test suite Note the strange `#include "../../../lib/rtt/RTT/SEGGER_RTT.c"` in `segger_rtt.c`. I did this because, as documented in the source file, cmake will not let us change the `COMPILE_OPTIONS` for a single source file if the target has one source file in the current directory tree and another source file in a directory outside the current directory tree. Sadly, `SEGGER_RTT.c` produces warnings that are treated as errors, and without this fanciness, RTT will not compile with `arm-gnu-toolchain-12.2.mpacbti-rel1`.
kilograham commented 2023-06-05 10:02:42 -05:00 (Migrated from github.com)

This is probably going to annoy you, but perhaps I'm leaning back towards not using a sub module. I think my main objection before was that we had copied an entire repo, however I think that you are only using SEGGER_RTT.c and SEGGER_RTT.h(and possibly a config header)... it is probably simpler to just copy these files into the same directory.

This is probably going to annoy you, but perhaps I'm leaning back towards not using a sub module. I think my main objection before was that we had copied an entire repo, however I _think_ that you are only using `SEGGER_RTT.c` and `SEGGER_RTT.h`(and possibly a config header)... it is probably simpler to just copy these files into the same directory.
adfernandes commented 2023-06-05 11:55:08 -05:00 (Migrated from github.com)

Actually, I agree with you about getting rid of the submodule! 😆

Normally, with RTT, you need to include the libc intercepts and overrides for printf and puts and all that.

But the pico has it's own layered stdio implementation, so it just might be that SEGGER_RTT.c is all we need...

Let me check and test.

If it's just the source and few includes, I'll copy them in with a note of the revision.

That will allow me to get rid of the #include "...c" ugliness because I will be able to properly set the compile options.

Let me look into it tonight / tomorrow.

Actually, I agree with you about getting rid of the submodule! 😆 Normally, with RTT, you need to include the `libc` intercepts and overrides for `printf` and `puts` and all that. But the pico has it's own _layered_ `stdio` implementation, so it just might be that `SEGGER_RTT.c` is all we need... Let me check and test. If it's just the source and few includes, I'll copy them in with a note of the revision. That will allow me to get rid of the `#include "...c"` ugliness because I will be able to _properly_ set the compile options. Let me look into it tonight / tomorrow.
kilograham (Migrated from github.com) reviewed 2024-07-20 20:50:27 -05:00
kilograham (Migrated from github.com) approved these changes 2024-07-20 20:51:57 -05:00
Sign in to join this conversation.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-raspberrypi/pico-sdk!1411
No description provided.