MSP430 Uniarch mspgcc or mspgcc4?

You are probably asking yourself which compiler for your launchpad/msp430, you should use. Me personally, I don’t really care which one works Better, I just need one to compile for my launchpad and supports the chips I use.

some similarities  —

Both create files for your msp430 chip,

both are compiled  with GCC 4.x+

Both use libc for the msp430.

They pretty much fill the same function.

 

Now some of the major differences, mspgcc4 is stable and  can be used with production code, Uniarch is still being developed and is changing a lot still. mspgcc4 supports most of the chips for msp430 except the very newest (since it is hard to add newer chips with out rebuilding and adding a lot of code).  Uniarch is trying to make adding chip support as easy as possible, and unifying all the branches of mspgcc. Even coding is slightly different, interrupts are coded different and even the headers you use may be different(FYI).

 

So which one should I choose?

Well that is a tough question, what are your goals?

are you trying to get one just up and running or do you need support for the newest chips? — Have you compiled programs from source or are you new to linux?

Will you give up after you get an error or will you work through it and figure it out?

 

Well if you need just something up and running just to be able to compile a few programs for your launch pad , I would suggest using mspgcc4 , using the build script or using the pre-built binaries. pre- built binaries, to install, you just add a folder to usr/local/ and call it mspgcc4 and unpack your binaries in there and that it.  The build script is pretty self explanatory, and it compiles everything from source . I have used it multiple times and works as long as you have all the dependencies. IE(ncurses-dev, cvs, lidreadline-dev etc…)

A very simple way to get it up and running –

 

Now if you want access to the New uniarch mspgcc, that supports the new chips like msp430g2452 or others. you will need to go the long and hard route of patching compiling linking and more compiling lol. but there are some great directions to do it. Here (Thank you sergio). But it is not for the faint of heart….lol /JK

Now I had a few issues trying to compile and get it up and running, but I was not using the generic ubuntu build so I didn’t have access to some of the later packages. more or less I worked through it and all is well.

A few of my fixes

 

When I first started,  trying to install all the dependencies(patch ncurses-dev build-essential bison flex libgmp3-dev libmpfr-dev libmpc-dev texinfo zlib1g-dev) , there was one I could not find –libmpc-dev.

lol So i continued anyways, knowing I didn’t have mpc installed. This will cause issues if you don’t have it, I learned that the hard-way.  After continuing and building the tool chain(binutil) everything seemed fine, but it wasn’t, once you get to the gcc you will starting getting errors and you will be halted…….

 

with an error like

configure: error: Building GCC requires GMP 4.2+, MPFR 2.3.1+ and MPC 0.8.0+.
Try the –with-gmp, –with-mpfr and/or –with-mpc options to specify
their locations.  Source code for these libraries can be found at
their respective hosting sites as well as at
ftp://gcc.gnu.org/pub/gcc/infrastructure/.  See also
http://gcc.gnu.org/install/prerequisites.html for additional info.  If
you obtained GMP, MPFR and/or MPC from a vendor distribution package,
make sure that you have installed both the libraries and the header
files.  They may be located in separate packages.

 

so I did the thing most of you will do, install mpc gmp mpfr from source. This will not work —I tried multiple times and even tried using libtool to correct the issue , but to no avail……..next i tried  using the options    –with-gmp=/usr/local/include –with-mpfr=” ” –with-mpc= ‘ ‘

Still none of this worked………Then I remembered an old trick when I was building LFS(linux form scratch)  Add the source code for mpc, gmp, mpfr to the gcc source code folder after you un-tar it. when gcc starts to build, it will look in its source folder for the files needed,  just remember to change the folder name from let say gmp-0.9 to gmp.

This cleared the error and it finished building with out an issue. …… Now I wish someone would create a perl or python script to build and patch it like the mspgcc4 build script.

 

Updates to existing code, will be coming soon, these changes will reflect the newer uniarch mspgcc, on my site.

Refrence and links

http://mspgcc4.sourceforge.net/

http://mspgcc.sourceforge.net/

https://github.com/sergiocampama/Launchpad/blob/master/README.md


