sys: factor stdio uart functions out of newlib's syscalls#3161
sys: factor stdio uart functions out of newlib's syscalls#3161OlegHahm merged 1 commit intoRIOT-OS:masterfrom
Conversation
|
Nice!
But does musl libc work on systems without an MMU?
|
|
Very much looking forward for working newlib alternatives! I am not quite sure I understand the idea behind the uart_stdio module, though. I see it cleans up the syscalls.c code a bit, but it does not really bring any architectural improvements. How about a slightly changed approach (which to this point is just a matter of some renaming): Rename the header from This interface can now be implemented in different ways (one of them of course being uart) and we can chose during compile time which of the implementation we would like to use. For simplicity it surely makes sense to set the Does this make sense? |
Well, if you'd want to implement a generic stdio_ module, and at some point you want to use uart for a file descriptor, you can use exactly this module. So, this module is a wrapper from uart0 or periph/uart + interrupt handling to posix read/write. At some point we might have x86_console_stdio, ..., and this module, and in newlibs syscalls, we can have a (either static or dynamic) file descriptor table, mapping e.g. _file_descriptors[0].write to uart_write. |
edit Yes. |
@kaspar030 See also the (now removed) device map/device IO stuff in the mulle port in https://github.com/RIOT-OS/RIOT/tree/bdc12b05cda97b7d9f11a079bd9dac9d59e1a8a8/cpu/k60/devio and https://github.com/RIOT-OS/RIOT/blob/bdc12b05cda97b7d9f11a079bd9dac9d59e1a8a8/boards/mulle/devicemap.c It was deleted when migrating all the Kinetis platforms to the common Cortex-M framework in #3099 (6e12503), but feel free to reuse any parts of it that you find useful. |
|
@haukepetersen I would suggest that the name of the new header be something other than |
|
;) |
|
I dont care about the name, my idea was just to rename the header into something more generic instead of having uart in it... |
Are you happy with uart_stdio being the implementation of an stdio interface for uart devices? |
|
yes. |
|
I look at it the following way: Take e.g. the When now renaming the interace functions to something without the reference to its implementation (e.g. |
|
Well, I look at it this way: In the feature, we will have files, and maybe different simultaneous UARTs, and maybe sockets. They all can use read, write, flush, close. So we need an interface, e.g.,
An uart implementation:
and in syscalls.c an array with one stdio_interface_t pointer per file descriptor. |
|
Syscalls is a place where I would like to see function pointers or a
pointer to the stdio device descriptor which in turn would contain function
pointers for each operation. This would make handling file systems and
other devices in the same write and read calls more straightforward when we
move forward on the file system PR.
|
|
@kaspar030 +1
|
|
I see, makes sense. Though I am not a 100% content with the file descriptor idea, though I have no hard arguments against it. But this is another discussion, so for this PR I am fine for now. |
0aac46a to
f6e5eac
Compare
|
sys/include/uart_stdio.h
Outdated
There was a problem hiding this comment.
Any reason you use a different style of license header here than in the C file? Would be nice if we could keep it consistent throughout RIOT...
There was a problem hiding this comment.
On 06/16/15 02:48, Hauke Petersen wrote:
Any reason you use a different style of license header here than in the C file?
c&p mistake.
|
f6e5eac to
282ff23
Compare
sys/include/uart_stdio.h
Outdated
There was a problem hiding this comment.
for consistency: write @p len bytes from @p buffer into stdio uart
sys/include/uart_stdio.h
Outdated
There was a problem hiding this comment.
params and return values are not properly documented - the same applies for the rest
There was a problem hiding this comment.
There was a problem hiding this comment.
There was a problem hiding this comment.
There was a problem hiding this comment.
I don't think that doxygen will parse this correctly, leading to incomplete API documentation and warnings while building the documentation. Hence, the answer is no. Sorry, bro!
There was a problem hiding this comment.
Again we're writing documentation for Doxygen, not our highly valued users.
What do you think is the purpose of doxygen?
There was a problem hiding this comment.
But by letting doxygen alert on missing parameter documentation we can make
sure that the api documents are always up to date with regards to API
changes.
On Jul 7, 2015 4:36 PM, "Kaspar Schleiser" [email protected] wrote:
In sys/include/uart_stdio.h
#3161 (comment):+#ifndef UART_STDIO_H
+#define UART_STDIO_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**I think Doxygen will still warn about undocumented parameters.
Again we're writing documentation for Doxygen, not our highly valued users.—
Reply to this email directly or view it on GitHub
https://github.com/RIOT-OS/RIOT/pull/3161/files#r34046394.
There was a problem hiding this comment.
There was a problem hiding this comment.
Is the C compiler working for us or ware we working for the C compiler? Will you introduce warnings into C code?
There was a problem hiding this comment.
Removing the source of warnings in C code usually doesn't add uglyness to the compiled program, while in this case in doxygen, it IMHO does. Whatever...
|
Apart from the documentation this seems to be fine. |
0688e51 to
851ecfc
Compare
|
|
ACK. Please squash! |
851ecfc to
96aad6d
Compare
sys/include/uart_stdio.h
Outdated
53d95d7 to
7482090
Compare
|
There was a problem hiding this comment.
"Warning unused parameter", add
(void)r;
(void)fd;
There was a problem hiding this comment.
(at least until we add any kind of file descriptor support)
7482090 to
e52210f
Compare
|
e52210f to
41cfe59
Compare
|
|
Needs a rebase, too. |
41cfe59 to
49ea7a3
Compare
|
- rebased
|
|
Travis is happy... |
|
ACK holds - and go! |
sys: factor stdio uart functions out of newlib's syscalls
|
perfect. thanks for reviewing! |
I'll be introducing a musl libc port for RIOT soon. This is groundwork to decouple shared functionality.