| 792 | |
| 793 | == Contiki-ng |
| 794 | |
| 795 | 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. |
| 796 | |
| 797 | === Installing the Contiki-ng Docker image |
| 798 | |
| 799 | Compiling Contiki-ng examples is made easy through use of their docker container, this saves manually configuring the build environment. Even if you're unfamiliar with docker this procedure is quite simple. |
| 800 | |
| 801 | Official Contiki-ng wiki instructions: |
| 802 | https://github.com/contiki-ng/contiki-ng/wiki/Docker |
| 803 | |
| 804 | * Installing Docker can be done using apt:{{{ |
| 805 | sudo apt-get install docker-ce |
| 806 | }}} |
| 807 | Official instructions can be found here: https://docs.docker.com/engine/install/ubuntu/ |
| 808 | |
| 809 | * Once Docker is installed add your user to the docker group: |
| 810 | {{{ |
| 811 | sudo usermod -aG docker <your-user> |
| 812 | }}} |
| 813 | After log out and log back in. Missing this step will result in errors moving forward. |
| 814 | |
| 815 | * Download the Contiki-ng Docker image: |
| 816 | {{{ |
| 817 | docker pull contiker/contiki-ng |
| 818 | }}} |
| 819 | |
| 820 | === Download and link the Contiki-ng source to the container |
| 821 | |
| 822 | Clone the source code from the Contiki-ng github repository: |
| 823 | {{{#!bash |
| 824 | git clone https://github.com/contiki-ng/contiki-ng.git |
| 825 | cd contiki-ng |
| 826 | git submodule update --init --recursive |
| 827 | }}} |
| 828 | |
| 829 | Create an alias to start docker with required arguments and source code bound: |
| 830 | {{{ |
| 831 | export CNG_PATH=<absolute-path-to-your-contiki-ng> |
| 832 | alias contiker="docker run --privileged --sysctl net.ipv6.conf.all.disable_ipv6=0 --mount type=bind,source=$CNG_PATH,destination=/home/user/contiki-ng -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix -v /dev/bus/usb:/dev/bus/usb -ti contiker/contiki-ng" |
| 833 | }}} |
| 834 | |
| 835 | === Building the example: |
| 836 | |
| 837 | Launch the container by typing the {{{contiker}}}, this will use the alias that was previously created. You will be presented with a new shell, with the $PWD being "/home/user/contiki-ng". |
| 838 | |
| 839 | Change directory to the example you would like to build, in this case "hello world": |
| 840 | {{{ |
| 841 | cd examples/hello-world/ |
| 842 | }}} |
| 843 | |
| 844 | If you would like to see a list of Simplelink targets: |
| 845 | {{{ |
| 846 | make TARGET=simplelink boards |
| 847 | }}} |
| 848 | |
| 849 | To build for GW16122: |
| 850 | {{{ |
| 851 | make TARGET=simplelink BOARD=launchpad/cc1352p-2 |
| 852 | }}} |
| 853 | |
| 854 | The build artifacts are located in this folder: |
| 855 | {{{ |
| 856 | /home/user/contiki-ng/examples/hello-world/build/simplelink/launchpad/cc1352p-2/ |
| 857 | }}} |
| 858 | |
| 859 | If you would like to copy them out of your running container start a different shell, "cd" to your destination directory and execute the following command: |
| 860 | {{{ |
| 861 | docker cp <container $HOSTNAME>:/home/user/contiki-ng/examples/hello-world/build/simplelink/launchpad/cc1352p-2/<desired file> . |
| 862 | }}} |
| 863 | An easier way to gain access to the files is to type "exit" within the container, then navigate to the "contiki-ng/examples/hello-world/build/simplelink/launchpad/cc1352p-2/" directory on your host machine. |
| 864 | |
| 865 | Follow the instructions in the [wiki:/cc135x#Programming Programming] section to flash this firmware to your board. |
| 866 | |
| 867 | ==== Using the Hello World example. |
| 868 | |
| 869 | Connect your programmed GW16122 to a Gateworks SBC. This will create a /dev/tty interface, in most cases /dev/ttyUSB0. |
| 870 | |
| 871 | To view the output from the example: |
| 872 | {{{ |
| 873 | stty -F /dev/ttyUSB0 115200 |
| 874 | cat /dev/ttyUSB0 & |
| 875 | }}} |
| 876 | ** Example of the expected output: ** |
| 877 | {{{ |
| 878 | INFO: Main ] Starting Contiki-NG |
| 879 | [INFO: Main ] - Routing: RPL Lite |
| 880 | [INFO: Main ] - Net: sicslowpan |
| 881 | [INFO: Main ] - MAC: CSMA |
| 882 | [INFO: Main ] - 802.15.4 PANID: 0xabcd |
| 883 | [INFO: Main ] - 802.15.4 Default channel: 26 |
| 884 | [INFO: Main ] Node ID: 1813 |
| 885 | [INFO: Main ] Link-layer address: 0012.4b00.1cc1.0715 |
| 886 | [INFO: Main ] Tentative link-local IPv6 address: fe80::212:4b00:1cc1:715 |
| 887 | [INFO: CC13xx/CC26xx] Operating frequency on Sub-1 GHz |
| 888 | [INFO: CC13xx/CC26xx] RF: Channel 26 |
| 889 | [INFO: CC13xx/CC26xx] Node ID: 1813 |
| 890 | Hello, world |
| 891 | Hello, world |
| 892 | Hello, world |
| 893 | Hello, world |
| 894 | [INFO: Main ] Starting Contiki-NG |
| 895 | [INFO: Main ] - Routing: RPL Lite |
| 896 | [INFO: Main ] - Net: sicslowpan |
| 897 | [INFO: Main ] - MAC: CSMA |
| 898 | [INFO: Main ] - 802.15.4 PANID: 0xabcd |
| 899 | [INFO: Main ] - 802.15.4 Default channel: 26 |
| 900 | [INFO: Main ] Node ID: 1813 |
| 901 | [INFO: Main ] Link-layer address: 0012.4b00.1cc1.0715 |
| 902 | [INFO: Main ] Tentative link-local IPv6 address: fe80::212:4b00:1cc1:715 |
| 903 | [INFO: CC13xx/CC26xx] Operating frequency on Sub-1 GHz |
| 904 | [INFO: CC13xx/CC26xx] RF: Channel 26 |
| 905 | [INFO: CC13xx/CC26xx] Node ID: 1813 |
| 906 | Hello, world |
| 907 | Hello, world |
| 908 | Hello, world |
| 909 | Hello, world |
| 910 | }}} |