Compiling C++ on EFM32 microcontrollers

armcembeddedmicrocontroller

I would like to use some high-level libraries written in C++ for my EFM32 microcontroller. Unfortunately the Simplicity Studio IDE for the EFM32 does not seem to support C++.

I am a bit confused about whether it is still possible to develop in C++ for this microcontroller family. I am thinking that I could use the GNU ARM Embedded Toolchain to do this with a custom Makefile but I am not sure it could work and what are the arguments that should be given to the different GNU tools to compile and link for a given microcontroller (gcc, ld, g++, …)

So first is it possible?
If yes, what are the high-level steps that must be done? I really would like to understand what is happening at compilation and linking time so do you have any resources on learning how to tweak a Makefile using the GNU Toolchain to compile for a given microcontroller?

Best Answer

Of course it is possible to use GCC with a Cortex-M3 chip. (I assume the manufacturer has not deliberately kept something secret that you must know in order to do so).

In a nutshell, you must

  • get or write startup code (ctr0)
  • get or write a linkerscript
  • find out what special command line options you need (-nostartup etc)
  • find out how to download the application (probably as .hex file)
  • (optionally) write a makefile to automate the process

If you use any built-in libraries or code generation tools of the IDE you'll have to port that too.

As a start, check out any project that has combined GCC and EFM32. RTOSses like FreeRTOS and uCOSII are a good place to look. In a comment markt suggest coocox, also worth a look. It is much easier if you can start with a know-working set of scripts and make your own one step at a time.

Been there, done that, but for the NXP LPC1114/LPC810: check www.voti.nl/bmptk At the moment (december 2014) I am reworking it, but the .zip should work and can give you an idea of what is involved.