Re: Limited RAM stdio replacement for newlib
"Keith Packard" <[email protected]>
| Newsgroups | gmane.comp.lib.newlib |
|---|---|
| Message-ID | <[email protected]> |
Joel Sherrill <[email protected]> writes: > This made me remember that RTEMS has a simple set of printk stdio. Would it > be possible to have a set of "kernel" stdio methods in parallel with > regular stdio. Use names like printk, sprintk, etc and have a user level > feature flag to enable macros that map stdio to those methods. That's what SDCC does as well, and it's useful as long as all you want is console output. If you want to offer any additional files, then you need something a tiny bit more complex, and that's where I'm at these days. > I am just pondering. The idea of having both in newlib sounds useful. We > use multilibs for many variants within an architecture so we have a single > toolchain for all arm variants. Being able to let an application select > when it is built if they are mapped to these would be desirable. Right, I'm building all 20 arm-none-eabi variants that the toolchain lists. I guess I wonder what arm-none-eabi user would want the larger stdio; it requires a posix syscall API, which seems like that would involve an operating system with a toolchain though? > Now the best you get is integer only methods or a rebuild for nano which > doesn't meet these smallest systems. For the AVR libc stdio, I build both fp and integer-only printf/scanf methods, with the integer-only versions named: vsnprintf vsniprintf vfprintf vfiprintf vprintf viprintf fprintf fiprintf printf iprintf sprintf siprintf snprintf sniprintf asprintf asiprintf asnprintf asniprintf vfscanf vfiscanf scanf iscanf fscanf fiscanf sscanf siscanf By selecting the compile-time option 'NEWLIB_INTEGER_PRINTF_SCANF', the user application gets the 'normal' names defined as the integer-only names so that it ends up using those functions instead. By building both into the library, you avoid needing to pick which variant you want at library build time and can leave it up to the application. It's not perfect; I'd love to have the fp-enabled versions 'replace' the integer-only ones so that another library could call iprintf and have that use printf if the application ended up needing the full-featured version. Maybe some trickery with weak symbols could solve this... -- -keith
signature.asc
(application/pgp-signature, 832 B)
-----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEw4O3eCVWE9/bQJ2R2yIaaQAAABEFAlulH8UACgkQ2yIaaQAA ABHpfw//ct25JJxEzRrxwEJjq84X8QS5RbWt8vwGyhGIXYVPai2rA6sT3xzq6v8s hevKETVP1SopkUoKbbkKS0ng7X6vDl7Bva/2+N2ayRo9NKQNGbbwd83IuQzHw8m1 aRCX5LPiy9dlW3pO16aq4ySYpp41swyrWEoSbh1LPbR2QNB/NNr8z+yNtvDkMZk6 twHNHylGF9JbF3fTJFh0+Q9NOTIt1BwpeoKVcE8HhDw/0Tk+pLs8dapUa7/nemiO HM188NqBhqzQlF9NiXyi5JC3jzUc1xltfwJK0LLxCkaNcLecyxrCLYGdHP47nSN3 8vd7vP7wOPuoqVeciKBTBrtnZK+NaEQHQOTsvWJQuTDzcamm4t0usBAcSXrMJdpC LADfRbM/sYX8xiH7K0Cs8oFhgK7huVyrHjkg3Ak8WbmP5y4syI+df6n1twVA4MZn 56iD+Xsak2LAZegyruRVlbJxyGO7ijr1gekuHzOdQAgEXNvBf6eU/xUKwfM/GoIF hDXeFd6mvlRsn4tuMq2LxK4d3OUVXVUfChL7Rz3a+/Pf/nceaR3GowlU8cDred0L Ilm2JSFbsQISEFsTny9bKJIcNXUgFyvqfWLHfCctOZ8rTe+SsoXD0W/kyJE4gTzF nDAsXzMP3RqwynEQKi3WmzKt85iq20Xti3nSjkrseTUAfiTSeXI= =QKV9 -----END PGP SIGNATURE-----