Compiling Contiki for CC1350

Setup:

  • macOS 10.13.5
  • VM – VirtualBox
  • Guest OS: Ubuntu 16.04

Setup Contiki on the local machine:

Install the following packages. you might need sudo right.

# sudo apt-get remove gcc-arm-none-eabi gdb-arm-none-eabi binutils-arm-none-eabi
# sudo add-apt-repository http://ppa:team-gcc-arm-embedded/ppa
# sudo apt-get update

Compile Contiki hello-world for Native:

Native means that your code will compile and run directly on your host PC.
for me, it will run on the Ubuntu 16.04 OS on the VM.

cd into your development folder.

# git clone https://github.com/contiki-os/contiki
# cd contiki/examples/hello-world
# make TARGET=native
mkdir obj_native
  CC        ../../core/ctk/ctk-conio.c
  CC        ../../platform/native/./contiki-main.c
  CC        ../../platform/native/./clock.c
  CC        ../../core/dev/leds.c
### output truncated ###
  AR        contiki-native.a
  CC        hello-world.c
  LD        hello-world.native
rm hello-world.co

The target command tells the compiler to compile for the current system.
This is what is later changed for cross compiling to our target platform.

Type the following command to run the hello-world program.

# ./hello-world.native
Contiki-3.x-3343-gbc2e445 started with IPV6, RPL
Rime started with address 1.2.3.4.5.6.7.8
MAC nullmac RDC nullrdc NETWORK sicslowpan
Tentative link-local IPv6 address fe80:0000:0000:0000:0302:0304:0506:0708
Hello, world

if this is how it worked! your compilation worked!

Compiling Contiki-OS for CC13xx

The only thing to be changed is the target. make clean is an important step.

make clean
make TARGET=srf06-cc26xx BOARD=sensortag/cc1350

this says the compilation works if you see the following:

CC ../../cpu/cc26xx-cc13xx/lib/cc13xxware/startup_files/ccfg.c
CC ../../cpu/cc26xx-cc13xx/./ieee-addr.c
AR contiki-srf06-cc26xx.a
CC ../../cpu/cc26xx-cc13xx/./fault-handlers.c
CC ../../cpu/cc26xx-cc13xx/lib/cc13xxware/startup_files/startup_gcc.c
CC hello-world.c
LD hello-world.elf
arm-none-eabi-objcopy -O ihex hello-world.elf hello-world.i16hex
srec_cat hello-world.i16hex -intel -o hello-world.hex -intel
arm-none-eabi-objcopy -O binary --gap-fill 0xff hello-world.elf hello-world.bin
cp hello-world.elf hello-world.srf06-cc26xx
rm hello-world.i16hex hello-world.co obj_srf06-cc26xx/fault-handlers.o obj_srf06-cc26xx/startup_gcc.o

This error absolutely means that the installation of the compiler for cross-compilation wasn’t successful.

/bin/sh: 1: arm-none-eabi-gcc: not found

Next step would be to compile with contiki-ng since, there is active development is happening there and to base all developments to that repo.

# git clone https://github.com/contiki-ng/contiki-ng
# cd contiki-ng
# git submodule update --init --recursive

navigate to the hello-world example and hit the following

# make clean make TARGET=srf06-cc26xx BOARD=sensortag/cc1350

References:

[1] https://sunmaysky.blogspot.com/2015/08/setup-6lbr-to-run-6lowpan-with-cc2531.html

[2]https://sunmaysky.blogspot.com/2015/09/contiki-subg-hz-6lowpan-on-cc1350.html

TI CC2530DK – Contiki OS – Internet of Things

This blog post is an effort to create a one stop information for starting off your Contiki project with cc2530DK.

There is enough information already available on Github wiki. This post is more than an extension to have all information under one place and as usual my way of documenting my projects!

Continue reading “TI CC2530DK – Contiki OS – Internet of Things”