On Wed, Apr 23, 2014 at 9:14 AM, Grant Edwards
<grant.b.edwa...@gmail.com> wrote:
> 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?

Again: whatever the environment wants it to do.  In my case, I'm using
printf(3c) in my code, and I want it to output to one of the UARTs,
which newlib accommodates by using write(2) to descriptor 1, just like
any other standard C library.   This works because I supply a _write()
function that does that.   Or maybe it sends the data to an LCD.
Maybe exit() starts blinking a red LED if the return code isn't zero.
Whatever any of the system functions do, it's my choice, and I like
that newlib allows me that control.

Peter

------------------------------------------------------------------------------
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

Reply via email to