Friday, November 29, 2013

using efm32 simplicitystudio under Linux

Intro


So I went to a workshop yesterday mostly about the Silabs/Energy Micro micro-controllers. The workshop was rather interesting, but the workshop was done with the tools in Windows 7. As I'm working almost exclusively under Linux since 1998, this was quite a painful experience for me. Especially USB device handling is so much smoother in Linux. But enough about my windows pain. The EFM32 micro-controllers are based around ARM Cortex and seem to be genuinely nice ICs with a bunch of special low-power features. I'm not going to list all those as this is not a marketing post, you can find enough information about that on the internet already.

I came back home with two very nice dev-boards, which is pretty cool in itself!

EFM32 ZERO GECKO running a nice Space Invaders clone demo
EFM32 WONDER GECKO running a light sense demo


Linux

When I arrived back home I started reading up a bit more about the ICs and one of the first things I found  in a vid on youtube is that the simplicity studio is also available for Linux and OSX.

Going to the silabs download website only gave a download for windows, but a quick google brought me to the Energy Micro forum where there is a beta download or simplicity studio for Linux and OSX available. After a few tricks it works smoothly in Linux, if only I had known that a day sooner ;)

Installation

What I did to get a working installation on on my x86-64 Debian Jessy laptop:
  • download the simplicity studio beta
  • unzip the zipfile somewhere
  • enter the studiow/ map
  • start the start-studio.sh shell script: ./start-studio.sh
This will provide you with an installer for the simplicity studio software. This installer will install all the needed software. When the software is installed you can start simplicity studio itself also with ./start-studio.sh.

In the simplicity studio main tool page press the add-remove button and use it to install everything. This will download all the examples, demos and app-notes.

Now while the main tool works, I quickly found out that most sub-tools didn't. It turned out that because simplicity studio is a 32-bit application and my system is 64-bit, I was missing some 32-bit libraries it needs, although I could imagine some people also missing some libraries on their 32-bit system.

A quick apt-get to the rescue:

sudo apt-get install libusb-0.1-4:i386 libqt4-svg:i386 

Depending on your system you may need to install some more missing libraries. This is rather easy to see as if you started simplicity studio from the command-line it will print out a missing library when you access a tool that is needing it.


Demos

The easiest way to play with the dev-kits is run some of the demos. Connect the board with the mini usb cable and press the Demos button in simplicity studio. Select a demo and press start. It will upload the demo and start the energyAware profiler program allowing you to real-time monitor the current consumption for that particular demo.


Compilers & Uploading

Demos are fun, but compiling your own code requires some more setup.

  • download and install the arm-gcc compiler from https://launchpad.net/gcc-arm-embedded
  • in simplicity studio press examples, select the dev-board you're using (EFM32WG_STK3800 for the wonder gecko, EFM32ZG_STK3200 for the zero gecko)
  • choose the blink example (or another one)
  • press open folder, this will open some gui explorer for your desktop environment
  • go to that directory in the shell, in my case it is /some/path/kits/EFM32WG_STK3800/examples/blink
  • enter the armgcc directory
  • there is a makefile there called Makefile.blink
  • open the file with an editor and a definition for your toolchain location to it, in my case I added
 LINUXCS := /some/path/gcc-arm-embedded/gcc-arm-none-eabi-4_7-2013q3

  • alternatively you could just export that LINUXCS to the environment
  • now do:
make -f Makefile.blink
  • it will now have made a file blink.bin in the exe/ subdirectory
  • you can upload this bin file with the tool called "energyAware commander", this should be easy
  • alternatively you can use energyAware commander to upload from the commandline:
./start-eACommander.sh --flash /some/path /kits/EFM32WG_STK3800/examples/blink/armgcc/exe/blink.bin

The same principle works for other examples and app-notes.

Some more pics

a closeup of the 128x128 sharp memory LCD display on the ZERO GECKO

ZERO GECKO running an analog clock demo


Cortex-M0+ closeup
Cortex-M4 closeup