[riot-users] Platform with no UART stdio

Kaspar Schleiser kaspar at schleiser.de
Mon Jan 25 10:47:05 CET 2016

Hey Michael,

On 01/25/2016 03:39 AM, Michael Andersen wrote:
> I am very new to RIOT, and I don't yet know my way around the code, so
> sorry if this is an easy question.
There are no stupid questions, only stupid answers.

> I am trying to create a platform based on the samd21 that has no UART
> for stdio. Unfortunately its seems a uart stdio is pretty much assumed
> through a lot of the code. What is the cleanest way to prevent things
> like uart_stdio_init from being invoked by newlib/syscalls.c::_init() ?

This depends a little on which platform you are using. For arm,
uart_stdio_init is called in newlibs _syscalls.

Currently there is no really clean way to change that.

The least-intrusive way that comes to mind:

You could create a module with the same function signatures as
"sys/uart_stdio", and change newlibs dependency to that.

Implementing these:

void uart_stdio_init(void);
int uart_stdio_read(char* buffer, int count);
int uart_stdio_write(const char* buffer, int len);

Should be enough.

In the mid-to-long term we'll need to do this pluggable.

> There must be some kind of mechanism because I don't think the native
> platform takes that code path.
That's because native uses the system's native C library.
uart_stdio is pulled in as dependency of newlib on ARM.


More information about the users mailing list