Sun Microsystems V2.0 manual Configuring NetBeans as a debug client

Page 45

Using non-default channel or pan id

It is not possible for an application being debugged to select dynamically a different channel or pan id. Instead the required channel or pan id must be selected using manifest properties (see section Using manifest properties to adjust the radio). Then the required channel or pan id can be specified like this:

ant debug -DremoteId=spot1 -Dremote.channel=11 –Dremote.pan.id=99

Unexpected exceptions

Some code which runs correctly in a standalone application will cause an exception when running under the debugger. To aid debugging, we recommend that you always set a breakpoint on SpotFatalException so that you can at least see when a conflict occurs. Instructions for doing this with some IDEs are shown below.

Conflicts will occur for applications that:

Interact directly with the MAC or PHY layers of the radio stack. Applications that use the radio via the radiostream: and radiogram: protocols should work correctly under the debugger.

Interact directly with the hardware. For example, applications that manipulate IO pins directly and applications that manipulate the LEDs on the front of the Sun SPOT processor board (applications that manipulate the LEDs on the demo sensor board should work correctly under the debugger).

Configuring NetBeans as a debug client

Select the “Run” menu item and the sub-item “Attach Debugger…” Enter 2900 as the port number and 5000ms as the timeout. The connector field should be set to “socket attach”.

We recommend that you set a breakpoint for SpotFatalException (see section Unexpected exceptions for more information). To do this, select “Run…”, then “New Breakpoint…”. In the dialog, set the breakpoint type to be “Exception, the package to be com.sun.spot.peripheral and

the class name to be SpotFatalException.

Configuring Eclipse as a debug client

From the “Run” menu select the “Debug…” option. Create a new “Remote Java Application” configuration and set the port number to 2900, with the “Standard (socket attach)” connection type.

We recommend that you set a breakpoint for SpotFatalException (see section Unexpected exceptions for more information). To do this, select “Run…” and then “Add Java Exception Breakpoint…” and then select SpotFatalException.

Finally, it will improve the debugging experience if you associate source code with the various Sun SPOT SDK jar files. To do this, select your Eclipse project, then from the right button menu select “Properties…”. Select the “Java Build Path” on the left of the Properties dialog and then “Libraries” tab on the right. If you haven’t already done so, add the five key jar files here:

SDK_INSTALL_DIRECTORY/lib/transducerlib_rt.jar

SDK_INSTALL_DIRECTORY/lib/multihoplib_rt.jar

SDK_INSTALL_DIRECTORY/lib/spotlib_device.jar

SDK_INSTALL_DIRECTORY/lib/spotlib_common.jar

SDK_INSTALL_DIRECTORY/lib/squawk_rt.jar

45

Image 45
Contents Page Page Contents Http protocol support Introduction Deploying and running a sample application Building and deploying Sun Spot applicationsBuild Successful Total time 3 seconds \MyApplication Ant -Dport=COM2 info Total time 4 seconds \MyApplication Total time 0 seconds \MyApplication Incorporating utility classes into your application Deploying a pre-existing jarManifest and resources Excluding files from the compilationOther user properties Using the Basestation Built-in propertiesOverview Set up Base Station configuration Remote operationIntroduction Connect a Sun Spot base station Managing keys and sharing Sun SPOTs Using short names for SPOTsTake suitable actions during over-the-air downloads BackgroundSharing Sun SPOTs Changing the owner of a Sun SpotDeploying and running a host application What is protected?Generating a new key-pair LimitationsYour own host application Configuring network featuresIncorporating pre-existing jars into your host application Mesh routingHardware configurations and USB power Trace routeLogging Page Overview of an application ThreadsThread priorities Sun Spot device libraries Sun Spot device libraryDevice Interface Persistent properties Overriding the Ieee address Accessing flash memoryUsart Radio communication library Program Radiogram protocol Server end Client endYou can open server radiogram connections in a similar way Broadcasting Radio properties Turning the receiver off and on Conserving power using deep sleep mode Monitoring radio activityShallow Sleep Deep Sleep Activating deep sleep modePreconditions for deep sleeping USB inhibits deep sleepDeep sleep behaviour of the standard drivers Device Condition to permit deep sleepWriting a device driver Http protocol support Configuring the http protocol Socket Proxy GUI mode Configuring projects in an IDEClasspath configuration Javadoc/source configurationDebugging Ant selectapplication Configuring Eclipse as a debug client Configuring NetBeans as a debug clientAdvanced topics Using library suitesWith adderlib as your current directory, execute the command Use the command Using the spot client SpotSerialPortException other exception in serial port comms Reference Persistent system propertiesProperty name Meaning Contents of the lib directory Contents of the arm directoryMemory usage Start address Space UseContents of the bin directory preverify.exe Contents of the tests directory Contents of the upgrade directory