Contiki-NG is an open-source, cross-platform operating system for Next-Generation IoT devices. It focuses on dependable (secure and reliable) low-power communication and standard protocols, such as IPv6/6LoWPAN, 6TiSCH, RPL, and CoAP. Contiki-NG comes with extensive documentation, tutorials, a roadmap, release cycle, and well-defined development flow for smooth integration of community contributions.
Unless explicitly stated otherwise, Contiki-NG sources are distributed under the terms of the 3-clause BSD license. This license gives everyone the right to use and distribute the code, either in binary or source code format, as long as the copyright license is retained in the source code.
Contiki-NG started as a fork of the Contiki OS and retains some of its original features.
Find out more:
- GitHub repository: https://github.com/contiki-ng/contiki-ng
- Documentation: https://github.com/contiki-ng/contiki-ng/wiki
- Web site: http://contiki-ng.org
- Nightly testbed runs: https://contiki-ng.github.io/testbed
Engage with the community:
- Gitter: https://gitter.im/contiki-ng
- Twitter: https://twitter.com/contiki_ng
Below are listed a series of useful commands and other tips for Contiki NG and Cooja usage focused on MacOS and Docker environment.
-
MacOS adjustments for Docker usage
- Include in ~/.bash_profile:
export CNG_PATH=<absolute-path-to-your-contiki-ng> alias contiker="docker run --privileged \ --mount type=bind,source=$CNG_PATH,destination=/home/user/contiki-ng \ -e DISPLAY=docker.for.mac.host.internal:0 \ -ti contiker/contiki-ng"
-
MacOS adjustments XQuartz
- Use this version of socat command for X11 server
socat TCP-LISTEN:6000,reuseaddr,fork UNIX-CLIENT:\"$DISPLAY\" &
- In case the port is in use kill the process and try again (if possible, if not the port has to be changed in the Docker)
lsof -nP -iTCP:6000 | grep LISTEN kill -9 $PID
-
Run Contiker Docker
- Start new container and run bash
contiker bash
-
Start new container and run Cooja
contiker cooja
-
Usefull Docker commands
- List all Docker images in your host
docker image ls -a
- List all Docker Containers ( Containers are instances of images, you can have N containers for 1 img)
docker container ls -a
- Rename container
docker container <CONTAINER-ID | CONTAINER-NAME> rename <NEW-NAME>
- Start container
docker container <CONTAINER-ID | CONTAINER-NAME> start
- Stop container
docker container <CONTAINER-ID | CONTAINER-NAME> stop
-
Run cooja on docker from its bash
- Using shortcut in home dir:
~/cooja
- Or going to Cooja dir in contiki-ng/tools/cooja and running:
// run cooja ~/contiki-ng/tools/cooja$ ant // run cooja with higher Heap memory available to Java. // Usefull for big simulations 1536M instead of 512M ~/contiki-ng/tools/cooja$ ant run_bigmem // run without GUI // ../../.. relates to home dir // all paths are realtive paths ~/contiki-ng/tools/cooja$ ant run_nogui -Dargs=../../../examples/benchmarks/rpl-req-resp-modified/sim_100.csc
-
Advanced Cooja Run: No GUI + increased heap mem
- Run cooja without GUI in Cooja DIR:
~/contiki-ng/tools/cooja$ java -mx1536m -jar dist/cooja.jar -nogui="../../examples/benchmarks/rpl-req-resp-modified/sim_100.csc" -contiki="../.."
-
Run command on different folder without leaving the folder
~/contiki-ng/tools/cooja$ (cd ~/contiki-ng/examples/benchmarks/rpl-req-resp-simple/ && make TARGET=cooja clean)