Tailoring the TinyOS Build Environment

Last updated 03 Sep 2003

When building TinyOS applications, it is useful to define certain build parameters that are specific to your needs.  Such parameters include the operating frequency (mica2/mica2dot), the Group ID, different component libraries, etc. This section describes how to tailor your TinyOS build environment to suit your needs.

The Makelocal file

The Makerules file in the apps directory manages many aspects of the build process for TinyOS applications. While it is possible to edit this file to make changes, such practice is not advisable since 1) the Makerules file is not intuitive, 2) changing this file may break the build process, 3) the changes may not portable to other users. 

To allow for tailoring the build environment, the Makerules file looks for a Makelocal file located in the apps directory and includes it in the build process. Changes made to the Makelocal file can be easily reversed (just delete/rename the file) and can be distributed to other users.

To use this feature, create a Makelocal file in the apps directory which contains your custom definitions using standard makefile syntax.  For example: 

# Makelocal File

PFLAGS += -I%T/../beta/MyBetaCode

DEFAULT_LOCAL_GROUP = 0x33

PFLAGS += -DCC1K_DEF_FREQ=916700000

EPRB=myprogrammer.foo.com

The above Makelocal file adds a search path for code in ../../beta/MyCode, defines the default Group ID (0x33) and manual frequency setting (916.7 MHz) for the mica2 series motes, and sets the default programmer as an EPRB with hostname 'myprogrammer.foo.com'


Tutorial Index