com.sun.spot.suiteconverter
Class Suite
java.lang.Object
com.sun.spot.suiteconverter.Suite
public class Suite
- extends Object
Suite allows suite files to be saved in a form that can execute directly from SPOT flash memory.
Squawk suites are normally saved in "canonical" form, where the base address of the bootstrap suite is assumed
to be 0, the base address of child suites to be directly above the last word of the bootstrap suite, and so on
for grandchildren. The suites also containg an OOP map that identifies which words are actually pointers. On the
desktop, when a suite is loaded into memory, its pointers can then be remapped according to the actual address
at which it finds itself, its parent, grandparent, and so on.
On the SPOT, this remapping can't happen, as the suites are in flash memory. So instead, we remap them on the host
before downloading to the device. This relies on the suites living at known addresses in SPOT virtual memory.
Constructor Summary |
Suite()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
EXPECTED_SUITE_VERSION_MAJOR
public static final short EXPECTED_SUITE_VERSION_MAJOR
- See Also:
- Constant Field Values
EXPECTED_SUITE_VERSION_MINOR
public static final short EXPECTED_SUITE_VERSION_MINOR
- See Also:
- Constant Field Values
Suite
public Suite()
loadFromStream
public void loadFromStream(DataInputStream dis,
String bootstrapFilename,
int[] memoryAddrs)
throws IOException
- Load a suite file from a
DataInputStream
. See also loadFromFile(String, String, int[])
- Parameters:
dis
- The DataInputStream
to read the suite frombootstrapFilename
- A filepath to read the bootstrap suite from (note that this is NOT typically
this suite's parent.memoryAddrs
- An array of virtual memory addresses at which to assume suites will be mapped on the SPOT
device. The first will be this suite's address, the second its parent, and so on until the the bootstrap address.
- Throws:
IOException
writeToStreamRelocated
public void writeToStreamRelocated(DataOutputStream dos,
int[] memoryAddrs)
throws IOException
- Throws:
IOException
getHash
public int getHash()
- Returns:
- The calculated hash of this Suite.
getParent
public Suite getParent()
- Returns:
- The loaded parent suite of this Suite
- Throws:
IOException
loadFromFile
public void loadFromFile(String filename,
String bootstrapFilename,
int[] memoryAddrs)
throws IOException
- Load a suite file from a
File
. See also loadFromStream(DataInputStream, String, int[])
- Parameters:
filename
- The filepath to read the suite frombootstrapFilename
- A filepath to read the bootstrap suite from (note that this is NOT typically
this suite's parent.memoryAddrs
- An array of virtual memory addresses at which to assume suites will be mapped on the SPOT
device. The first will be this suite's address, the second its parent, and so on until the the bootstrap address.
- Throws:
IOException
Copyright © 2006, 2007 Sun Microsystems, Inc. All Rights Reserved.