NAME

ncc - nesC compiler for TinyOS

SYNOPSIS

ncc [-target=pc|mica|mica2|mica2dot|...] [-tosdir=dir] [-print-tosdir] [-nostdinc] [-board=micasb|basicsb|micawb|...] [-docdir=dir] [-topdir=dir] [-graphviz=y|n] [-fnesc-nido-tosnodes=n] [-fnesc-cfile=file] [-fnesc-no-inline [-Wnesc-xxx] [any gcc option] files...

DESCRIPTION

ncc is an extension to gcc that knows how to compile nesC applications. If invoked on regular C files, it behaves exactly 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.

The additional options recognized by ncc over gcc are:

-target=X

specify the target architecture for this compilation. If pc is specified, the compilation uses the tossim environment and produces a locally executable file. The default target is mica, the possible targets are set by the TinyOS distribution (see the tos/platforms directory).
-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.
-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.
-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).
-docdir=dir
generate documentation for the compiled component in directory dir.
-topdir=dir
specify directory paths that should be stripped from the source file names when generating "package names" for the documentation files. The directory above TOSDIR is automatically added, so this option is only needed for directories outside the main TinyOS distribution.
-graphviz=y|n
explicitly enable or disable the use of the graphviz tool in the generated documentation. Without this option, graphviz is enabled iff the `dot' program is found in the current path. Use of graphviz requires `dot'. The documentation generation tool checks the version of `dot', and enables client-side image maps, if supported.
-fnesc-tossim-tosnodes=n
specify the maximum number of nodes that can be simulated in the tossim environment.
-fnesc-cfile=file
specify a file in which to save the C code generated when compiling a component. Note: if you specify two components on the command line, then the C code from the second one will overwrite the C code from the first.
There are a number of warnings specific to nesC, specified with -Wnesc-X, where X is (all these warnings are off by default):
  • fnptr: Warn when function pointers are used (use of function pointers is deprecated in nesC and leads to inaccurate data race detection).
  • async: Warn when interrupt handlers call commands or events not annotated with async.
  • data-race: Warn about potential data races.
  • combine: Warn when configuration wiring leads to "fan-out" and the function return type does not have a combining function defined.
  • docstring: Warn when unexpected documentation strings (starting with /**) are seen.
  • all: Turns on fnptr, async, combine and data-race.
  • error: Turns the fnptr, async, combine and data-race warnings into errors.
  • When compiling a nesC component, the nesC compiler recognizes the gcc C language (-f...) and warning (-W...) options. The -S, -c and -o options work as usual, the -x option accepts nesc. Directories can be added to nesC's search path with -I (see the search path discussion below).

    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, %% 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:

    1. ./
    2. -I directives (in option order)
    3. %T/sensorboards/boardname, for each -board=boardname option specified (in option order)
    4. %T/platform/%p
    5. Additional directories requested by the selected target (e.g., %T/platform/avrmote for the mica target)
    6. %T/interfaces
    7. %T/system
    8. %T/lib
    9. `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:
    1. ./
    2. -I directives
    3. `NESCPATH' environment variable directories

    PREPROCESSOR SYMBOLS

    ncc defines the following preprocessor symbols:

    ENVIRONMENT VARIABLES

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

    `NESCPATH' is a colon separated list of additional search directories for nesC components.

    SEE ALSO

    gcc(1), avr-gcc(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). The warnings for the new nesC 1.1 features (see -Wnesc-all) are off by default to increase compatibility with nesC 1.0 code. To match the language specification in the nesC 1.1 reference manual, you should compile with -Wnesc-all and -Wnesc-error. These options will become the default in future releases.