msp430-elf-gcc upcoming release

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
20 messages Options
Reply | Threaded
Open this post in threaded view
|

msp430-elf-gcc upcoming release

Peter Bigot-4
Back in mid April GCC forked off a branch for 4.9.0, which will be the
first release of GCC that supports the MSP430.  I've verified basic
functionality with:

binutils git://sourceware.org/git/binutils-gdb.git master
gcc git://gcc.gnu.org/git/gcc.git gcc-4_9-branch
newlib git://sourceware.org/git/newlib.git master

A couple issues:

* The only headers/linker scripts available are from
GCC_RH_20131206.zip; memory.ld and peripherals.ld for each MCU need to
be manually combined to get something binutils can process

* __delay_cycles() didn't get back-ported from the version that TI
published back in December

msp430-elf-gdb also doesn't appear to work with mspdebug:

(gdb) target remote :2000
Remote debugging using :2000
Reply contains invalid hex digit 59

I expect there'll be some issues with newlib as well; it appears to
use a unique syscall interface that I haven't tried to reverse
engineer.  However, I'm unsure the flags I used are appropriate (they
derive from the ones used for arm-gcc).  I do know that newlib without
the nano enhancements will not be acceptable for MSP430 work.  Insight
from Red Hat on a complete set of recommended flags known to work
together would be appreciated.

Below is the script I use for building, with
/opt/{binutils,gcc,newlib} being git workspaces checking out the
branches named above.  To help ensure the new toolchain is as good as
possible when it's first released, mspgcc users please try it and
report problems to Red Hat through whatever mechanism they prefer,
either here or on the upstream toolchain support lists.

Peter

TODATE=$(date +%Y%m%d)
PREFIX=/usr/local/msp430-elf-dev-${TODATE}
rm -rf ${PREFIX}
export PATH=${PREFIX}/bin:${PATH}

rm -rf binutils && mkdir binutils && cd binutils
/opt/binutils/configure --prefix=${PREFIX} --target=msp430-elf 2>&1 | tee co
make -j8 2>&1 | tee mo
make install 2>&1 | tee moi
cd ..

rm -rf gcc && mkdir gcc && cd gcc
/opt/gcc/configure --prefix=${PREFIX} --target=msp430-elf
--with-newlib --enable-languages=c,c++ 2>&1 | tee co
make -j12 all-host 2>&1 | tee moah
make install-host 2>&1 | tee moiah
cd ..

rm -rf newlib && mkdir newlib && cd newlib
/opt/newlib/configure \
  --prefix=${PREFIX} \
  --target=msp430-elf \
  --disable-newlib-supplied-syscalls    \
  --enable-newlib-reent-small           \
  --disable-newlib-fvwrite-in-streamio  \
  --disable-newlib-fseek-optimization   \
  --disable-newlib-wide-orient          \
  --enable-newlib-nano-malloc           \
  --disable-newlib-unbuf-stream-opt     \
  --enable-lite-exit                    \
  --enable-newlib-global-atexit         \
  --disable-nls
 2>&1 | tee co
make 2>&1 | tee mo
make install 2>&1 | tee moi
cd ..

cd gcc
make -j12 all-target 2>&1 | tee moat
make install-target 2>&1 | tee moiat
cd ..

------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users
Reply | Threaded
Open this post in threaded view
|

Re: msp430-elf-gcc upcoming release

DJ Delorie

> * The only headers/linker scripts available are from
> GCC_RH_20131206.zip; memory.ld and peripherals.ld for each MCU need to
> be manually combined to get something binutils can process

Hmmm... I was under the impression that there were toplevel
chip-specific scripts that included the sub-scripts.  Maybe that's
handled some other way in the TI IDE...

> * __delay_cycles() didn't get back-ported from the version that TI
> published back in December

My bad.  I can provide it if anyone needs it, but I'll see about
adding it to the 4.9 branch.

> I expect there'll be some issues with newlib as well; it appears to
> use a unique syscall interface that I haven't tried to reverse
> engineer.

It uses the TI CIO interface.

> Insight from Red Hat on a complete set of recommended flags known to
> work together would be appreciated.

