This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430FR6989: MSPGCC same functionality as normal gcc

Part Number: MSP430FR6989

Hi all, 

I don't know in what forum specifically I would ask this, this seems the closest. 

I've always worked with the compilers given by the CCS. However, I am trying to use GCC more, and know what GCC does and how it works. So I have some questions about this which I cannot seem to find the answer to. 

1. Do you need the MSP430-GCC for compiling to MSP430, or can you just use the normal GCC, with flags like -mmcu=msp430? --> the normal GCC will work for your own computer, so you need a cross compiler, hence the msp430-gcc, where this flag will work.

2. Does the MSP430-GCC offer the exact same functionality as the GCC (can the same attributes and flags be used)? I am guessing it does, and I am guessing the MSP430-GCC can do some more as well? 

With kind regards.

  • Hi,

    Yannick Daelemans said:

    1. Do you need the MSP430-GCC for compiling to MSP430, or can you just use the normal GCC, with flags like -mmcu=msp430? --> the normal GCC will work for your own computer, so you need a cross compiler, hence the msp430-gcc, where this flag will work.

    You can't use "normal" (i.e. native) GCC to compile for MSP430, because the MSP430 and x86_64 (for example) are distinctly different machines. You must configure GCC for one specific target machine.

    I don't think it's worth getting into why GCC doesn't let you configure for more than one target machine.

    Yannick Daelemans said:

    2. If the GCC cannot, by itself, be used for the MSP430, are there some cross-compilers which can be used (not offered by TI for example, although this is not necessary)?

    MSP430-GCC is just GCC configured for the MSP430 target, so it is a cross-compiler because it compiles code for a different "machine" than what it runs on.

    The MSP430-GCC we distribute through TI is based off an older, stable version of GCC, with extra patches applied to add features and fix bugs.

    You can build the latest upstream GCC for MSP430 yourself, if you don't want to use the version distributed by TI.

    Yannick Daelemans said:

    3. Does the MSP430-GCC offer the exact same functionality as the GCC (can the same attributes and flags be used)? I am guessing it does, and I am guessing the MSP430-GCC can do some more as well? 

    As my previous answer describes, "GCC" in the way you use the term (native GCC) cannot be used to build any MSP430 program. You need a version of GCC which is configured for MSP430, such as "MSP430-GCC", or a version of GCC you have built yourself, and explicitly configured for MSP430.
    "MSP430-GCC" has some functionality that is not available if you take upstream GCC and configure it for MSP430 yourself. This is because the development cycles are different. For 6 months out of the year, new features cannot be added to upstream GCC, so it is not always possible to put features in MSP430-GCC into upstream GCC in time.
    So if you want the latest features and bug fixes, you should use the latest MSP430-GCC distributed by TI. In some cases, a bug fix might be upstreamed to GCC before it is available in an MSP430-GCC release, but it will only be present in the development version of GCC, so there could be other stability issues, because it is a development version.
    You should refer to the MSP430-GCC user guide distributed by TI when using MSP430-GCC, and the online GCC documentation when using upstream GCC.
    I hope this answers your questions,
  • Hi Jozef, 

    Thank you for the great explenation. 

    I still have one other question. In the MSP430-GCC, the msp430-elf-gcc compiler is used. How does this specific compiler differ from the "normal"/"native" gcc compiler? Is just the back-end changed? Or the middle end too? Are some flags and options not put in? 

    With kind regards

  • Hi Yannick,

    Yes it is just the back-end that has changed compared to the native GCC compiler.

    For example, the MSP430-GCC 9.2.0.50 release has the same front-end (which handles specific languages e.g. C/C++) and middle-end (which performs optimizations on the code which has been made language-independent by the front-end) as native GCC 9.2.0. The back-end in MSP430-GCC is for the "msp430-elf" target, whilst the back-end for native GCC will be specific to your host machine.

    So any generic options/attributes/extensions and other features supported by GCC 9.2.0 will be supported by MSP430-GCC 9.2.0.50.

    Note that hardly any behaviour will have changed between 9.2.0 and 9.3.0 (latest upstream version of GCC 9), so you can safely refer to the online 9.3.0 documentation for the generic behaviour if you need to.

    Hope this helps,

  • Thanks, helps perfectly :)

**Attention** This is a public forum