Quite a few months ago, I received an Energy Micro EFM32 Tiny Gecko Starter Kit, but I haven’t done much with it. But recently I saw a tweet from EnergyMicro about Simplicity Studio supports for Ubuntu, and I know it can be problematic to find proper tools for ARM MCU development in Linux, so I decided to give it a try. The first part is about Simplicity Studio, and energyAwareTools which are specific to Energy Micro, but the second part deals with setting up Eclipse and CodeSourcery ARM toolchain for MCU development which should be reusable for other MCUs from vendors such as Texas Instruments, NXP and STMicro. I’ve used a PC running Ubuntu 12.04 64-bit with the instructions below.

Since the binaries are build for Linux 32-bit, you may have to install a few i386 packages such as:

Shell

1

sudo apt-getinstall libreadline5:i386

Don’t try to install “libicu48:i386” even if you see a warning, this will mess up your system. First I did not pay attention, blindly answered “Y”, and it removed 991MB from my installation include libreoffice, gimp and unity support…).

To be able to access the USB device as a standard user, you need to add a file for udev, and change some permissions:

Shell

1

2

3

sudo cpdoc/45-jlink-NEW.rules/etc/udev/rules.d/

sudo groupadd plugdev

sudo usermod-a-Gplugdev&lt;username&gt;

Restart your system. And you can try energyAware Commander:

Shell

1

2

cd~/edev/energymicro

./eACommander.sh

It can connect via J-Link, and detect the board but trying to update the firmware resulted in the error “Failed when asking kit to reset”. I’ve also tried to run the demos without success. Anyhow, let’s move to the next step that is building our own app in Linux, and run them on the target.

Installation Eclipse in Ubuntu for Energy Micro Gecko Starter Kits

I knew I wanted to use an IDE in Linux to build and debugging the code, but among the list of third party tools listed on Energy Micro website, I was not too sure where to go. Luckily, somebody asked for the “Recommended IDE on Ubuntu” on Energy Micro forums, and the answer seems to be Eclipse + CodeSourcery ARM EABI toolchain. There’s also an application note to do just that for Windows, and I’ll use that to write instructions for Ubuntu or other Linux distributions.

First download and install Sourcery CodeBench Lite for ARM EABI and eclipse:

Now start eclipse, and install some plugins by going to “Help->Install New Software”, and add http://download.eclipse.org/releases/indigo to “Work With field”. Then browse to “Mobile and Device Development”, and select “C/C++ GDB Hardware Debugging”. Press the Next > button, and follow the instructions.

Repeat the same instructions with http://embsysregview.sourceforge.net/update to install Embsys Regview (Optional, and I haven’t tried it yet).

We can now start a new project using some sample code. I’ve tested it with blink and lightsense samples, and write the steps with blink sample below.

First go to File->New->Project-C/C++->C Project, and click Browser to navigate to blink sample project we’ve downloaded with Simplicity Studio (the path is energymicro/kits/EFM32TG_STK3300/examples/blink for my starter kit). Select Empty Project and “Linux GCC”, and click Finish.
Then click on Project->Properties, and do the following modifications:

We can now build the code. Select Project->Build Project, and within a few second you should see the build is successful in the Console tab.

Let’s configure the debugger. First run J-Link gdb server in a terminal window:

Shell

1

2

cd~/edev/energymicro

./gdbserver.sh

In Eclipse, click on Run->Debug Configuration, Highlight GDB Hardware Debugging, right-click to select New, and do the following modifications:

Main tab: Click the Select other… link on the bottom where it says Using GDB (DSF) Hardware Debugging Launcher and select the Standard GDB Hardware Debugging Launcher instead, and apply by clicking the OK button.

Debugger tab: Enter the full path to arm-none-eabi-gdb in the GDB command field. (e.g. /home/jaufranc/bin/arm-2012.09/bin/arm-none-eabi-gdb)

Debugger tab: Make sure Use remote target is checked, with Generic TCP/IP JTAG Device and localhost as Host name, and set 2331 as Port number.

I’ve just tested your Tutourial, in Xubuntu : it worked.
In this step in eclipse:” C/C++ Build: Modify build directory to ${workspace_loc:/blink/codesourcery}.”
I had to give the full path (don’t know why).
Now Im testing it on Debian 7.
I want to write a german Version of your Toutourial and publish it on my blog (http://technik.blogbasis.net/). Are you fine with this?