EFM32 development on Linux using arm-gcc
Installing Simplicity Studio on Linux
Simplicity Studio will give you some useful tools such as energyAware Profiler and energyAware Designer, as well as documentation and example projects that you can clone to get started working with EFM32.
To install Simplicity Studio on Ubuntu Linux, follow these steps:
# Go to your home directory
cd ~
# Download Simplicity Studio
wget http://cdn.energymicro.com/dl/packages/studio_linux.tar.gz
tar -xvf studio_linux.tar.gz
# If you prefer (like me) to not keep your home folder too crowded, "hide" the new energymicro folder by adding a '.' in front of it
mv energymicro/ .energymicro
# Go to the development studio folder
cd .energymicro
# And change the following line of the studio.py
file as shown below
studioNewPath = packagePath + 'Simplicity Studio New'
to
studioNewPath = packagePath + 'studio_new'
# Now, make sure the studio_new
folder is in your path
echo PATH=$PATH:.energymicro/studio_new
or add a link to the studio executable to a folder on your path (in my
case, ~/.mybin
)
cd ~/.mybin
ln -s ~/.energymicro/studio.py em-studio
# You will now be able to run the Energy Micro Studio from anywhere on your path by running the following command
em-studio
Note that* the first time you run the studio it will ask to download the documentation files and example projects. This might take a while, but it's well worth it, since it's why you installed the studio in the first place.
Installing gcc-arm-none-eabi
# Go to https://launchpad.net/gcc-arm-embedded and download the latest compiler version from the links on the right of the page
# On ubuntu 14.04 it is already available in the repo (gcc-arm-none-eabi) or in older version, it was available via a PPA. See https://launchpad.net/~terry.guo/+archive/gcc-arm-embedded
# Alternatively, do a wget
on a specific version and untar
it:
wget https://launchpad.net/gcc-arm-embedded/4.8/4.8-2014-q1-update/+download/gcc-arm-none-eabi-4_8-2014q1-20140314-linux.tar.bz2
tar xjvf gcc-arm-none-eabi-4_8-2014q1-20140314-linux.tar.bz2
# Now, copy the arm-gcc folder to a location of choice (I chose
/opt
)
sudo cp -r gcc-arm-none-eabi-4_8-2014q1 /opt
Adapting example projects for make
The example projects coming with the Energy Micro Studio don't support all processors (and in particular, the EFM32GG330 processor selected for the watch project).
To adapt a project for another processor, here's what you have to do (example for the EFM32GG330F1024 processor)
# Clone the project for ARM-GCC to a location of choice using the Energy Micro Studio (pretty straightforward GUI, you should be able to figure it out)
# Change directory to the armgcc/
folder in the new project
cd /path/to/cloned/project/
cd armgcc/
# In the makefile, change the LINUXCS
variable to point to the path
where you installed gcc-arm-none-eabi
. Using the example
above:
LINUXCS = /opt/gcc-arm-none-eabi-4_8-2014q1
# In the makefile, change the device to the EFM32GG330F1024:
DEVICE = EFM32GG330F1024
# For some people, the Makefile contains references to ../Device/SiliconLabs/EFM32GG . Replace it by ../Device/EnergyMicro/EFM32GG :
sed -i -e 's#Device/SiliconLabs/EFM32GG#Device/EnergyMicro/EFM32GG#g' Makefile
# Now, copy the header file for the processor from the installation directory. Using the installation directory from the example above:
cp ~/.energymicro/Device/EnergyMicro/EFM32GG/Include/efm32gg330f1024.h /path/to/cloned/project/Device/EnergyMicro/EFM32GG/Include
# Running make
now from the armgcc
folder should do the trick
cd /path/to/cloned/project/armgcc
make -f name-of-makefile