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.
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() ?
There must be some kind of mechanism because I don’t think the native platform takes that code path.
I might later add stdio based on an in-memory array manipulated over JTAG (like SEGGER RTT), but I am not sure which layer to add this in as. Any suggestions?
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.