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?
-
1\$\begingroup\$ You could do it the hard way, or you could try www.coocox.org - their (Eclipse-based) IDE supports a couple of the EFM32's, uses GCC, and has C++ support. \$\endgroup\$markt– markt2014年12月22日 12:49:23 +00:00Commented Dec 22, 2014 at 12:49
-
1\$\begingroup\$ Title is erroneous, you seek to compile C++ for the MCU, not on it. \$\endgroup\$Chris Stratton– Chris Stratton2017年07月06日 21:57:06 +00:00Commented Jul 6, 2017 at 21:57
2 Answers 2
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.
The recent version 4 of Simplicity Studio supports C++ for the EFM32 by using arm-none-eabi-g++. Be sure to start with a C++ project. Converting an C project, which didn't offer C++ compiler options, to support C++ led to errors for me.