Contiki build system

From Contiki
Revision as of 11:47, 7 March 2014 by Rahul (Talk | contribs)

Jump to: navigation, search

Back to Contiki Tutorials


Contiki has a useful and complex build system that consists of multiple Makefiles. These multiple Makefiles make it simple to compile code for different platforms and with different parameters. We do not need to worry about editing the Makefile; instead we can just reuse the files available in the distribution. A complete documentation of the build system can be found here and here

The base Makefile file is located in the root directory: contiki/Makefile.include. It must be included in the user's Makefile. Depending on the target platform, which must be specified by the user, other Makefiles are merged before compilation. The other Makefile may be platform or cpu-dependent, and they can be found in folders: contiki/platform/*/Makefile.platform' and contiki/cpu/*/Makefile.cpu.

Changing the Platform

The default target is native, which compiles code to be executed on the host machine (x86). Other available targets are: "z1, wismote, stk500, sky, etc.". The Sky Motes used in ANRG lab should be burned using target sky.

To compile a code for sky platform we should simply type make TARGET=sky. To compile for default (native) platform, we should simply type make. It is possible to change the default platform typing make TARGET=sky savetarget. This creates a file with the definition of the new default platform. The process of defining the default platform affects only the application being developed inside the current directory. If you change your path to another directory where does not exist, the default target will be native again.

Build system can also be used to upload the compiled firmware into the platforms. We just need to append ".upload" to the end of the firmware file name. In order to upload hello-world application, for instance, we should type make hello-world.upload.

Serial Interface

Make can also be used to invoke serial-dump-linux application and open the serial port with target platform. Typing make login, for example, opens up a serial connection with the first device connected to the development machine (usually at /dev/ttyS0).

Back to Contiki Tutorials