[SOLVED] Compiling RTT V5.10g w/ gcc

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [SOLVED] Compiling RTT V5.10g w/ gcc

    I've upgraded RTT from 4.98e to 5.10g.

    5.10g now also has _write_r in SEGGER_RTT_Syscalls_GCC.c.

    Compiling for the Freescale K64F processor, I get the following warnings / errors that I fixed:

    SEGGER_RTT_Syscalls_GCC.c:98:21: warning: 'struct _reent' declared inside parameter list [enabled by default]
    int _write_r(struct _reent *r, int file, char *ptr, int len) {


    To fix, I #include <reent.h>

    Next was an error:
    SEGGER_RTT_Syscalls_GCC.c:98:5: error: conflicting types for '_write_r'
    int _write_r(struct _reent *r, int file, char *ptr, int len) {

    To fix, I modified signature to this:

    int _write_r(struct _reent *r, int file, const void *ptr, size_t len);

    Everything compiles fine, and it runs - however, when I hit stop on my Jlink on occasion I get multiple terminal windows popping up on the RTT Viewer (around 12 of them) and see the All Terminal window flooding with the following message:

    WARNING: Could not add output to terminal -1

    I didn't have any compiler issues that I had to fix or errors like the above in 4.98e. I'm working around this by disabling use of RTT and using the serial I/O console for debugging. But wondering if I did something wrong?

    Thanks,
    -Raj
  • I just downloaded v5.10g and see that SEGGER has now added #include <reent.h> to fix the warning. The signature error still exists and requires me to change signature to int _write_r(struct _reent *r, int file, const void *ptr, size_t len);

    Also, the issue when I hit 'stop' in the KDS/eclipse debugger still causes the log to fill up. My most recent run RTT Viewer says 'WARNING: Failed to read RTT data'.

    -Raj
  • Hi,

    We will fix the signature, to match the definition, too.

    Regarding RTT Viewer:
    You selected "Existing Session" as connection option, correct?
    Does this happen, when your application is running and you control it with J-Link Commander, too?
    (Start J-Link Commander, connect, reset, go, start RTT Viewer, halt)

    Regards
    Johannes
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • Hi Johannes,

    Just saw this today. I actually stopped using SEGGER_RTT and went back to the occasional printf if I need to see something on the console for debugging.
    I did not use the Existing Session but used USB. In 4.98e that was what I was doing and never saw the log fill up.

    Are you saying if I had used Existing Session, and if I hit stop in Eclipse, I wouldn't get the log fill up issue? It connected fine and showed all my SEGGER_RTT_printfs - until I hit stop.

    Thanks,
    -Raj
  • Hi Raj,

    Yes, that is what I am saying.
    If you select "Existing Session" only this session (the Eclipse debug session) will communicate with the J-Link.
    If you do not select it, this is done implicitly and RTT Viewer does not know when the first connection is closed.

    Best regards
    Johannes
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • Hi Johannes,

    I just downloaded 5.10o and was able to compile RTT without any compiler warnings. Thanks.

    I tried existing session and can see that it goes into a wait state after I hit stop on the debugger (when you hit cancel, it does seem to briefly show a filled error log - but window closes quickly) - so this is workable.

    I also noticed that if I launch RTT Viewer first and connect as USB, then launch Eclipse debug - I don't run into the log fill (and avoid seeing the waiting for connection) which seems nicer. Any reason not to do it that way?

    Thanks,
    -Raj
  • Hi Raj,

    Yes, with "Existing Session" another connection to J-Link (i.e. a debug session) has to be active.
    When this connection is closed, RTT Viewer waits for a new connection.

    We will check if there are unnecessary error messages on cancel, but the behavior is correct so far.

    When RTT Viewer opens its own connection (via USB) it actively reads the RTT data from the target.
    This can cause problems when loading a modified application via Eclipse, e.g. when the RTT Control Block location has changed.
    But in general opening an active connection (before starting an Eclipse debug session) will work, too.

    Best regards
    Johannes
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.