Ptolemy II PtinyOS Domain Developer Notes

If you use Eclipse to run Viptos or develop PtinyOS Domain related code, you should follow the instructions below for setting up Eclipse properly.

Quick links:
Setting up Eclipse to run Viptos
Setting up Eclipse to work with nesC
Setting up Eclipse to run nc2moml or ncapp2moml

Setting up Eclipse to run Viptos

These instructions assume you already having Eclipse working with vergil (ptII). You should omit the quote symbols (") when entering values in Eclipse. These instructions were tested on Eclipse 3.1.
  1. Click on Run | Run... in the menu.
  2. Click on New
  3. Change Name from "New_configuration" to "viptos"
  4. In the Main tab,
  5. In the Arguments tab, under Program arguments, enter "-viptos".
  6. In the Classpath tab, click on ptII (default classpath)
  7. Click on Advanced
  8. Click on Add Folders
  9. Select ptII | vendors | ptinyos | moml
  10. Click on OK
  11. You should now see an entry for moml under User Entries
  12. Click on Apply in the Run window
  13. Click on Run to run Viptos

Setting up Eclipse to work with nesC

If you are editing nc2moml files (in $PTII/ptolemy/domains/ptinyos/util/nc2moml) or ncapp2moml files (in $PTII/ptolemy/domains/ptinyos/util/ncapp2moml), then you will probably want to set up Eclipse to work with nesC, especially if you need to edit any Java files that come with the nesC distribution.

These instructions assume that you have checked out nesc from sourceforge by doing the following:

cd $PTII/vendors/ptinyos
export CVS_RSH=ssh 
cvs -z3 -d:ext:developername@nescc.cvs.sourceforge.net:/cvsroot/nescc co -P nesc
Warning: The $PTII/vendors/.cvsignore file is designed to avoid a problem in Eclipse, whereby it will delete all of the subdirectories named CVS in any external CVS repositories that are stored in $PTII/vendors. The $PTII/vendors/.cvsignore file contains a line with ptinyos so that CVS (for ptII) will ignore all files in this directory.

For example, I have symbolic links in $PTII/vendors/ptinyos that point to my checked-out copies of the nesc and tinyos-1.x CVS repositories. Without the .cvsignore file, running Eclipse 3.0 with version control (using CVS from Eclipse) will cause it to occasionally delete all the CVS subdirectories in nesc and tinyos-1.x.

(If you have Eclipse 3.0, see Eclipse 3.0 instructions).

Instructions for Eclipse 3.1

These instructions assume you already having Eclipse working with vergil (ptII). You should omit the quote symbols (") when entering values in Eclipse.
  1. File | New | Project...
  2. Select a wizard: Java Project
    Click Next.
  3. Project name: nesc

    Select: Create project at external location
    Directory: /home/celaine/ptII/vendors/ptinyos/nesc

    Project layout: Use project folder as root for sources and class files

    Click Next

  4. Java Settings | Source Tab:
    Make sure "Allow output folders for source folders" is checked.
    Open nesc/tools/java
    Select "Output folder" and "Configure Output Folder Properties"
    Source Folder Output Location: select "Specific output folder": tools/java
    Output folder should now be nesc/tools/java
    Click Finish
  5. Window | Show View | Navigator
    Right click on nesc project in Navigator pane on left hand side
    Build Project
  6. Class files should appear in nesc/tools/java/...
  7. Jump to instructions below on Setting up Eclipse to run nc2moml or ncapp2moml.

Instructions for Eclipse 3.0

These instructions assume you already having Eclipse working with vergil (ptII). You should omit the quote symbols (") when entering values in Eclipse.
  1. File | New | Project...
  2. Select a wizard: Java Project
    Click Next.
  3. Project name: nesc

    Select: Create project at external location
    Directory: /home/celaine/ptII/vendors/ptinyos/nesc

    Project layout: Use project folder as root for sources and class files

    Click Next

  4. Java Settings | Source Tab:
    Make sure "Allow output folders for source folders" is checked.
    Open nesc/tools/java
    Select "Output folder" and Edit...
    Source Folder Output Location: select "Specific output folder": tools/java
    Output folder should now be nesc/tools/java
    Click Finish
  5. Window | Show View | Navigator
    Right click on nesc project in Navigator pane on left hand side
    Build Project
  6. Class files should appear in nesc/tools/java/...

Setting up Eclipse to run nc2moml or ncapp2moml

First follow the instructions above for Setting up Eclipse to run Viptos. To run or debug the java applications found in $PTII/ptolemy/domains/ptinyos/util under Eclipse, you must pass the following VM arguments in the Run menu:
  -Dorg.xml.sax.driver=org.apache.crimson.parser.XMLReaderImpl
You may substitute a different parser if desired. See the SAX2 Driver information at http://www.saxproject.org/quickstart.html