nc2moml

TinyOS is an event-driven operating system designed for sensor network nodes that have very limited resources (e.g., 8K bytes of program memory, 512 bytes of RAM). TinyOS, is used, for example, on the Berkeley MICA motes, which are small wireless sensor nodes. nesC is an extension to the C programming language designed to embody the structuring concepts and execution model of TinyOS.

nc2moml is used to convert nesC files (.nc configuration or module files with at least one interface) into MoML (.moml) files. This will create the Viptos (Ptolemy II) libraries of components that are used to assemble models. TinyOS provides a rich library of nesC components. If you install TinyOS 1.x in $PTII/vendors/ptinyos/tinyos-1.x , then the Viptos (Ptolemy II) configure script will find it and automatically make the TinyOS libraries available.

Installation notes

These nc2moml installation instructions assume that you already have the tools required for Viptos installed. This includes the AVR tools, make 3.80 or later, TinyOS 1.x, nesC 1.2.2 or later, and if you are running on Windows, Cygwin. We also assume that you have set up the necessary environment variables. If not, please see the Ptolemy II PtinyOS Domain Installation Notes.

How to install nc2moml

  1. Run the script that will unzip the file that contains additional compiler flags. It will place "opts" files into various directories in your tinyos-1.x tree. The script assumes that you have placed your tinyos-1.x tree as indicated in the instructions in the Ptolemy II PtinyOS Domain Installation Notes.
    cd $PTII/ptolemy/domains/ptinyos/util
    ./unzip-opts.sh
            

    If the executable permissions are not set correctly, run:

    chmod a+x unzip-opts.sh
            
    then try the step above again.

    If you placed your tinyos-1.x tree in a different location, you can find the opts.tar.gz file in $TOSROOT/contrib/ptII.

  2. Make sure that the tools in $PTII/bin have been built:
    cd $PTII/bin
    make
            
  3. Run the script to generate the .moml files from the .nc files.
    cd $PTII/ptolemy/domains/ptinyos/util/nc2moml
    ./nc2moml
            
    If the executable permissions are not set correctly, run:
    chmod a+x nc2moml*
            
    then try the step above again. The nc2moml command will take 10-30 minutes to complete.
  4. See if it worked:
    1. You should see some valid MoML code in:
      $PTII/vendors/ptinyos/moml

      The directory structure should reflect that of the TinyOS directory structure.
      1. Try running Viptos:
        $PTII/bin/vergil -viptos
      2. Create a new PtinyOS Graph Editor from the File | New menu.
      3. Click in the left hand pane under Actors to see the newly generated directory structure.
  5. If the last step above did not work, then you probably did not install the required tools correctly, or you have version conflicts with pre-existing tools (e.g., gcc) on your system. Try reinstalling the required tools from the RPM's or compiling them from scratch using your pre-existing toolset.