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.

Problem Compiling Stellarisware under Linux

Hi,

I am trying to develop applications with Eclipse / Linux for Stellaris Launchpad (LM4F120). I am following this guide: http://kernelhacks.blogspot.de/2012/11/the-complete-tutorial-for-stellaris.html

However, I can't compile StellarisWare with "make":

adc.c:1: error: bad value (cortex-m4) for -mcpu= switch
adc.c:1: error: invalid floating point option: -mfpu=fpv4-sp-d16

Obviously für compilation 'cc' instead of arm-*-gcc is used. How can I circumvent this problem?

Cheers

  • Please make sure that the comiler that you use supports ARM cortex M4F. If it does, take a look at the Makefile, make sure the name of the compiler and linker match the compiler you use, you might need to make some name changes.

    Hope it helps,

    Angela 

  • Hi Angela,

    I am using gcc-arm-none-eabi-4_7-2012q4 which should support ARM cortex M4F. I also used the summon-arm-toolchain without success. The Makefile from StellarisWare points to a file "makedefs"  which should take care of recognizing the right compiler.

    Regards

  • HI,

    The compilation of StellarisWare is based on an variable VARIANT which should be defined as "cm4f" and not "cortex-m4" as you try. This declaration first appear in makedefs, but the variable is defined in the Makefile for each project. As I can see, you tried to compile first the driverlib - in this case go to driverlib folder and change the name of Makefile.driverlib-cm4f just in Makefile if you use a cm4f processor. Similar action for cm3. Then go back to StellarisWare folder and just "make".

    Petrei

  • Hi Petrei,

    in stellarisware/driverlib there already is a file called "Makefile". So what I did is backing it up and replacing it by Makefile.driverlib-cm4. Then I go back and try "make". Same error appears.

    I also don't know why I should these steps since none of the tutorials suggest doing this?


    Regards

  • Hi,

    Try to look/read the file Makefile.driverlib-cm4 - the variable ROOT moves you outside and in this case makedefs is not included, so errors. Try as I suggested and tell me the result.

    Another easier method to solve your problem(s) is to look at this page: http://gnuarmeclipse.livius.net/blog/ and install this plug-in in Eclipse. It uses a managed make, so you don't need to write yourself makefiles. Just add them to the project.

    Petrei

  • Hi,

    I just checked before answering to you - driverlib was not compiled - and making this modification solved the problem.

    Petrei

    EDIT: re-checked again, works OK as delivered by TI. I don't know what was the cause in the first try. Check your files - why do you have (cortex-m4) instead of cm4f?

  • I did the following things for both  a) the full StellarisWare Package (SW-LM3S-9453.exe) and the one for the Stellaris Launchpad (SW-EK-LM4F120XL-9453.exe):

    1. extract the respective zip-file: unzip ../SW-*.zip

    2. apply the change you suggested: cd driverlib && mv Makefile.driverlib-cm4f Makefile

    3. Try to compile: cd .. && make

    The same error persists.

    I don't know why it is cortex-m4 instead of cm4f..this value is out of the box.

    Regards

  • Hi,

    This is very strange - do you have some path/symlinks to something related to makefiles/modifications from kernelhaks site? there is defined also cortex-m4, but he adds driverlib.a, not building it.

    Another question: a simple example as blinky which does not uses driverlib, works OK on your toolchain?

    Petrei

  • Hi,

    there are no extra path/symlinks as far as i know. I can not build the blinky example using "make". It produces the same error. However, I can compile it using Keil µVision under Windows, which won't help me in this situation.

    Regards

  • Sorry to bump this topic. However, I am still not able to compile stellarisware due to this compiling problem. I folowed several guides and I was also using ubuntu's gcc-arm-linux-gnueabi package (following this guide) - wihtout success, reproducing the same error. I also edited StellarisWare/makedefs:

    #PREFIX=${shell type arm-stellaris-eabi-gcc > /dev/null 2>&1 && \
    # echo arm-stellaris-eabi || echo arm-none-eabi}

    PREFIX=arm-bare_newlib_cortex_m3_nommu-eabi

    to let the make file know which compiler I am using. However, looking at the error message it seems that it still invokes the "regular (in this case wrong)" gcc.

    I am really stuck with this. Does anyone have any additional hints?

  • Hi,

    gcc-arm-linux-gnueabi is not the good compiler - this should be arm-none-eabi-gcc. Download and install this - it is the latest version, with all bells and whistles for hardware floating point routines needed for Cortex-M4. (Yours is for compiling Linux-OS).

    Petrei

  • Hi Petrei,

    after researching for hours I found the solution. Actually it was not due the gcc-arm-linux-gnueabi (this gcc version is used in this tutorial and it seems to work: http://www.whence.com/arm/easy-arm-none-eabi-gcc-toolchain/) However, I found that on my ubuntu box there was a package installed called (gcc-cm3-eabi-*). I couldnt find it in the official packages nor could I remember to have it installed manually. However, after purging it, stellaware could be compiled correctly.

    Thanks again for the tips!

  • Hi,

    I understand - but the author is not sure about one point: "* TODO: investigate gcc-arm-linux-gnueabihf (hardfloat)" -  take care of that - if you will need/use floating point with TM4C, then the hardware version of floating point routines is a must - this reduces both the size and execution time. What I suggested has all these ( I checked with some examples) and more, there are already built-in binaries if you are interested.

    I have also doubts about the generated code - just compile an board example and then compare the size of the .bin file with the original CCS - if within 20..100 bytes is OK, but if more than  that must rise questions (use the release version for comparison, since this is what TI provide)

    Petrei 

  • Hi Petrei,

    thanks for clarification!

    Regards