Hi everyone,

Has anyone used semihosting with an ARM core to allow them to use the debugger for stdio for the shell? I don’t have an available UART on this board I’m developing for. My two options are USB or semihosting with the debugger. As USB currently is unsupported with Riot, it’d be great to figure out how to utilize semihosting in the meantime.

Any info is appreciated.

Sincerely, Anthony


I’m not sure I completely understand your question, but I have a question on my own:

We wrote the slipmux spec

so we can do diagnostics, configuration (including a form of shell access), as well as packet transfer over a single UART port.

Would that help in your case?

Grüße, Carsten

Hey, I use Segger RTT. I believe my changes were merged in to RIOT as rttstdio. You get very high performance studio without a UART. It should be as simple as adding the module to your makefile.

More details in the rtt_stdio readme

Thanks everyone for the suggestions. Segger RTT looks like it could be the perfect solution. It actually sounds very similar to semihosting.

I am trying to use this with an ST-Link V2 and STM32 cortex m3 processor. Does anyone know if it has been tested on this? I’ve added the module, but it doesn’t seem to be working. I have used the debug target to start gdb and my program.

Thanks again, Anthony

Segger RTT only works with segger J-link. However if your st link came from a nucleo or discovery you can update the firmware to a J-Link with limited functionality.

That makes since, I misunderstood before, I thought this was a JTAG specific functionality. Thanks for the clarification. Unfortunately I have an external ST-Link V2, not the onboard.

I suppose that brings the original question back. Trying to get semihosting working. It sounds very similar to Segger RTT so it seems possible. Even better is it shouldn’t be more than an openocd command and a couple tool-chain flags (in theory). but I’m not so sure of where to start.

Do you use as linker arguments --specs=rdimon.specs -lrdimon ? If not you could give that a try.

Working through all of it now. There seems to be some good info here:

I’ll post here if I get it working and maybe we can eventually add support for this in Riot if it works out.

So in my attempt to get semihosting working I think I need to understand how Riot and newlib currently work together. Does Riot use pre-compiled newlib libraries? If so, where are they and how are they currently linked?

It seems I’ll probably need to disable the newlib syscalls defined with UART_STDIO etc. Not sure if there is a good way of doing this from the upper level Makefile? Anyone know?