SYNOPSIS

ncc [-target=pc|mica|mica2|mica2dot|...] [-tossim]

    [-board=micasb|basicsb|micawb|...]
    [-tosdir=dir] [-tosscheduler=...] [-nostdinc]
    [--version] [-print-tosdir] [-print-platforms] [-print-target]
    [any nescc option] [any gcc option] files...

DESCRIPTION

ncc is an extension to nescc that knows how to compile nesC applications for a TinyOS environment. If invoked on regular C files, it behaves like gcc. When invoked on a nesC component or interface (.nc extension) file it compiles and links (except if the usual -c, -S, -E or -fsyntax-only options are used) that component with the other files specified on the command line.

ncc just invokes nescc with extra options based on the selected platform and sensorboard(s). And nescc itself just invokes gcc. Thus, for a full understanding of possible ncc options you should read the nescc and gcc man pages.

OPTIONS

ncc accepts all gcc and nescc options, and some additional TinyOS specific options:

-target=X

Specify the target architecture for this compilation. If -tossim is also specified, the compilation uses the tossim environment and produces a locally executable file. The default target is specified in the .default-platform file in your TinyOS directory (see -tosdir option), and defaults to mica if that file is absent. A platform that is not in the TinyOS distribution can be used if its directory is specified with an explicit -I directive (the platform name is taken from the directory's name, platform directories are recognised by the presence of a .platform file).

-tosdir=dir

Specify the location of TinyOS. This location can also be specified with the TOSDIR environment variable. If the variable and the option are both given, ncc uses the value specified with the option. If neither the environment variable or option are specified, ncc uses its compiled-in TinyOS directory.

-tosscheduler=component,unique-string,interface-name,interface-definition,run-event,post-command

By default, nesC compiles uses of task void taskname() ... to void taskname(), and post taskname() to TOS_post(taskname).

  • With this option, each task gets its own interface-definition interface, the task implementation is transformed into a run-event event and posts becomes a call to the post-command command. This per-task interface is automatically connected to the parameterised interface-name interface of scheduler component component. The parameter id for the connection is chosen with unique("unique-string").

  • If this option is not set explicity, its parameters are assigned by default as follows:

  • -tosscheduler=TinySchedulerC,TinySchedulerC.TaskBasic,TaskBasic,TaskBasic,runTask,postTask

-tossim

Compile for the TOSSIM environment rather than a native platform. Every directory in the search path will be duplicated, with the first copy having /sim appended to it.

-print-tosdir

Print the TinyOS directory to be used and exit, taking into account the -tosdir option and TOSDIR environment variable. No compilation occurs when -print-tosdir is used.

-print-platforms

Print the valid TinyOS platforms, including those made available by explicit -I directives (see -target option).

-print-target

Print the name of the selected target. Most useful when -target is not specified.

-nostdinc

Do not automatically include the TinyOS directories in the search path. See the discussion of search paths below for more details.

-board=Y

Specify one (or more) sensor boards. This effects the search path and preprocessor symbols. The set of boards is set by the TinyOS distribution (see the tos/sensorboards directory). As with targets, a sensorboard directory can be made available via an explicit -I directive (sensorboard directories are recognised by the presence of a .sensor file).

--version

Print the version of ncc, nescc and of the gcc compiler used for the selected target.

EXAMPLES

If you wish to compile a component Bar.nc to a C file, you can do:

  • ncc -c -o /dev/null -fnesc-cfile=Bar.c Bar.nc

SEARCH PATH

ncc performs the following substitutions on the directories specified with the -I option: %T is replaced by the TinyOS directory, %p is replaced by the selected target, %P is replaced by the target's platform directory, %% is replaced by %.

Except when -nostdinc is specified, the search path for nesC components is as follows, where tosdir is the TinyOS directory requested and target is the selected target:

  • The current directory

  • -I directives (in option order)

  • %T/sensorboards/boardname, for each -board=boardname option specified (in option order) - except if the sensorboard was found via an explicit -I directive

  • %T/platform/%p - except if the platform was found via an explicit -I directive

  • Additional directories requested by the selected target (e.g., %T/platform/avrmote for the mica target)

  • %T/interfaces

  • %T/system

  • %T/lib

  • NESCPATH environment variable directories (note that %T and %p subsitution is not performed on these directories).

When -nostdinc is specified, the search path is simply:

  • The current directory

  • -I directives

  • NESCPATH environment variable directories

PREPROCESSOR SYMBOLS

In addition to the preprocessor symbols defined by gcc and nescc, ncc defines:

PLATFORM_target

where target is the selected target name, converted to upper case

BOARD_boardname

for each -board=boardname option (the boardname is converted to upper case)

ENVIRONMENT VARIABLES

TOSDIR

If the -tosdir=dir option is not used, the TOSDIR environment variable specifies the location of TinyOS.

RELATED TO ncc…

gcc(1), platform-specific gcc, nescc(1)

NOTES

ncc is built over nescc, which handles the non-TinyOS-specific functionality of ncc. Users of nesC in a non-TinyOS context may prefer to use nescc (see the source code of ncc and nescc for details).