This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Retargeting printf under SEGGER Embedded Studio

Hi all,

I'm currently trying to get the UART example (no SoftDevice) to work under Segger Embedded Studio. What I know is, that retarget.c is used to redefine the neccesary functions for printf (stdio).

app_uart_get and app_uart_put work absolutely fine. However, printf is not working. Compiling the example in Embedded Studio results in the following errors:

storage size of '__stdout' isn't known storage size of '__stdin' isn't known

Commenting the FILE __stdout and FILE __stdin lines out gets compilation running however printf doesn't work.

Does anyone can help me with that?

Thank you!

Martin

Parents
  • I just faced the same issue after commenting out FILE __stdout and FILE __stdin and couldn't quite get Jorgen's response to work.

    Anyway I found an even quicker way, and that is to convert printf to SEGGER_RTT_printf(0, String). So printf("\r\nUART Start!\r\n") becomes SEGGER_RTT_printf(0, "\r\nUART Start!\r\n"). Just ensure you have SEGGER_RTT_printf.c in your project. Thought I would mention this in case other users of SES come across this issue.

Reply
  • I just faced the same issue after commenting out FILE __stdout and FILE __stdin and couldn't quite get Jorgen's response to work.

    Anyway I found an even quicker way, and that is to convert printf to SEGGER_RTT_printf(0, String). So printf("\r\nUART Start!\r\n") becomes SEGGER_RTT_printf(0, "\r\nUART Start!\r\n"). Just ensure you have SEGGER_RTT_printf.c in your project. Thought I would mention this in case other users of SES come across this issue.

Children
No Data
Related