On Wed, Apr 23, 2014 at 02:14:32PM +0000, Grant Edwards placed into existence: ] On 2014-04-22, DJ Delorie <d...@redhat.com> wrote: ] > ] >> I was surprised to see DJ's comment that there actually was no ] >> standard system interface; the "standard interface" I was referring to ] >> is the one documented at http://neptune.billgatliff.com/newlib.html ] > ] > "The key to a successfully ported newlib is providing stubs that ] > bridge the gap between the functionality newlib needs, and what your ] > target system can provide." ] > ] > This bridge is what I was referring to. Newlib calls read() but does ] > not provide an implementation of it. Libgloss provides various ] > target-specific implementations of read(), the one I wrote for msp430 ] > uses CIO to communicate with the simulator/debugger. ] ] Why is newlib calling read(), and from what is it expecting to read? ] ] >> I was expecting for MSP430 to also simply implement the functions ] >> stubbed in newlib's libnosys, but at first glance it looks like the ] >> CIO one uses different names, and maybe doesn't support all the same ] >> functions. ] > ] > Hmmm... it should be all the same names. I only changed the existing ] > libgloss hooks. But, I don't always do all the hooks, usually only ] > write() and exit() are needed for our testing. ] ] Again, why should newlib be calling write() and what is it expecting ] to write _to_? ] ] What does it expect exit() to do?
My understanding is newlib provides STDIO calls such as printf() (using write()), fgets() (using read()), etc. for your convenience, but then you have to implement those low-level syscalls yourself. End result should be that you can use the stdio calls in any manner you feel appropriate, on any hardware you feel this "stdio paradigm" could have value (output to LCD displays or UARTs, input from a keyboard or UART, etc). Example: on the Tiva-C ARM Cortex-M4F platform, I produced a library for interfacing with a 9-bit SPI accessible black & white LCD display (repair part for Nokia 1202 dumbphones) using newlib's infrastructure; my code can then enable something like this: // Display ready for init fopen("LCDBACKLIT", "w"); // driver grabs stdout for this by default printf("Totally cool! %g\n", 1.059); and suddenly "Totally cool! 1.059" appears (line-wrapped) on the LCD. Pictoral example of printf'ing "Hi there, using printf!"- http://spirilis.net/junk/tiva/nokia1202_tiva_printf.jpg Library for that: https://github.com/spirilis/tiva1202 Newlib stdio stubs implemented here: https://github.com/spirilis/tiva1202/blob/master/devoptab.c The newlib stub functions for _write(), _read() etc. are written in my library to call sub-drivers' write(), read(), etc. so multiple types of hardware can be supported with this infrastructure using the "file descriptor" concept. So I'm guessing DJ implemented a default hardware I/O implementation in libgloss that uses the CIO infrastructure (no idea what that is, but I'm guessing it uses the JTAG Mailbox system somehow to talk with the debugger host? in which case I'd love to play with it that... assuming mspdebug can support it) ------------------------------------------------------------------------------ Start Your Social Network Today - Download eXo Platform Build your Enterprise Intranet with eXo Platform Software Java Based Open Source Intranet - Social, Extensible, Cloud Ready Get Started Now And Turn Your Intranet Into A Collaboration Platform http://p.sf.net/sfu/ExoPlatform _______________________________________________ Mspgcc-users mailing list Mspgcc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mspgcc-users