We build with the "big" newlib, for testing.  There are a bunch of flags
which I mentioned in my "size optimization" email:

https://www.mail-archive.com/mspgcc-users@.../msg11977.html

------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users
Reply | Threaded
Open this post in threaded view
|

Re: msp430-elf-gcc upcoming release

Peter Bigot-4
On Tue, Apr 22, 2014 at 1:00 PM, DJ Delorie <[hidden email]> wrote:
>
>> * The only headers/linker scripts available are from
>> GCC_RH_20131206.zip; memory.ld and peripherals.ld for each MCU need to
>> be manually combined to get something binutils can process
>
> Hmmm... I was under the impression that there were toplevel
> chip-specific scripts that included the sub-scripts.  Maybe that's
> handled some other way in the TI IDE...

Must be, because the published zip file doesn't have them.

>> * __delay_cycles() didn't get back-ported from the version that TI
>> published back in December
>
> My bad.  I can provide it if anyone needs it, but I'll see about
> adding it to the 4.9 branch.

Thanks.  This intrinsic is one I depend on.

>
>> I expect there'll be some issues with newlib as well; it appears to
>> use a unique syscall interface that I haven't tried to reverse
>> engineer.
>
> It uses the TI CIO interface.

Interesting; is there any public documentation on how to use that?

An option to build MSP430 newlib with the standard system interface
would be even better.  It's not clear to me why a TI-specific
interface is desirable to anybody other than TI.  Part of the point of
using a GNU-based toolchain is portability across processors (even if
vendors would prefer that we be locked to their offerings).

If the standard newlib system API were used I could be up and running
with the msp430-elf toolchain today; since it isn't, and CIO isn't
documented, I can't really do much with newlib or the toolchain.  Much
of what I do uses libc, and I'm content with the size impact of
newlib-nano from gcc-arm-embedded.  (Not with "big" newlib, though.)

>>> Insight from Red Hat on a complete set of recommended flags known to
>> work together would be appreciated.
>
> We build with the "big" newlib, for testing.  There are a bunch of flags
> which I mentioned in my "size optimization" email:
>
> https://www.mail-archive.com/mspgcc-users@.../msg11977.html

I saw that, but it only mentioned two specific flags, compared with
the nine that are used by gcc-arm-embedded (though they're using a
forked newlib).  However if nobody actually uses newlib for
applications on MSP430 yet, perhaps the community will come up with a
set of flags that work.

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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users
Reply | Threaded
Open this post in threaded view
|

Re: msp430-elf-gcc upcoming release

DJ Delorie

> > It uses the TI CIO interface.
>
> Interesting; is there any public documentation on how to use that?

Not that I know of.

> An option to build MSP430 newlib with the standard system interface
> would be even better.

I don't know of a "standard" interface.  Each chip I've done has done
something a little different, depending on what the architecture
provided that could be hooked.

> It's not clear to me why a TI-specific interface is desirable to
> anybody other than TI.  Part of the point of using a GNU-based
> toolchain is portability across processors (even if vendors would
> prefer that we be locked to their offerings).

They use the CIO interface across all their processors, and it lets
you debug gcc-produced executables in their IDE/simulator/hardware.

As for reverse-engineering it... the sources are in libgloss and the
simulator ;-)

> I saw that, but it only mentioned two specific flags, compared with
> the nine that are used by gcc-arm-embedded (though they're using a
> forked newlib).  However if nobody actually uses newlib for
> applications on MSP430 yet, perhaps the community will come up with a
> set of flags that work.

There are far more than nine flags available, too.  Users almost need
to check them all and decide which features they're using in their app
and which they aren't.

------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users
Reply | Threaded
Open this post in threaded view
|

Re: msp430-elf-gcc upcoming release

Grant Edwards-6
In reply to this post by Peter Bigot-4
On 2014-04-22, Peter Bigot <[hidden email]> wrote:

> I expect there'll be some issues with newlib as well; it appears to
> use a unique syscall interface that I haven't tried to reverse
> engineer.

I don't understand.  A "syscall" API is usually the interface between
libc code (which is running in user mode) and an underlying OS kernel
that's running in protected mode.  Into what What OS kernel is newlib
expecting to be able to make syscalls?