8 Responses to MSP430 Uniarch mspgcc or mspgcc4?

  1. I have an msp430F2274 controller, for the development board of RF2500, which complier should i use for it. I need the reason also why i should opt for it. Thanks for the suggestion.

    • It depends on if you are using linux or windows, if windows then ccs or iar, but for linux use the uniarch version with mspdebug, mspdebug is compatible with the rf2500, and the current uniarch is capable of compiling code for your specific chip. just include msp430f2274.h and you should be good to go.

  2. I have followed your steps, and completed installation without errors. Then tried to compile example programs from here:
    https://github.com/sergiocampama/Launchpad/blob/master/README.md

    But had no luck. Output to some rake invocations:

    $ rake
    (in /home/jalon/msp430/sergiocampama-Launchpad-a6fe690/MacBookBreathe)
    Compiling macbookbreathe.c…
    src/macbookbreathe.c:1: error: MCU msp430g2211 not supported
    Known MCU names:
    msp1
    msp2
    msp3
    msp4
    msp5
    msp6
    msp430x110
    msp430x112
    msp430x1101
    msp430x1111
    msp430x1121
    msp430x1122
    msp430x1132
    msp430x122
    msp430x123
    msp430x1222
    msp430x1232
    msp430x133
    msp430x135
    msp430x1331
    msp430x1351
    msp430x147
    msp430x148
    msp430x149
    msp430x1471
    msp430x1481
    msp430x1491
    msp430x155
    msp430x156
    msp430x157
    msp430x167
    msp430x168
    msp430x169
    msp430x1610
    msp430x1611
    msp430x1612
    msp430x2001
    msp430x2011
    msp430x2002
    msp430x2012
    msp430x2003
    msp430x2013
    msp430x2101
    msp430x2111
    msp430x2121
    msp430x2131
    msp430x2112
    msp430x2122
    msp430x2132
    msp430x2201
    msp430x2211
    msp430x2221
    msp430x2231
    msp430x2232
    msp430x2252
    msp430x2272
    msp430x2234
    msp430x2254
    msp430x2274
    msp430x233
    msp430x235
    msp430x2330
    msp430x2350
    msp430x2370
    msp430x247
    msp430x248
    msp430x249
    msp430x2410
    msp430x2471
    msp430x2481
    msp430x2491
    msp430x2416
    msp430x2417
    msp430x2418
    msp430x2419
    msp430x2616
    msp430x2617
    msp430x2618
    msp430x2619
    msp430x311
    msp430x312
    msp430x313
    msp430x314
    msp430x315
    msp430x323
    msp430x325
    msp430x336
    msp430x337
    msp430x412
    msp430x413
    msp430x415
    msp430x417
    msp430x423
    msp430x425
    msp430x427
    msp430x4250
    msp430x4260
    msp430x4270
    msp430xG4250
    msp430xG4260
    msp430xG4270
    msp430xE423
    msp430xE425
    msp430xE427
    msp430xE4232
    msp430xE4242
    msp430xE4252
    msp430xE4272
    msp430xW423
    msp430xW425
    msp430xW427
    msp430xG437
    msp430xG438
    msp430xG439
    msp430x435
    msp430x436
    msp430x437
    msp430x4351
    msp430x4361
    msp430x4371
    msp430x447
    msp430x448
    msp430x449
    msp430xG4616
    msp430xG4617
    msp430xG4618
    msp430xG4619
    msp430x4783
    msp430x4784
    msp430x4793
    msp430x4794
    msp430x47163
    msp430x47173
    msp430x47183
    msp430x47193
    msp430x47166
    msp430x47176
    msp430x47186
    msp430x47196
    msp430x47167
    msp430x47177
    msp430x47187
    msp430x47197
    msp430x5418
    msp430x5419
    msp430x5435
    msp430x5436
    msp430x5437
    msp430x5438
    msp430x5500
    msp430x5501
    msp430x5502
    msp430x5503
    msp430x5504
    msp430x5505
    msp430x5506
    msp430x5507
    msp430x5508
    msp430x5509
    msp430x5510
    msp430x5513
    msp430x5514
    msp430x5515
    msp430x5517
    msp430x5519
    msp430x5521
    msp430x5522
    msp430x5524
    msp430x5525
    msp430x5526
    msp430x5527
    msp430x5528
    msp430x5529
    msp430x6638
    cc430x5133
    cc430x5125
    cc430x6125
    cc430x6135
    cc430x6126
    cc430x5137
    cc430x6127
    cc430x6137
    src/macbookbreathe.c:1: confusión por errores previos, saliendo
    Abort: Error compiling macbookbreathe.c

    $ rake mcu=msp430x2211
    (in /home/jalon/msp430/sergiocampama-Launchpad-a6fe690/MacBookBreathe)
    Compiling macbookbreathe.c…
    src/macbookbreathe.c:10:20: error: msp430.h: No existe el fichero o el directorio
    src/macbookbreathe.c: En la función ‘timer_init’:
    src/macbookbreathe.c:70: error: ‘TACTL’ no se declaró aquí (primer uso en esta función)
    src/macbookbreathe.c:70: error: (Cada identificador no declarado solamente se reporta una vez
    src/macbookbreathe.c:70: error: para cada funcion en la que aparece.)
    src/macbookbreathe.c:70: error: ‘TASSEL_1’ no se declaró aquí (primer uso en esta función)
    src/macbookbreathe.c:73: error: ‘TACCTL1’ no se declaró aquí (primer uso en esta función)
    src/macbookbreathe.c:73: error: ‘CCIE’ no se declaró aquí (primer uso en esta función)
    src/macbookbreathe.c:73: error: ‘OUTMOD_7’ no se declaró aquí (primer uso en esta función)
    src/macbookbreathe.c:75: error: ‘P1DIR’ no se declaró aquí (primer uso en esta función)
    src/macbookbreathe.c:75: error: ‘BIT6’ no se declaró aquí (primer uso en esta función)
    src/macbookbreathe.c:76: error: ‘P1SEL’ no se declaró aquí (primer uso en esta función)
    src/macbookbreathe.c: En la función ‘led_init’:
    src/macbookbreathe.c:83: error: ‘P1DIR’ no se declaró aquí (primer uso en esta función)
    src/macbookbreathe.c:83: error: ‘BIT0’ no se declaró aquí (primer uso en esta función)
    src/macbookbreathe.c:85: error: ‘P1OUT’ no se declaró aquí (primer uso en esta función)
    src/macbookbreathe.c: En la función ‘init’:
    src/macbookbreathe.c:92: error: ‘WDTCTL’ no se declaró aquí (primer uso en esta función)
    src/macbookbreathe.c:92: error: ‘WDTPW’ no se declaró aquí (primer uso en esta función)
    src/macbookbreathe.c:92: error: ‘WDTHOLD’ no se declaró aquí (primer uso en esta función)
    src/macbookbreathe.c:99: aviso: declaración implícita de la función ‘_BIS_SR’
    src/macbookbreathe.c:99: error: ‘GIE’ no se declaró aquí (primer uso en esta función)
    src/macbookbreathe.c: En la función ‘timer_start’:
    src/macbookbreathe.c:107: error: ‘TACCR0’ no se declaró aquí (primer uso en esta función)
    src/macbookbreathe.c:109: error: ‘TACTL’ no se declaró aquí (primer uso en esta función)
    src/macbookbreathe.c:109: error: ‘MC_1’ no se declaró aquí (primer uso en esta función)
    src/macbookbreathe.c: En la función ‘main’:
    src/macbookbreathe.c:120: error: ‘LPM3_bits’ no se declaró aquí (primer uso en esta función)
    src/macbookbreathe.c: En la función ‘TIMERA1_ISR’:
    src/macbookbreathe.c:130: error: ‘TACCTL1’ no se declaró aquí (primer uso en esta función)
    src/macbookbreathe.c:130: error: ‘CCIFG’ no se declaró aquí (primer uso en esta función)
    src/macbookbreathe.c:152: error: ‘TAR’ no se declaró aquí (primer uso en esta función)
    src/macbookbreathe.c:153: error: ‘TACCR1’ no se declaró aquí (primer uso en esta función)
    Abort: Error compiling macbookbreathe.c

    In the first invocation, it looks like mspgcc doesn’t recognize msp430g2211 as a valid MCU. In the second invocation I try with mcu=msp430x2211 and it looks like compiler accepts it as a valid MCU, but can’t find register definitions 🙁

    Any help should be great.

    • do you have the correct header added to your source file? (#include )

      and did you install the TI headers when you installed mspgcc?

      • Hi Justin, thanks for help, it’s greatly appreciated.

        I have installed the TI headers, they are under “/usr/local/mspgcc/msp430/include”. In the source file, it’s included “msp430.h”. AFAIK, “msp430.h” should include the correct .h file (“msp430g2211.h” in this case) using the -mmcpu argument passed to gcc.

        This is inside “msp430.h” file:

        […]
        #if defined(__MSP430_2211__) || defined(__MSP430X2211__) || defined(__MSP430G2211__)
        #include
        #endif /* Genericizable */
        […]

        Now the funny stuff. I got the examples to compile, replacing ‘#include ‘ with ‘#include ‘, so I supposed the mmcpu argument doesn’t define the chip properly. Then I tested passing “-D__MSP430G2211__” to gcc, but it didn’t work! It looks like even though I manually define the chip, “msp430.h” isn’t able to see the definition (“msp430g2211.h” doesn’t get included). Then I tried “#define __MSP430G2211__” just before #include and also no luck, it’s like if this symbol never gets defined…

        I can live writting the include for the exact chip, instead of the generic one, but I would prefer to use the generic one if possible (for code reusability). Any suggestions on how to get it? (if possible).

        • There’s an error in my previous comment. Inside msp430.h is this:

          […]
          #if defined(__MSP430_2211__) || defined(__MSP430X2211__) || defined(__MSP430G2211__)
          #include
          #endif /* Genericizable */
          […]

          In my previous comment I don’t know why but dissapeared.

          Also in my previous comment, whey I write I include “msp430.h” I should have wrote I include .

          Again, thanks for help.

          • Sorry again ¬_¬

            It looks like every time I write something between ” it dissapears, so if you see in my previous two comments #include and no header file, it’s because it was between these characters and dunno why it has been deleted O_oU

            Sorry for these three comments.

          • From my tests that I have done, I have changed in a few of my source files to include msp430.h, and it compiled without error
            These are the flags in my Make file -Os -Wall -g -mmcu=msp430f2013 .
            I also tested on my build the g2211, and it worked with out a problem.

            Just to be safe i used the same files you did to do a test compile, including rake and make
            both compiled with out error.

            My guess is, something happened during the build……. or something is not linking right

            the only thing i can think of doing is uninstalling and reinstalling msp gcc

            but if things are still not working, i would try the mspgcc mailing list, and ask them on whats going on.