Skip to content
HiKoB edited this page Nov 27, 2013 · 14 revisions

Warning

This repository is a fork from the Contiki-OS located at
contiki.git.sourceforge.net/gitroot/contiki/contiki
(commit a3e56371a59e27f49464b41cdebc30c5e0ef00c1)

This fork supports Contiki 2.6 and must be used with
Openlab Release 2012.07

The Openlab fork of the new official Contiki GIT repository hosted on Github
is available at https://github.com/hikob/contiki-os

===

This repository stores additions to the Contiki Operating System in order to support HiKoB OpenLab platforms.

Additions are done through new Contiki platform definitions and the use of OpenLab low level drivers.

All additional work can be found in

  • /platform/openlab
  • /platform/openlab-fox
  • /platform/openlab-newt

So far no other file has been modified in the repository and a simple copy of OpenLab directories to a Contiki system should be enough if you want to merge this version with your already modified repository.

Finishing Installation and First Compilation

To complete the installation process you only need to add a copy or a link to the OpenLab source code in

/platform/openlab/git

The link can be done quite easily on Unix using the following command:

ln -s [openlab path] [contiki path]/platform/openlab/git

Windows may have to copy the whole source tree.

Please refer to OpenLab installation notes for compiler and JTAG setup (see here).

links:

Compilation and Firmware Upload

The new Contiki TARGETs are openlab-fox and openlab-newt. The preferred way to flash firmware is by using the OpenOCD tool. Special make targets are pre-configured to make control the firmware upload process.

From a project you can use the following make command lines

  • Building the firmware:

    `make TARGET=openlab-[xxx] prog`
    
  • Flash the firmware:

    `make TARGET=openlab-[xxx] prog.u`
    
  • Perform a reset:

    `make TARGET=openlab-[xxx] reset`
    
  • Enter GDB session mode:

    `make TARGET=openlab-[xxx] debug`
    

Running Your First Example

The OpenLab port can reuse most of the available Contiki examples. Some examples that require special components or devices obviously won't work. Some other examples will work with slight modifications imposed by platform specific capabilities.

The sky/rt_leds example

For this example we will use the Tmote-sky RT-Leds example. The Contiki program is generic enough to run unmodified on OpenLab platforms.

$ cd examples/sky
$ make TARGET=openlab-fox rt-leds
$ make TARGET=openlab-fox rt_leds.u

will make the Red led change its brightness according to the pattern set in the example. For a slower changing pattern you can set the offtime maximum to 300.

line 38:     if(f->offtime <= 4 || f->offtime >= 300) {
line 53:     f->offtime = 300;

Button Sensor

The Sky Button-sensor example can also be used on OpenLab platform at the cost of a small modification. In order for the example to run, all references to the light-sensor need to be removed.

#include <stdio.h>
#include "contiki.h"
#include "dev/button-sensor.h"
// REMOVE #include "dev/light-sensor.h"
#include "dev/leds.h"
#include <stdio.h>

/*---------------------------------------------------------------------------*/
PROCESS(test_button_process, "Test button");
AUTOSTART_PROCESSES(&test_button_process);
/*---------------------------------------------------------------------------*/
static uint8_t active;
PROCESS_THREAD(test_button_process, ev, data)
{
  PROCESS_BEGIN();
  active = 0;
  SENSORS_ACTIVATE(button_sensor);

  while(1) {
    PROCESS_WAIT_EVENT_UNTIL(ev == sensors_event &&
                         data == &button_sensor);
    leds_toggle(LEDS_ALL);
    if(!active) {
      /* activate light sensor */
      // REMOVE SENSORS_ACTIVATE(light_sensor);
      // REMOVE printf("Light: %d\n", light_sensor.value(0));
  printf("On\n"); // ADDED
    } else {
      /* deactivate light sensor */
      // REMOVE printf("Light: %d\n", light_sensor.value(0));
      // REMOVE SENSORS_DEACTIVATE(light_sensor);
      printf("Off\n"); // ADDED
    }
    active ^= 1;
    leds_toggle(LEDS_ALL);
  }
  PROCESS_END();
}

Networking Examples

examples/rime have been tested and work on OpenLab platforms as well as IPv6 and 6LowPAN examples.

Both nullmac_driver and csma_driver Contiki Network MAC layers are known to work.

#define NETSTACK_CONF_MAC           nullmac_driver
#define NETSTACK_CONF_MAC           csma_driver

The following network RDC protocols are known to pass basic tests.

#define NETSTACK_CONF_RDC           nullrdc_driver
#define NETSTACK_CONF_RDC           cxmac_driver
#define NETSTACK_CONF_RDC           sicslowmac_driver

OpenLab-Contiki TODO List and Feedback

OpenLab Contiki port has been tested using several examples and benchmark tests to ensure that all clock and timers are usable in application.

Several Contiki features remain untested at this time.

  • Sensors (accelerometer, temperature ...) are available through the OpenLab API but are not wrapped into Contiki sensors.
  • USB and storage interfaces (CFS) are not done
  • OpenLab Rf2xx radio interface is wrapped in a Contiki radio_driver but some more work is needed on some operation to achieve efficient use of the radio according to Contiki communication patterns.

All these points should be fairly easy to handle.

Please provide feedback if you use the OpenLab Contiki port.