Using Contiki

From Glacsweb Wiki
Jump to: navigation, search

Compiling for Sensinodes! [1]

  • IT IS POSSIBLE!! However normal contiki tree is for an older sensinode with 18.4 SoC radio!
  • Essentially instant contiki doesn't work, you need to remove the version of sdcc on there (2.9.0) and replace it with a newer one
  • The instructions from this come from Loughborough but I'll summarise what you need to do here
  • Firstly download their version of contiki which contains support for uIPv6 and RPL on sensinode devices, with many bugfixes apparently! [2]
  • Then follow these instructions
Download a recent snapshot of the sdcc sources
Extract the archive
./configure --disable-gbz80-port --disable-z80-port --disable-ds390-port --disable-ds400-port --disable-pic-port --disable-pic16-port --disable-hc08-port
make
cd device/lib
make model-mcs51-stack-auto
cd ../..
sudo make install
Done. You should now be able to see a non-empty large-stack-auto directory in your sdcc library path (default on linux is /usr/local/share/sdcc/lib)

This made me so happy! --Jt14v07 11:09, 17 November 2010 (GMT)


See Contiki on Sensinode

General Contiki Notes

  • mspgcc version 3(.2.3) required
  • sdcc (> 2.9.7) required for compiling for sensinodes
  • COOJA requires Java

--Jt14v07 12:16, 5 November 2010 (GMT)

Using the simulator COOJA

Update Contiki

  • Update to latest version, cd into contiki-2.x directory
  • Command: cvs update -dP
  • Download Contiki 2.5

First steps

  • Enter the directory contiki-2.x/tools/cooja
  • Run the command "sudo ant run" to get COOJA to run
  • When COOJA starts you need to click File -> New simulation
  • Then you need to add nodes. Mote Types -> Create mote type -> {pick} (Sky)
  • Add the code by clicking "Browse" next to "Contiki process..." and selecting the *.c file that you want to run
  • Click Compile and then Create
  • Choose the number of nodes you want to add and "Create and Add"
  • You can then see the nodes in the Visualiser. You will want to add skins to the visualiser to show information. The most useful are Radio traffic and LEDs.
  • Click Start in the Control Panel and the simulation starts

Troubleshooting

  • If nothing is being transmitted make sure the other nodes are in range by using the "Radio Environment" skin
  • If something is not compiling "cd" into the directory and "make clean"

--Jt14v07 16:43, 17 October 2010 (BST)

Using Contiki with Devices

Moving stuff to devices

You need to use mspdebug from linux, follow the instructions at MSP Programming

Problems

  • Contiki requires mspgcc 3 to compile
  • Our device (cc430x6137) requires mspgcc 4 to compile
    • Which means we can't compile Contiki for our device!
  • The contiki platform included is for msb430, which isn't the same as our board
    • This means that the locations for the the I/O ports will probably be wrong and things are likely to not work!
  • Difficulties in using the debugger within a virtual machine
    • Difficulties in setting up the environment correctly with a native machine

What we've tried

  • Compiling with both compilers
  • Hacking the code to make it compile with mspgcc 4
  • Hacking msb430 to make it work with our platform
  • Writing our own msp430 platform

--Jt14v07 12:01, 5 November 2010 (GMT)

Useful Resources

  • A guide on how to upload and run contiki onto a simular sensor to ours device, this guide also explains how to get some battery information and how to talk to a sensor over ipv6. Contiki IPSN 2009 Tutorial --Ab34v07 22:46, 12 October 2010 (BST)
  • Great presentation which explains the basic structure of a Contiki program and shows the four types of timers and how to call back a process to deal with it. Contiki Hands-on --Ab34v07 20:20, 14 October 2010 (BST)