[Mspgcc-users] msp430-elf-gcc upcoming release
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 21 | tee co make -j8 21 | tee mo make install 21 | tee moi cd .. rm -rf gcc mkdir gcc cd gcc /opt/gcc/configure --prefix=${PREFIX} --target=msp430-elf --with-newlib --enable-languages=c,c++ 21 | tee co make -j12 all-host 21 | tee moah make install-host 21 | 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 21 | tee co make 21 | tee mo make install 21 | tee moi cd .. cd gcc make -j12 all-target 21 | tee moat make install-target 21 | 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 Mspgcc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mspgcc-users
Re: [Mspgcc-users] msp430-elf-gcc upcoming release
* 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@lists.sourceforge.net/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 Mspgcc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mspgcc-users
Re: [Mspgcc-users] msp430-elf-gcc upcoming release
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 Mspgcc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mspgcc-users
Re: [Mspgcc-users] msp430-elf-gcc upcoming release
On 2014-04-22, Peter Bigot big...@acm.org 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.edwardsYow! Actually, what I'd at like is a little toy gmail.comspaceship!! -- 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
Re: [Mspgcc-users] msp430-elf-gcc upcoming release
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 Mspgcc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mspgcc-users
Re: [Mspgcc-users] msp430-elf-gcc upcoming release
On Tue, Apr 22, 2014 at 5:00 PM, Daniel Beer dlb...@gmail.com 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 Mspgcc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mspgcc-users
Re: [Mspgcc-users] msp430-elf-gcc upcoming release
On Tue, Apr 22, 2014 at 4:53 PM, Grant Edwards grant.b.edwa...@gmail.com wrote: On 2014-04-22, Peter Bigot big...@acm.org 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.edwardsYow! Actually, what I'd at like is a little toy gmail.comspaceship!! -- 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 -- 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
Re: [Mspgcc-users] msp430-elf-gcc upcoming release
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 Mspgcc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mspgcc-users