Difference between revisions of "NESCDT"
Line 1: | Line 1: | ||
+ | This is a short description of how to ''use'' and ''develop'' the ''nescdt'' plugin. | ||
+ | |||
==Using the ''nescdt'' TinyOS plugin for Eclipse== | ==Using the ''nescdt'' TinyOS plugin for Eclipse== | ||
A basic [http://nescc.sourceforge.net/papers/nesc-ref.pdf '''nesC'''] editor plugin for TinyOS-2.x using Eclipse with syntax highlighting and ''.nc'' file content detection for the follow types: | A basic [http://nescc.sourceforge.net/papers/nesc-ref.pdf '''nesC'''] editor plugin for TinyOS-2.x using Eclipse with syntax highlighting and ''.nc'' file content detection for the follow types: | ||
Line 7: | Line 9: | ||
* ''generic configuration'' [[Image:Genconf.gif]] | * ''generic configuration'' [[Image:Genconf.gif]] | ||
* ''safe'' [[Image:Safe.gif]](experimental). | * ''safe'' [[Image:Safe.gif]](experimental). | ||
+ | |||
+ | ===Downloading=== | ||
The same symbols are used as in [[Getting_Started_with_TinyOS#Visualizing_a_Component_Graph| nesdoc]]. The source is included in the plugin jar file, and it is possible to refine it. To install the plugin: | The same symbols are used as in [[Getting_Started_with_TinyOS#Visualizing_a_Component_Graph| nesdoc]]. The source is included in the plugin jar file, and it is possible to refine it. To install the plugin: | ||
* Download the ''nescdt_0.0.12.jar'' file [[http://nxtmote.sf.net/nescdt_0.0.12.jar here]] | * Download the ''nescdt_0.0.12.jar'' file [[http://nxtmote.sf.net/nescdt_0.0.12.jar here]] | ||
Line 30: | Line 34: | ||
[[Image:Nxtmote-keywordcompletion2.png]] | [[Image:Nxtmote-keywordcompletion2.png]] | ||
− | + | === Side notes === | |
**The ''nescdt'' plugin is < 50 kB | **The ''nescdt'' plugin is < 50 kB | ||
**(Experimental) If it detects ''safe'' code (looking for ''@safe'', ''*COUNT'', ''*SIZE'', or ''*SAFE'') a rhombus shape is added to the icon. A ''safe'' module could look like this [[Image:Nxtmote-safedemo.png]] in the file navigator (note that a little rhombus has been added to the module icon). | **(Experimental) If it detects ''safe'' code (looking for ''@safe'', ''*COUNT'', ''*SIZE'', or ''*SAFE'') a rhombus shape is added to the icon. A ''safe'' module could look like this [[Image:Nxtmote-safedemo.png]] in the file navigator (note that a little rhombus has been added to the module icon). | ||
Line 40: | Line 44: | ||
To develop, customize, or debug the ''nescdt'' plugin, you can follow the guide below. In a best-case scenario it would be completed in 15 min. | To develop, customize, or debug the ''nescdt'' plugin, you can follow the guide below. In a best-case scenario it would be completed in 15 min. | ||
+ | |||
+ | ===Importing=== | ||
Here we start with a blank Eclipse. You can get a new workspace (if you want to) by creating a shortcut and starting Eclipse with a command line similar to this: | Here we start with a blank Eclipse. You can get a new workspace (if you want to) by creating a shortcut and starting Eclipse with a command line similar to this: | ||
C:\eclipse\eclipse.exe -data -consolelog C:\Dokumenter\eclipse\workspace-plugin | C:\eclipse\eclipse.exe -data -consolelog C:\Dokumenter\eclipse\workspace-plugin | ||
The '''consolelog''' makes it possible to see '''System.out.println''' from the plugin itself (it is cheating, but useful during development). | The '''consolelog''' makes it possible to see '''System.out.println''' from the plugin itself (it is cheating, but useful during development). | ||
+ | |||
[[Image:1-Dev-Blank-Eclipse.png]] | [[Image:1-Dev-Blank-Eclipse.png]] | ||
Line 61: | Line 68: | ||
[[Image:5-Dev-select.png]] | [[Image:5-Dev-select.png]] | ||
+ | |||
+ | ===Debugging=== | ||
To show how easy it is to change it, look at the following example. It is code that splits the contents of a ''.nc'' file into string tokens: | To show how easy it is to change it, look at the following example. It is code that splits the contents of a ''.nc'' file into string tokens: | ||
Line 81: | Line 90: | ||
[[Image:8-Dev-src-build.png]] | [[Image:8-Dev-src-build.png]] | ||
+ | ===Exporting=== | ||
Then export the plugin to the ECLIPSEHOME/plugin directory (it will run next time Eclipse is restarted). It is best to delete the old plugin file (such as ''nescdt_0.0.12.jar'') and change the increment the version nuymber of the new plugin : | Then export the plugin to the ECLIPSEHOME/plugin directory (it will run next time Eclipse is restarted). It is best to delete the old plugin file (such as ''nescdt_0.0.12.jar'') and change the increment the version nuymber of the new plugin : | ||
Revision as of 02:43, 19 June 2008
This is a short description of how to use and develop the nescdt plugin.
Contents
Using the nescdt TinyOS plugin for Eclipse
A basic nesC editor plugin for TinyOS-2.x using Eclipse with syntax highlighting and .nc file content detection for the follow types:
Downloading
The same symbols are used as in nesdoc. The source is included in the plugin jar file, and it is possible to refine it. To install the plugin:
- Download the nescdt_0.0.12.jar file [here]
- Save it in the root of Eclipse plugin directory (where the other (jar) plugins also reside), and delete the previous version of this plugin if you have it. The sources are included if you want to compile it yourself...
- Restart Eclipse (perhaps verify for yourself that it is installed: Help->About Eclipse SDK->Plug-in Details)
- Associate the *.nc files with this editor: Windows->Preferences->General->Editors->File Associations
- Create a new empty project and name it what you want to (for example nescsampleproject)
- Create a new folder in the project (right-click on the project) and name it what you want to
- Import and link to the part of the TinyOS tree or your own code(right-click on the nescsampleproject folder and press import)
- Choose the Link to folder in the file system option and proceed (this will not change your TinyOS code at all and it will not copy any files on your computer)
- When you are done the Eclipse IDE could look something like this (note that the content of the files have been analyzed and that the icons reveal that we have some configurations, generic configurations, modules, and generic modules in the mica2 folder):
- When you open some .nc file it will be syntax colored (according some some predefined rules in the plugin):
- There is autocompletion for keywords and types. Press CTRL + SPACE to get the suggestions
Then select (if there is more than one choice) and press ENTER to insert the word
Side notes
- The nescdt plugin is < 50 kB
- (Experimental) If it detects safe code (looking for @safe, *COUNT, *SIZE, or *SAFE) a rhombus shape is added to the icon. A safe module could look like this in the file navigator (note that a little rhombus has been added to the module icon).
- If the CVS decorators annoy you (if, for example, another CVS client than Eclipse is being used), then turn them off from Window->Preferences->General->Appearance->Label Decorations.
- You can also consider downloading the CDT plugin for editing header files and perhaps C files in Eclipse. Enter the http://download.eclipse.org/tools/cdt/releases/europa as a new Remote site in the Eclipse update manager and choose the CDT main plugin:
Developing/Debugging on the NESCDT Plugin
To develop, customize, or debug the nescdt plugin, you can follow the guide below. In a best-case scenario it would be completed in 15 min.
Importing
Here we start with a blank Eclipse. You can get a new workspace (if you want to) by creating a shortcut and starting Eclipse with a command line similar to this:
C:\eclipse\eclipse.exe -data -consolelog C:\Dokumenter\eclipse\workspace-plugin
The consolelog makes it possible to see System.out.println from the plugin itself (it is cheating, but useful during development).
Assuming that you have downloaded the plugin (see start of this wiki page) it is now the time to import it into Eclipse for development. Press Import:
Select Plug-ins and Fragments:
Important: Choose Projects with source folders:
Select the nescdt plugin in the version you happen to have:
Debugging
To show how easy it is to change it, look at the following example. It is code that splits the contents of a .nc file into string tokens:
Try to place a breakpoint by double-clicking on the bar to the left of the code that you want to inspect. Then click on the meny to debug an Eclipse Application. It is a second Eclipse instance that will be launched running the imported version of the plugin (not the plugin you downloaded into the ECLIPSEHOME/plugin folder):
It will then look like this when you have the two instances of Eclipse running:
To create a new version of the plugin please double click on the plugin.xml file in the project. Then select the Export Wizard:
Check the src folder for export when doing a binary build (so you export the source code with the plugin and makes it possible for others to do what you are doing now):
Exporting
Then export the plugin to the ECLIPSEHOME/plugin directory (it will run next time Eclipse is restarted). It is best to delete the old plugin file (such as nescdt_0.0.12.jar) and change the increment the version nuymber of the new plugin :
Finally verify that the plugin jar file is in the plugin directory as expected:
You can send me an e-mail: rup.inf@cbs.dk