Wednesday, November 21, 2012

Free ARM toolchain with floating point unit support


The previous post(STM32F3 Discovery + Eclipse + OpenOCD) was based on the CodeSourcery Lite toolchain, which doesn't support floating point unit.
I have found an alternative: gcc-arm-embedded

You just have to download the Linux installation tarball and unpack it somewhere. After this, you have to edit the file Makefile from the project from this or this post and set TC variable to the new toolchain.
You have to set it like this:
TC = /path_to_toolchain/gcc-arm-none-eabi-x_x-xxxxqx/bin/arm-none-eabi
There is another way, like I did. Enter in Terminal:
gedit ~/.bashrc
add the line at the end of the file:
then save and close the file and then enter in Terminal:
source ~/.bashrc
Now you can run arm-none-eabi-gcc in every folder you like. For this case, you should set the TC just like in the picture above.

Then, you have to scroll down and find FPU variable
and set it like this:
FPU = -mfpu=fpv4-sp-d16 -mfloat-abi=hard

Now you are ready to develop great things.

Happy coding!


  1. As someone who is not that familiar with linux and new to this whole scene. I did not see the TC nor FPU variable in the make file. I assumed the TC variable was the TCL variable and set the folder location accordingly, but I do not see anything close to an FPU or float point variable. It would appreciated if you were a little more clear or thorough on your explanation.

    1. Hi!
      I have updated the post. Please let me know if you need more help.


  2. Thank you for the guide Andrei. I'm going to post it in my Robotics blog in italian language if you agree. I will cite your blog, it is very very useful.

    I'm going to use a STm32F3 Discovery board to develop a 9 DOF IMU for my robotic project and a STm32F4 Discovery board as low level motor control unit.

    You can find my blog at

    In this moment is a little empty because I lost all the work I did in last 4 years due to a server hardware crash. Now I am searching my local archives to insert all the content again... a long work :(

    1. Hi Walter!

      I am glad that my posts are helpful. Sure you can use my tutorials(it is an honor for me), but please remember to keep me in the references.
      I am sorry that you have lost the work. I also encountered this couple ears ago when I have "lost" my hdd.

      Good luck with the projects!

  3. Sir,

    I'm having the pesky error:

    Description Resource Path Location Type
    Type 'uint32_t' could not be resolved main.c /stm32f3/src line 59 Semantic Error

    I tried to set the PATH variable to include the proper include directory, but no joy. I had to add a PATH variable, not edit one. I am on very recent version of eclipse...

    Do you have advice?

    1. Try to include "stdint.h" library in main.c

  4. Just a few things, on Ubuntu 13.04 64bit I was using Eclipse 3.8 platform, with this version of Eclipse I had problems installing the GNU ARM Eclipse plugin as it was expecting some higher version of the Eclipse. So I installed Eclipse Kepler 4.3 Version. With this I was able to install all the plugin.

    Secondly the TCC variable had to be set to arm-linux-gnueabi for compilation to work.

    Now the linker is throwing the following errors.

    /home/krishnak/neweclipseworkspace/stm32f3//src/startup_stm32f30x.s:103: undefined reference to `__libc_init_array'
    /usr/lib/gcc-cross/arm-linux-gnueabi/4.7/../../../../arm-linux-gnueabi/bin/ld: BFD (GNU Binutils for Ubuntu) 2.23.2 assertion fail ../../bfd/elf32-arm.c:7683
    /usr/lib/gcc-cross/arm-linux-gnueabi/4.7/../../../../arm-linux-gnueabi/bin/ld: BFD (GNU Binutils for Ubuntu) 2.23.2 assertion fail ../../bfd/elf32-arm.c:7683
    /usr/lib/gcc-cross/arm-linux-gnueabi/4.7/../../../../arm-linux-gnueabi/bin/ld: error: required section '.rel.plt' not found in the linker script
    /usr/lib/gcc-cross/arm-linux-gnueabi/4.7/../../../../arm-linux-gnueabi/bin/ld: final link failed: Invalid operation
    collect2: error: ld returned 1 exit status
    make: *** [stm32f3.elf] Error 1

    The first error I can get rid of by commenting the function in the startup file, but the other errors remain.

    Can you help me with the other errors?

  5. It was my newbie mistake. I had not the correct arm toolchain. After installing arm-none-eabi from

    PPA at

    using sudo apt-get install gcc-arm-none-eabi

    I was able to compile successfuly

  6. Hello there and thanks for a great set of tutorials :)
    I'm trying to get this working but I need your makefile, and it would seem that your google code page is gone/private/something, as I'm getting an error 403 when trying to get a hold of the makefile.