For example, the syscall interface I deal with is the API between
either glibc or uclibc and the Linux kernel.  It's architecture
specific, since the the mechanism for swithcing to/from protected mode
usually has to be done in assembler.  It's typically something like:

  * Load parameters in to specific registers

  * Execute some variety of "SWI" instruction to generate a hardware
    exception/interrupt.
   
--
Grant Edwards               grant.b.edwards        Yow! Actually, what I'd
                                  at               like is a little toy
                              gmail.com            spaceship!!


------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users
Reply | Threaded
Open this post in threaded view
|

Re: msp430-elf-gcc upcoming release

Daniel Beer-3
In reply to this post by Peter Bigot-4
On Tue, Apr 22, 2014 at 10:34:30AM -0500, Peter Bigot wrote:
> msp430-elf-gdb also doesn't appear to work with mspdebug:
>
> (gdb) target remote :2000
> Remote debugging using :2000
> Reply contains invalid hex digit 59

I have a possible fix for this, but I haven't tried it myself. The
problem is that it's not possible to simultaneously satisfy
msp430-elf-gdb and msp430-gdb:

diff --git a/ui/gdb.c b/ui/gdb.c
index c500d83..8590667 100644
--- a/ui/gdb.c
+++ b/ui/gdb.c
@@ -239,11 +239,8 @@ static int run_final_status(struct gdb_data *data)
  address_t value = regs[i];
  int j;
 
- /* NOTE: this only gives GDB the lower 16 bits of each
- *       register. It complains if we give the full data.
- */
  gdb_printf(data, "%02x:", i);
