sys/stdio: cleanup of STDIO abstraction#9503
Conversation
vincent-d
left a comment
There was a problem hiding this comment.
Apart from the minor renaming issues which have already been spotted by Murdock, I'm wondering if the vfs initialization code should not be moved out of stdio_uart to a generic module, as this code should be shared for all stdio_* implementations.
sys/stdio_uart/stdio_uart.c
Outdated
| return -EBADF; | ||
| } | ||
| return uart_stdio_read(dest, nbytes); | ||
| return stdio_uart_read(dest, nbytes); |
sys/stdio_uart/stdio_uart.c
Outdated
| return -EBADF; | ||
| } | ||
| return uart_stdio_write(src, nbytes); | ||
| return stdio_uart_write(src, nbytes); |
yes, that makes certainly sense. I would however like to do it in a follow up, so this PR doesn't get blown up by too many changes. Are you ok with that? |
45141b1 to
0668035
Compare
I am |
|
prefect. See #9790 |
vincent-d
left a comment
There was a problem hiding this comment.
I'm OK with the changes, tests/periph_uart works on my board.
|
You can squash ;) |
|
squashed. |
7563168 to
2163ad0
Compare
|
and fixed a minor doxygen misshap |
|
Maybe it's good to add the API change label, because this changes |
|
done. |
|
@gebart @bergzand @kaspar030 are you all good with this change? If so, please feel free to press the green button... |
|
I agree with the intent and general idea of this PR, but I did not have time to look at the code. It's good to see that the stdio code is being cleaned up 👍 |
sys/stdio_rtt/stdio_rtt.c
Outdated
|
|
||
| void uart_stdio_init(void) { | ||
| void stdio_init(void) { | ||
| #ifndef RTT_STDIO_DISABLE_STDIN |
There was a problem hiding this comment.
Similar to STDIO_UART_DEV, shouldn't this then be named STDIO_RTT_DISABLE_STDIN?
2163ad0 to
c2184f3
Compare
|
@basilfx good catch, fixed and squashed. |
|
Then I also ACK :-) |
|
Alright, I think the level of agreement is sufficient :-) -> let's go then! |
Were this project any further I'd consider keeping compatibility (not to old RIOT versions, but to applications using uartstdio::UartStdio). [9503]: RIOT-OS/RIOT#9503
Contribution description
Currently, the design of our STDIO mapping is partly a mess - e.g. why does the Segger RTT STDIO need to call
uart_stdio_xfunctions?!So this PR is a first step towards cleaning up the situation: I simply factored out the
init/read/writefunctions in a more generic header (stdio_base.h), while mapping the actual implementation to this interface during compile-time base on the selected modules. The 'users' of these backend functions now don't need to care about anything implementation specific (hence nouartleft in the name)...P.S.: my driver for this cleanup is to run the RIOT shell over BLE...
Issues/PRs references
none