Contiki-NG uses the C programming language to develop applications for WSN motes. In this chapter, you will learn this basic language for creating Contiki-NG programs.
Contiki-NG programming applies protothreads. In general, we can develop Contiki-NG applications using the follow work flow.
1 | Start -> Open a project folder -> Establish a Contiki program -> Configure and Compile -> Flash or Simulate -> Test-> End |
If we open the source code of Contiki-NG OS, we can see several folders.
Folder | Description |
---|---|
arch | Contains cpu , platform, and dev for development |
arch/cpu | Specific MCU information |
arch/dev | External chip and devices |
arch/platform | Specific files and platform drivers |
os | Contiki-NG core files and libraries |
tools | Tools for flashing, debugging, simulating several |
examples | Contiki-NG program samples |
tests | Several test programs |
os
: Contains the actual Contiki-NG code. Includes the systems primitives such asprocesses
andtimers
, the networking stack, and all libraries and services. All examples also compile and link toos
.arch
: Contains all hardware-dependent code. This includes CPU, device and platform drivers. A list of supported platforms can be found under arch/platforms and its sub-directories. This is where to put we code if we are porting Contiki-NG to our own platform.examples
: Contains ready-to-use example projects. Shows how to use networking, libraries and storage services. Includes a RPL border router, the slip-radio interface etc.tools
: Contains tools, which are not to be included in a Contiki-NG firmware, but rather intended to run on a computer. Includes flashing tools, theCooja
simulator (as asubmodule
),Docker
andVagrant
scripts, and more.tests
: Contains all continuous integration tests. These run in Travis for every pull request and merge, to ensure non-regression.