Installing Contiki

From George Smart's Wiki

This page was written for Mint Linux 14 (Cinnamon). It should apply equally to Ubuntu distributions around the 12 era. This guide is opposed to installing the standard suggested virtual-machine solution.

The Contiki Wiki has some very valuable information and is worth a look.

Once it's downloaded, you'll have a ZIP file: contiki-2.6.zip in my case. The next thing to do is to extract this zip file, and put the contents into your home directory and rename the folder, removing the version number so that the files have the path /home/username/contiki. You can do this graphically, or you can do it with the terminal:

unzip contiki-2.6.zip
mv contiki-2.6 ~/
mv ~/contiki-2.6 ~/contiki

You should end up with the following in your home directory:

MSP430 Toolchain

The next thing to do is to install the MSP430 toolchain. If you're running a newer Linux distribution which has these packages then you're in for a quick and easy ride. See here for more information.

Compile an Example

So the next stage is to see if it's working. Let's compile an example. I created a folder in my home directory called contiki-test and then copied the LED fading example from the example/sky folder to the new test folder. The following commands should do this:

Test Cooja

MSPsim Simulator

The last simulator to check is the MSP Simulator, and that is invoked like this:

make rt-leds.mspsim TARGET=sky

This offers simulation of a single node's hardware, in contrast to Cooja's network style simulation.

Errors I Found

relocation truncated to fit: R_MSP430_16_BYTE

This error is solved by editing contiki/cpu/msp40/Makefile.msp430 and removing the -g option from line 132, as described here.

Line 132 looses the -g option, changing from

CFLAGSNO = -Wall -mmcu=$(CC_MCU) -g $(CFLAGSWERROR)

to

CFLAGSNO = -Wall -mmcu=$(CC_MCU) $(CFLAGSWERROR)

Fixed the issue for me.

Other Stuff

This page just provides a few links and tips for anyone looking to get started with Contiki. Firstly, Contiki provides an instant environment which can be booted with a virtual machine and used. I wanted to have my environment run natively so I set about trying to work it out using Ubuntu. This process describes Ubuntu 10.04.3 LTS.