Transitioning to SEGGER_RTT

I built an application on the NRF52 Development Kit. 

I was using the old NRF serial application with the retargetio.c file to push data out through the serial port.

I have had to upgrade my SES IDE to version 6.22, and there are lots of updates. One of the updates including transitioning to the SEGGER RTT module. I tried to follow the update instructions provided here https://wiki.segger.com/RTT_in_Embedded_Studio

However, I am getting some build errors I cannot resolve. I'm looking for help/advise to resolve the error. 

The build error seems to be with the "SEGGER_RTT_ASM_ARMv7M.S" assembler file. The details are as follows: 

Building ‘vector-pump-emulator’ from solution ‘vector-pump-emulator-app’ in configuration ‘Debug’
Compiling ‘ble_vpe.c’
Compiling ‘SEGGER_RTT.c’
Assembling ‘SEGGER_RTT_ASM_ARMv7M.S’
__SEGGER_RTL_Conf.h
__SEGGER_RTL_ConfDefaults.h
__SEGGER_RTL.h
stdint.h
app_util_platform.h
SEGGER_RTT_Conf.h
SEGGER_RTT.h
SEGGER_RTT_ASM_ARMv7M.S
missing binary operator before token "("
missing binary operator before token "("
missing binary operator before token "("
missing binary operator before token "("
missing binary operator before token "("
Compiling ‘SEGGER_RTT_printf.c’
Build failed

  • Hi,

    Which nRF5 SDK version are you using?

    There are several issues when using newer Segger Embedded Studio releases, and I would advice that you use the release that was tested with the SDK version you uare using. For nRF Connect SDK 17.1.0 (the latest version of the old SDK family), that is 5.42a (see the releaes ntoes).

    That said, it is possible to use newer Embedded Studio versions with some changes. The most important issues re listed here with links to DevZone threads that describe solutions:

    1. Fix <SDK>/segger_rtt/SEGGER_RTT_Syscalls_SES.c
    2. Fix <SDK>/components/libraries/uart/retarget.c
    3. Fix "undefined reference to `stdout'"
    4. Fix .text and .rodata

    For point 3 there you ca modify retarget.c by adding something like this:

    struct __SEGGER_RTL_FILE_impl {         // NOTE: Provides implementation for FILE
      int stub; // only needed so impl has size != 0.
    };
     
    static FILE __SEGGER_RTL_stdin_file  = { /* __SEGGER_RTL_FILE_impl.stub = */ 0 };  // stdin reads from UART
    static FILE __SEGGER_RTL_stdout_file = { /* __SEGGER_RTL_FILE_impl.stub = */ 0 };  // stdout writes to UART
    static FILE __SEGGER_RTL_stderr_file = { /* __SEGGER_RTL_FILE_impl.stub = */ 0 };  // stderr writes to UART
     
    FILE *stdin  = &__SEGGER_RTL_stdin_file;  // NOTE: Provide implementation of stdin for RTL.
    FILE *stdout = &__SEGGER_RTL_stdout_file; // NOTE: Provide implementation of stdout for RTL.
    FILE *stderr = &__SEGGER_RTL_stderr_file; // NOTE: Provide implementation of stderr for RTL.
     
    int __SEGGER_RTL_X_file_stat(FILE *stream) {
        return 0;
    }
     
    int __SEGGER_RTL_X_file_bufsize(FILE *stream) {
        return 0;
    }
     
    int __SEGGER_RTL_X_file_read(FILE *stream, char *s, unsigned len) {
        return 0;
    }
     
    int __SEGGER_RTL_X_file_write(FILE *stream, const char *s, unsigned len) {
        return 0;
    }
     
    int __SEGGER_RTL_X_file_unget(FILE *stream, int c) {
        return 0;
    }

  • Hi,

    Thank you for the helpful hints thus far. 

    I managed to do items 1 and 2.
    I'm not sure where to add the changes suggested for item 3. I did add the changes you suggested and got a working build.

    However, the application seems to crash whenever I try to print. It does not know what to do with printf commands.

    Any suggestion is welcome.

    I am using SDK 17 with soft device 

    s132_nrf52_7.0.1_softdevice
  • I ended up downgrading to SES 5.60.
    This allowed me to get back on track.

    Thanks for your help. 

  • Hi,

    Thanks for letting me know. That is the recommended approach.

    PS: The recomended SDK for new development is the nRF Connect SDK. However, if you are usign teh old nRF5 SDK, I recomend that you use the latest version (17.1.0) as this is the only one which fully supports the latest generation of the nRF52 series devices out of the box.

Related