Re: msp430-elf-gcc upcoming release

Peter Bigot <[email protected]>
Newsgroups gmane.comp.hardware.texas-instruments.msp430.gcc.user
Message-ID <CAPOJ94M-aa8R9V69KcZTqs4WJbgY__nuM6Rr0PN7E=rMo+d4Gw@mail.gmail.com>
On Wed, Apr 23, 2014 at 9:14 AM, Grant Edwards
<[email protected]> wrote:
> On 2014-04-22, DJ Delorie <[email protected]> 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.