Jump to content

GCC for MSP430 officially out of beta

Recommended Posts

From the binutils used in mspgcc:

commit 5a5c7b9cfa1ca229f661e5080f1af7584753c900
Author: Peter A. Bigot <pabigot@users.sourceforge.net>
Date:   Thu Feb 10 17:01:58 2011 -0600

    SF 3177314: undefined reference with too many template parameters
    This patch eliminates bounds on the length of symbols and instruction
    operands, and some rather inefficient string processing operations.  Storage
    of the appropriate length for a specific symbol is dynamically allocated,
    and freed when no longer necessary.
And it's a binutils bug, not a gcc bug. Still worth filing, and the binutils folks are a little more responsive. https://sourceware.org/bugzilla/


Unfortunately I couldn't get a usable copyright assignment from TI for the work they funded, which included the binutils cleanups that this patch belongs to, so my patch can't be merged upstream.

Link to post
Share on other sites

sad when you see your fixed bugs show up unfixed later .. I certainly know that feeling.


Thanks for the heads up.




As I suggested...  We've taken a few steps backwards.


I'm sure that we can get it all ironed out quickly though.  Lot of bright people in these forums.

Link to post
Share on other sites

Here are a few more of reasons to use this release.


1.) The USB Descriptor tool now generates code that works with msp430-elf-gcc.  In addition, most of the USB examples have CCS projects specifically for msp430-elf-gcc.


2.) -mlarge - so you can use all that flash space available in chips with more than 64k of flash


3.) -mcode-region=lower, -mcode-region=upper, -mcode-region=either - easily locate code or data high or low or fit it in where it can find a spot. Check out: msp430-elf/lib/msp430xl-sim.ld for examples. (You have to do some ldscript coding to get this to work right)


Personally, I'm feeling pretty happy with the code it generates and I'm now getting it to generate code as small or smaller than I was getting from msp430-gcc.


Flags to check out for good smallness:

$ msp430-elf-gcc -Os -g simple.cpp -o simple-4.9.1.elf -mmcu=msp430g2553 -minrt -fno-rtti -fno-exceptions -fdata-sections -ffunction-sections -Wl,--gc-sections
$ msp430-gcc -Os -g simple.cpp -o simple-4.6.3.elf -mmcu=msp430g2553 -mdisable-watchdog -fno-rtti -fno-exceptions -fdata-sections -ffunction-sections -Wl,--gc-sections
$ msp430-size simple-4.6.3.elf 
   text	   data	    bss	    dec	    hex	filename
    490	      0	     20	    510	    1fe	simple-4.6.3.elf
$ msp430-elf-size simple-4.9.1.elf 
   text	   data	    bss	    dec	    hex	filename
    484	      4	     20	    508	    1fc	simple-4.9.1.elf


Link to post
Share on other sites

BTW: I'm using a version built from source. I downloaded msp430-gcc-14r1-10-source.tar.bz2 from:


$ mkdir -p ~/rh_gcc/build
$ cd ~/rh_gcc
$ tar xvf msp430-gcc-14r1-10-source.tar.bz2
$ cd build
$ export PATH=/home/kimballr/opt/rh_gcc/bin:$PATH
$ ../configure --target=msp430-elf --prefix=/home/kimballr/opt/rh_gcc --disable-nls
$ make
$ make install
$ msp430-elf-gcc -v
Using built-in specs.
Target: msp430-elf
Configured with: ../configure --target=msp430-elf --prefix=/home/kimballr/opt/rh_gcc --disable-nls
Thread model: single
gcc version 4.9.1 20140707 (prerelease (msp430-14r1-10)) (GNUPro 14r1) (Based on: GCC 4.8 GDB 7.7 Binutils 2.24 Newlib 2.1) (GCC)
To make my command line life easier, I downloaded the header zip file and then manually moved all the header files (*.h) one place and the ldscripts (*.ld) someplace else. This way you don't have to provide -T and -I args to msp430-elf-gcc. All you need is the -mmcu=msp430g2553 and it automatically finds the msp430g2553.h and the msp430g2553.ld.

$ find /home/kimballr/opt/rh_gcc/ -name 'msp430-elf-gcc'

$find /home/kimballr/opt/rh_gcc/ -name 'iomacros.h'

$ find /home/kimballr/opt/rh_gcc/ -name 'msp430g2553.h'

$ find /home/kimballr/opt/rh_gcc/ -name 'msp430g2553.ld'
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...