- for (j = 0; j < 2; j++) {
+ for (j = 0; j < 4; j++) {
  gdb_printf(data, "%02x", value & 0xff);
  value >>= 8;
  }

------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users
Reply | Threaded
Open this post in threaded view
|

Re: msp430-elf-gcc upcoming release

Peter Bigot-4
On Tue, Apr 22, 2014 at 5:00 PM, Daniel Beer <[hidden email]> wrote:

> On Tue, Apr 22, 2014 at 10:34:30AM -0500, Peter Bigot wrote:
>> msp430-elf-gdb also doesn't appear to work with mspdebug:
>>
>> (gdb) target remote :2000
>> Remote debugging using :2000
>> Reply contains invalid hex digit 59
>
> I have a possible fix for this, but I haven't tried it myself. The
> problem is that it's not possible to simultaneously satisfy
> msp430-elf-gdb and msp430-gdb:

Maybe a command-line argument?

This fix works, by the way.  Very nice.

Peter

>
> diff --git a/ui/gdb.c b/ui/gdb.c
> index c500d83..8590667 100644
> --- a/ui/gdb.c
> +++ b/ui/gdb.c
> @@ -239,11 +239,8 @@ static int run_final_status(struct gdb_data *data)
>                 address_t value = regs[i];
>                 int j;
>
> -               /* NOTE: this only gives GDB the lower 16 bits of each
> -                *       register. It complains if we give the full data.
> -                */
>                 gdb_printf(data, "%02x:", i);
> -               for (j = 0; j < 2; j++) {
> +               for (j = 0; j < 4; j++) {
>                         gdb_printf(data, "%02x", value & 0xff);
>                         value >>= 8;
>                 }

------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users
Reply | Threaded
Open this post in threaded view
|

Re: msp430-elf-gcc upcoming release

Peter Bigot-4
In reply to this post by Grant Edwards-6
On Tue, Apr 22, 2014 at 4:53 PM, Grant Edwards
<[hidden email]> wrote:

> On 2014-04-22, Peter Bigot <[hidden email]> wrote:
>
>> I expect there'll be some issues with newlib as well; it appears to
>> use a unique syscall interface that I haven't tried to reverse
>> engineer.
>
> I don't understand.  A "syscall" API is usually the interface between
> libc code (which is running in user mode) and an underlying OS kernel
> that's running in protected mode.  Into what What OS kernel is newlib
> expecting to be able to make syscalls?

Whatever simulated environment is provided by the application or the
framework newlib links to, so as to support stdc library functions.

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
which matches what I found in gcc-arm-embedded.  I have a (IMO) very
nice infrastructure supporting a variety of memory allocators and file
descriptors for BSPACM (a cross-vendor ARM Cortex-M infrastructure;
http://pabigot.github.io/bspacm/newlib.html#newlib_sys).

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.

>
> For example, the syscall interface I deal with is the API between
> either glibc or uclibc and the Linux kernel.  It's architecture
> specific, since the the mechanism for swithcing to/from protected mode
> usually has to be done in assembler.  It's typically something like:
>
>   * Load parameters in to specific registers
>
>   * Execute some variety of "SWI" instruction to generate a hardware
>     exception/interrupt.
>
> --
> Grant Edwards               grant.b.edwards        Yow! Actually, what I'd
>                                   at               like is a little toy
>                               gmail.com            spaceship!!
>
>
> ------------------------------------------------------------------------------
> 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
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/mspgcc-users

------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users
Reply | Threaded
Open this post in threaded view
|

Re: msp430-elf-gcc upcoming release

DJ Delorie

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

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

------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users
Reply | Threaded
Open this post in threaded view
|

Re: msp430-elf-gcc upcoming release

Grant Edwards-6
On 2014-04-22, DJ Delorie <[hidden email]> 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?

--
Grant Edwards               grant.b.edwards        Yow! Did you move a lot of
                                  at               KOREAN STEAK KNIVES this
                              gmail.com            trip, Dingy?


------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users
Reply | Threaded
Open this post in threaded view
|

Re: msp430-elf-gcc upcoming release

Eric
On Wed, Apr 23, 2014 at 02:14:32PM +0000, Grant Edwards placed into existence:
] On 2014-04-22, DJ Delorie <[hidden email]> 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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users
Reply | Threaded
Open this post in threaded view
|

Re: msp430-elf-gcc upcoming release

Peter Bigot-4
In reply to this post by Grant Edwards-6
On Wed, Apr 23, 2014 at 9:14 AM, Grant Edwards
<[hidden email]> wrote:

> On 2014-04-22, DJ Delorie <[hidden email]> 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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users
Reply | Threaded
Open this post in threaded view
|

Re: msp430-elf-gcc upcoming release

Grant Edwards-6
On 2014-04-23, Peter Bigot <[hidden email]> wrote:

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

But it's not called like a normal C function, it goes through some
sort of syscall interface so you don't actually link your _write()
function with newlib?

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

Hmm. Is there an option to build a non-hosted version of newlib which
doesn't assume any underlying "OS support".

--
Grant Edwards               grant.b.edwards        Yow! Is it 1974?  What's
                                  at               for SUPPER?  Can I spend
                              gmail.com            my COLLEGE FUND in one
                                                   wild afternoon??


------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users
Reply | Threaded
Open this post in threaded view
|

Re: msp430-elf-gcc upcoming release

Peter Bigot-4
On Wed, Apr 23, 2014 at 9:57 AM, Grant Edwards
<[hidden email]> wrote:

> On 2014-04-23, Peter Bigot <[hidden email]> wrote:
>
>> 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.
>
> But it's not called like a normal C function, it goes through some
> sort of syscall interface so you don't actually link your _write()
> function with newlib?

See http://pabigot.github.io/bspacm/newlib.html#newlib_sys

>
>> 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.
>
> Hmm. Is there an option to build a non-hosted version of newlib which
> doesn't assume any underlying "OS support".

Yes, also described at that link, and possibly at the gatliff link I
gave earlier.

Peter

>
> --
> Grant Edwards               grant.b.edwards        Yow! Is it 1974?  What's
>                                   at               for SUPPER?  Can I spend
>                               gmail.com            my COLLEGE FUND in one
>                                                    wild afternoon??
>
>
> ------------------------------------------------------------------------------
> 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
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/mspgcc-users

------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users
Reply | Threaded
Open this post in threaded view
|

Re: msp430-elf-gcc upcoming release

DJ Delorie
In reply to this post by Eric

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

In a nutshell... the target fills in a structure at a "known" address,
then executes an opcode at a "known" address.  The
debugger/simulator/whatever traps execution at that address, then
looks at the structure to decide what to do.  In the CIO case, the
"known" addresses are based on symbols in the symbol table.

So as long as the debugger can set a breakpoint at a given address,
and examine/change target memory, you can implement CIO.

------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users
Reply | Threaded
Open this post in threaded view
|

Re: msp430-elf-gcc upcoming release

DJ Delorie
In reply to this post by Grant Edwards-6

> But it's not called like a normal C function, it goes through some
> sort of syscall interface so you don't actually link your _write()
> function with newlib?

It *is* called like a normal C function.  You really do just link
libgloss.a (or your equivalent) in with your app like you would any
other library.

------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users
Reply | Threaded
Open this post in threaded view
|

Re: msp430-elf-gcc upcoming release

Grant Edwards-6
On 2014-04-23, DJ Delorie <[hidden email]> wrote:
>
>> But it's not called like a normal C function, it goes through some
>> sort of syscall interface so you don't actually link your _write()
>> function with newlib?
>
> It *is* called like a normal C function.  You really do just link
> libgloss.a (or your equivalent) in with your app like you would any
> other library.

I see.  I guess to me a "syscall interface" implies something other
than a normal C function call to a function that's linked with the
caller.

--
Grant Edwards               grant.b.edwards        Yow! In Newark the
                                  at               laundromats are open 24
                              gmail.com            hours a day!


------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users
Reply | Threaded
Open this post in threaded view
|

Re: msp430-elf-gcc upcoming release

DJ Delorie

> I see.  I guess to me a "syscall interface" implies something other
> than a normal C function call to a function that's linked with the
> caller.

It does to me too.  The *implementation* of those standard C functions
may involve some sort of interface that's known to the
debugger/simulator as well.  In the case of msp430-elf-libgloss, that
interface is CIO, but it could involve designated interrupts or a
simulated I/O peripheral.  But that syscall interface is hidden in the
libgloss C function calls.  In other cases, there might not be a
syscall interface, if the C functions interface directly with
hardware, such as a serial port or LCD interface.

But I don't think any of the implementations involve a separate OS
running *on the chip*, which talks to your app with a well-known
interface, similar to how (for example) the Linux kernel talks to apps
running on a Linux machine.

Note, however, that there *is* a newlib port for running on a native
x86 Linux platform, which *does* use the Linux kernel syscall API, but
not for the MSP430.  In *that* port, the _read() et al C functions
call the Linux kernel syscall.

------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users
Reply | Threaded
Open this post in threaded view
|

Re: msp430-elf-gcc upcoming release

Eric
In reply to this post by Peter Bigot-4
Thanks Peter!  I've successfully compiled msp430-elf-gcc 4.9 using those instructions on a 64-bit Linux host.

For anyone else new to this GCC build, here's the additional steps I used to get the headers & linker scripts
into the correct place:

Download the GCC_RH_20131206.zip file from http://www.ti.com/tool/msp430-gcc-opensource (click "Get Software")

Modify this shell script (tested under Linux only so far) to install the headers and linker scripts (change
paths to install and zipfile):   https://gist.github.com/spirilis/115655b9bf206402ff50

This combines memory.ld and peripherals.ld into lib/<part#>.ld as Peter suggested was needed in his quoted message.
It also cleans up the ldscript directories from the include/ dir.

I have successfully compiled a binary with it. ... but haven't tried it on actual hardware yet :-)
Getting to that soon.



On Tue, Apr 22, 2014 at 06:57:55PM +0000, [hidden email] placed into existence:
] Date: Tue, 22 Apr 2014 10:34:30 -0500
] From: Peter Bigot <[hidden email]>
] Subject: [Mspgcc-users] msp430-elf-gcc upcoming release
] To: "GCC for MSP430 - http://mspgcc.sf.net"
] <[hidden email]>
] Message-ID:
] <CAPOJ94PGLz+BkaKm9hWc2RXg2PSBT=[hidden email]>
] Content-Type: text/plain; charset=UTF-8
]
] Back in mid April GCC forked off a branch for 4.9.0, which will be the
] first release of GCC that supports the MSP430.  I've verified basic
] functionality with:
]
] binutils git://sourceware.org/git/binutils-gdb.git master
] gcc git://gcc.gnu.org/git/gcc.git gcc-4_9-branch
] newlib git://sourceware.org/git/newlib.git master
]
] A couple issues:
]
] * The only headers/linker scripts available are from
] GCC_RH_20131206.zip; memory.ld and peripherals.ld for each MCU need to
] be manually combined to get something binutils can process
]
] * __delay_cycles() didn't get back-ported from the version that TI
] published back in December
]
] msp430-elf-gdb also doesn't appear to work with mspdebug:
]
] (gdb) target remote :2000
] Remote debugging using :2000
] Reply contains invalid hex digit 59
]
] I expect there'll be some issues with newlib as well; it appears to
] use a unique syscall interface that I haven't tried to reverse
] engineer.  However, I'm unsure the flags I used are appropriate (they
] derive from the ones used for arm-gcc).  I do know that newlib without
] the nano enhancements will not be acceptable for MSP430 work.  Insight
] from Red Hat on a complete set of recommended flags known to work
] together would be appreciated.
]
] Below is the script I use for building, with
] /opt/{binutils,gcc,newlib} being git workspaces checking out the
] branches named above.  To help ensure the new toolchain is as good as
] possible when it's first released, mspgcc users please try it and
] report problems to Red Hat through whatever mechanism they prefer,
] either here or on the upstream toolchain support lists.
]
] Peter
]
] TODATE=$(date +%Y%m%d)
] PREFIX=/usr/local/msp430-elf-dev-${TODATE}
] rm -rf ${PREFIX}
] export PATH=${PREFIX}/bin:${PATH}
]
] rm -rf binutils && mkdir binutils && cd binutils
] /opt/binutils/configure --prefix=${PREFIX} --target=msp430-elf 2>&1 | tee co
] make -j8 2>&1 | tee mo
] make install 2>&1 | tee moi
] cd ..
]
] rm -rf gcc && mkdir gcc && cd gcc
] /opt/gcc/configure --prefix=${PREFIX} --target=msp430-elf
] --with-newlib --enable-languages=c,c++ 2>&1 | tee co
] make -j12 all-host 2>&1 | tee moah
] make install-host 2>&1 | tee moiah
] cd ..
]
] rm -rf newlib && mkdir newlib && cd newlib
] /opt/newlib/configure \
]   --prefix=${PREFIX} \
]   --target=msp430-elf \
]   --disable-newlib-supplied-syscalls    \
]   --enable-newlib-reent-small           \
]   --disable-newlib-fvwrite-in-streamio  \
]   --disable-newlib-fseek-optimization   \
]   --disable-newlib-wide-orient          \
]   --enable-newlib-nano-malloc           \
]   --disable-newlib-unbuf-stream-opt     \
]   --enable-lite-exit                    \
]   --enable-newlib-global-atexit         \
]   --disable-nls
]  2>&1 | tee co
] make 2>&1 | tee mo
] make install 2>&1 | tee moi
] cd ..
]
] cd gcc
] make -j12 all-target 2>&1 | tee moat
] make install-target 2>&1 | tee moiat
] cd ..
]
]
]

------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users
Reply | Threaded
Open this post in threaded view
|

Re: msp430-elf-gcc upcoming release

Peter Bigot-4
In reply to this post by DJ Delorie
On Tue, Apr 22, 2014 at 1:00 PM, DJ Delorie <[hidden email]> wrote:
>> * __delay_cycles() didn't get back-ported from the version that TI
>> published back in December
>
> My bad.  I can provide it if anyone needs it, but I'll see about
> adding it to the 4.9 branch.

Any idea when this might happen?  I appreciate the offer for a private
patch, but this feature needs to be upstream and on trunk as well as
the release branch.

FWIW, I'm unable to find the sources for msp430-130423-317 as
delivered in CCS6 on http://www.ti.com/tool/msp430-gcc-opensource.  If
any TI folks are still here, that really ought to be addressed.

Peter

------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
Mspgcc-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users