mirror of
https://github.com/oliverschmidt/contiki.git
synced 2024-12-23 16:29:34 +00:00
using external tools regular expressions
This commit is contained in:
parent
08d42b2251
commit
919a35801d
@ -26,7 +26,7 @@
|
|||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: ContikiMoteType.java,v 1.17 2007/07/11 15:22:22 fros4943 Exp $
|
* $Id: ContikiMoteType.java,v 1.18 2007/09/10 13:26:54 fros4943 Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package se.sics.cooja.contikimote;
|
package se.sics.cooja.contikimote;
|
||||||
@ -92,69 +92,73 @@ public class ContikiMoteType implements MoteType {
|
|||||||
* Communication stacks in Contiki.
|
* Communication stacks in Contiki.
|
||||||
*/
|
*/
|
||||||
public enum CommunicationStack {
|
public enum CommunicationStack {
|
||||||
UIP,
|
UIP, UIP_UAODV, RIME;
|
||||||
UIP_UAODV,
|
|
||||||
RIME;
|
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
if (this == UIP)
|
if (this == UIP) {
|
||||||
return "uIP";
|
return "uIP";
|
||||||
if (this == UIP_UAODV)
|
}
|
||||||
|
if (this == UIP_UAODV) {
|
||||||
return "uIP over uAODV";
|
return "uIP over uAODV";
|
||||||
if (this == RIME)
|
}
|
||||||
|
if (this == RIME) {
|
||||||
return "Rime";
|
return "Rime";
|
||||||
|
}
|
||||||
return "[unknown]";
|
return "[unknown]";
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSourceFilenamesString() {
|
public String getSourceFilenamesString() {
|
||||||
if (this == UIP)
|
if (this == UIP) {
|
||||||
return " cooja-radio.c radio-uip.c init-net-uip.c";
|
return " cooja-radio.c radio-uip.c init-net-uip.c";
|
||||||
if (this == UIP_UAODV)
|
}
|
||||||
|
if (this == UIP_UAODV) {
|
||||||
return " cooja-radio.c radio-uip-uaodv.c init-net-uip-uaodv.c crc16.c";
|
return " cooja-radio.c radio-uip-uaodv.c init-net-uip-uaodv.c crc16.c";
|
||||||
if (this == RIME)
|
}
|
||||||
|
if (this == RIME) {
|
||||||
return " cooja-radio.c init-net-rime.c";
|
return " cooja-radio.c init-net-rime.c";
|
||||||
|
}
|
||||||
return " ";
|
return " ";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CommunicationStack parse(String name) {
|
public static CommunicationStack parse(String name) {
|
||||||
if (name.equals("uIP") || name.equals("UIP"))
|
if (name.equals("uIP") || name.equals("UIP")) {
|
||||||
return UIP;
|
return UIP;
|
||||||
if (name.equals("uIP over uAODV") || name.equals("UIP_UAODV"))
|
}
|
||||||
|
if (name.equals("uIP over uAODV") || name.equals("UIP_UAODV")) {
|
||||||
return UIP_UAODV;
|
return UIP_UAODV;
|
||||||
if (name.equals("Rime") || name.equals("RIME"))
|
}
|
||||||
|
if (name.equals("Rime") || name.equals("RIME")) {
|
||||||
return RIME;
|
return RIME;
|
||||||
|
}
|
||||||
|
|
||||||
logger.warn("Can't parse communication stack name: " + name);
|
logger.warn("Can't parse communication stack name: " + name);
|
||||||
return UIP;
|
return UIP;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Regular expressions for parsing the map file
|
|
||||||
final static private String bssSectionAddrRegExp = "^.bss[ \t]*0x([0-9A-Fa-f]*)[ \t]*0x[0-9A-Fa-f]*[ \t]*$";
|
|
||||||
final static private String bssSectionSizeRegExp = "^.bss[ \t]*0x[0-9A-Fa-f]*[ \t]*0x([0-9A-Fa-f]*)[ \t]*$";
|
|
||||||
final static private String dataSectionAddrRegExp = "^.data[ \t]*0x([0-9A-Fa-f]*)[ \t]*0x[0-9A-Fa-f]*[ \t]*$";
|
|
||||||
final static private String dataSectionSizeRegExp = "^.data[ \t]*0x[0-9A-Fa-f]*[ \t]*0x([0-9A-Fa-f]*)[ \t]*$";
|
|
||||||
final static private String varAddressRegExpPrefix = "^[ \t]*0x([0-9A-Fa-f]*)[ \t]*";
|
|
||||||
final static private String varAddressRegExpSuffix = "[ \t]*$";
|
|
||||||
final static private String varNameRegExp = "^[ \t]*(0x[0-9A-Fa-f]*)[ \t]*([^ ]*)[ \t]*$";
|
|
||||||
final static private String varSizeRegExpPrefix = "^";
|
|
||||||
final static private String varSizeRegExpSuffix = "[ \t]*(0x[0-9A-Fa-f]*)[ \t]*[^ ]*[ \t]*$";
|
|
||||||
|
|
||||||
// Regular expressions for parsing nm response
|
|
||||||
final static private String nmRegExp = "^([0-9A-Fa-f][0-9A-Fa-f]*)[ \t][^Tt][ \t]([^ ._][^ ]*)";
|
|
||||||
|
|
||||||
// Mote type specific data
|
// Mote type specific data
|
||||||
private String identifier = null;
|
private String identifier = null;
|
||||||
|
|
||||||
private String description = null;
|
private String description = null;
|
||||||
|
|
||||||
private String contikiBaseDir = null;
|
private String contikiBaseDir = null;
|
||||||
|
|
||||||
private String contikiCoreDir = null;
|
private String contikiCoreDir = null;
|
||||||
|
|
||||||
private Vector<File> projectDirs = null;
|
private Vector<File> projectDirs = null;
|
||||||
|
|
||||||
private Vector<File> compilationFiles = null;
|
private Vector<File> compilationFiles = null;
|
||||||
|
|
||||||
private Vector<String> processes = null;
|
private Vector<String> processes = null;
|
||||||
|
|
||||||
private Vector<String> sensors = null;
|
private Vector<String> sensors = null;
|
||||||
|
|
||||||
private Vector<String> coreInterfaces = null;
|
private Vector<String> coreInterfaces = null;
|
||||||
|
|
||||||
private Vector<Class<? extends MoteInterface>> moteInterfaces = null;
|
private Vector<Class<? extends MoteInterface>> moteInterfaces = null;
|
||||||
|
|
||||||
private boolean hasSystemSymbols = false;
|
private boolean hasSystemSymbols = false;
|
||||||
|
|
||||||
private CommunicationStack commStack = CommunicationStack.UIP;
|
private CommunicationStack commStack = CommunicationStack.UIP;
|
||||||
|
|
||||||
// Simulation holding this mote type
|
// Simulation holding this mote type
|
||||||
@ -165,7 +169,9 @@ public class ContikiMoteType implements MoteType {
|
|||||||
|
|
||||||
// Core communication variables
|
// Core communication variables
|
||||||
private String libraryClassName = null;
|
private String libraryClassName = null;
|
||||||
|
|
||||||
private int offsetRelToAbs = 0;
|
private int offsetRelToAbs = 0;
|
||||||
|
|
||||||
private CoreComm myCoreComm = null;
|
private CoreComm myCoreComm = null;
|
||||||
|
|
||||||
// Variable name to address mappings
|
// Variable name to address mappings
|
||||||
@ -198,65 +204,75 @@ public class ContikiMoteType implements MoteType {
|
|||||||
return new ContikiMote(this, simulation);
|
return new ContikiMote(this, simulation);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean configureAndInit(JFrame parentFrame, Simulation simulation, boolean visAvailable)
|
public boolean configureAndInit(JFrame parentFrame, Simulation simulation,
|
||||||
throws MoteTypeCreationException {
|
boolean visAvailable) throws MoteTypeCreationException {
|
||||||
if (visAvailable) {
|
if (visAvailable) {
|
||||||
return ContikiMoteTypeDialog.showDialog(parentFrame, simulation, this);
|
return ContikiMoteTypeDialog.showDialog(parentFrame, simulation, this);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// Create temp output directory if not already exists
|
// Create temp output directory if not already exists
|
||||||
if (!ContikiMoteType.tempOutputDirectory.exists())
|
|
||||||
ContikiMoteType.tempOutputDirectory.mkdir();
|
|
||||||
if (!ContikiMoteType.tempOutputDirectory.exists()) {
|
if (!ContikiMoteType.tempOutputDirectory.exists()) {
|
||||||
throw new MoteTypeCreationException("Could not create output directory: " + ContikiMoteType.tempOutputDirectory);
|
ContikiMoteType.tempOutputDirectory.mkdir();
|
||||||
|
}
|
||||||
|
if (!ContikiMoteType.tempOutputDirectory.exists()) {
|
||||||
|
throw new MoteTypeCreationException(
|
||||||
|
"Could not create output directory: "
|
||||||
|
+ ContikiMoteType.tempOutputDirectory);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete output files
|
// Delete output files
|
||||||
File libFile = new File(ContikiMoteType.tempOutputDirectory,
|
File libFile = new File(ContikiMoteType.tempOutputDirectory, identifier
|
||||||
identifier + ContikiMoteType.librarySuffix);
|
+ ContikiMoteType.librarySuffix);
|
||||||
File mapFile = new File(ContikiMoteType.tempOutputDirectory,
|
File mapFile = new File(ContikiMoteType.tempOutputDirectory, identifier
|
||||||
identifier + ContikiMoteType.mapSuffix);
|
+ ContikiMoteType.mapSuffix);
|
||||||
File depFile = new File(ContikiMoteType.tempOutputDirectory,
|
File depFile = new File(ContikiMoteType.tempOutputDirectory, identifier
|
||||||
identifier + ContikiMoteType.dependSuffix);
|
+ ContikiMoteType.dependSuffix);
|
||||||
if (libFile.exists())
|
|
||||||
libFile.delete();
|
|
||||||
if (depFile.exists())
|
|
||||||
depFile.delete();
|
|
||||||
if (mapFile.exists())
|
|
||||||
mapFile.delete();
|
|
||||||
if (libFile.exists()) {
|
if (libFile.exists()) {
|
||||||
throw new MoteTypeCreationException("Could not delete output file: " + libFile);
|
libFile.delete();
|
||||||
}
|
}
|
||||||
if (depFile.exists()) {
|
if (depFile.exists()) {
|
||||||
throw new MoteTypeCreationException("Could not delete output file: " + depFile);
|
depFile.delete();
|
||||||
}
|
}
|
||||||
if (mapFile.exists()) {
|
if (mapFile.exists()) {
|
||||||
throw new MoteTypeCreationException("Could not delete output file: " + mapFile);
|
mapFile.delete();
|
||||||
|
}
|
||||||
|
if (libFile.exists()) {
|
||||||
|
throw new MoteTypeCreationException("Could not delete output file: "
|
||||||
|
+ libFile);
|
||||||
|
}
|
||||||
|
if (depFile.exists()) {
|
||||||
|
throw new MoteTypeCreationException("Could not delete output file: "
|
||||||
|
+ depFile);
|
||||||
|
}
|
||||||
|
if (mapFile.exists()) {
|
||||||
|
throw new MoteTypeCreationException("Could not delete output file: "
|
||||||
|
+ mapFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate Contiki main source file
|
// Generate Contiki main source file
|
||||||
try {
|
try {
|
||||||
ContikiMoteTypeDialog.generateSourceFile(identifier, sensors, coreInterfaces, processes);
|
ContikiMoteTypeDialog.generateSourceFile(identifier, sensors,
|
||||||
|
coreInterfaces, processes);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw (MoteTypeCreationException) new MoteTypeCreationException(
|
throw (MoteTypeCreationException) new MoteTypeCreationException(
|
||||||
"Error during main source file generation: " + e.getMessage()).initCause(e);
|
"Error during main source file generation: " + e.getMessage())
|
||||||
|
.initCause(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compile library
|
// Compile library
|
||||||
MessageList taskOutput = new MessageList();
|
MessageList taskOutput = new MessageList();
|
||||||
boolean compilationSucceded = ContikiMoteTypeDialog.compileLibrary(
|
boolean compilationSucceded = ContikiMoteTypeDialog.compileLibrary(
|
||||||
identifier,
|
identifier, new File(contikiBaseDir), compilationFiles,
|
||||||
new File(contikiBaseDir),
|
hasSystemSymbols, commStack, taskOutput
|
||||||
compilationFiles,
|
.getInputStream(MessageList.NORMAL), taskOutput
|
||||||
hasSystemSymbols,
|
.getInputStream(MessageList.ERROR));
|
||||||
commStack,
|
if (!libFile.exists() || !depFile.exists() || !mapFile.exists()) {
|
||||||
taskOutput.getInputStream(MessageList.NORMAL),
|
|
||||||
taskOutput.getInputStream(MessageList.ERROR));
|
|
||||||
if (!libFile.exists() || !depFile.exists() || !mapFile.exists())
|
|
||||||
compilationSucceded = false;
|
compilationSucceded = false;
|
||||||
|
}
|
||||||
|
|
||||||
if (!compilationSucceded) {
|
if (!compilationSucceded) {
|
||||||
MoteTypeCreationException ex = new MoteTypeCreationException("Compilation error");
|
MoteTypeCreationException ex = new MoteTypeCreationException(
|
||||||
|
"Compilation error");
|
||||||
ex.setCompilationOutput(taskOutput);
|
ex.setCompilationOutput(taskOutput);
|
||||||
throw ex;
|
throw ex;
|
||||||
}
|
}
|
||||||
@ -286,22 +302,25 @@ public class ContikiMoteType implements MoteType {
|
|||||||
this.identifier = identifier;
|
this.identifier = identifier;
|
||||||
|
|
||||||
if (myCoreComm != null) {
|
if (myCoreComm != null) {
|
||||||
throw new MoteTypeCreationException("Core communicator already used: " + myCoreComm.getClass().getName());
|
throw new MoteTypeCreationException("Core communicator already used: "
|
||||||
|
+ myCoreComm.getClass().getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
File libFile = new File(ContikiMoteType.tempOutputDirectory,
|
File libFile = new File(ContikiMoteType.tempOutputDirectory, identifier
|
||||||
identifier + librarySuffix);
|
+ librarySuffix);
|
||||||
File mapFile = new File(ContikiMoteType.tempOutputDirectory,
|
File mapFile = new File(ContikiMoteType.tempOutputDirectory, identifier
|
||||||
identifier + mapSuffix);
|
+ mapSuffix);
|
||||||
|
|
||||||
// Check that library file exists
|
// Check that library file exists
|
||||||
if (!libFile.exists()) {
|
if (!libFile.exists()) {
|
||||||
throw new MoteTypeCreationException("Library file could not be found: " + libFile);
|
throw new MoteTypeCreationException("Library file could not be found: "
|
||||||
|
+ libFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check that map file exists
|
// Check that map file exists
|
||||||
if (!mapFile.exists()) {
|
if (!mapFile.exists()) {
|
||||||
throw new MoteTypeCreationException("Map file could not be found: " + mapFile);
|
throw new MoteTypeCreationException("Map file could not be found: "
|
||||||
|
+ mapFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allocate core communicator class
|
// Allocate core communicator class
|
||||||
@ -319,13 +338,15 @@ public class ContikiMoteType implements MoteType {
|
|||||||
if (mapFileData == null || !parseMapFileData(mapFileData, varAddresses)) {
|
if (mapFileData == null || !parseMapFileData(mapFileData, varAddresses)) {
|
||||||
logger.fatal("Map file parsing failed");
|
logger.fatal("Map file parsing failed");
|
||||||
}
|
}
|
||||||
logger.info("Testing experimental nm response parsing for finding variable addresses");
|
logger
|
||||||
|
.info("Testing experimental nm response parsing for finding variable addresses");
|
||||||
if (nmData == null || !parseNmData(nmData, varAddresses)) {
|
if (nmData == null || !parseNmData(nmData, varAddresses)) {
|
||||||
logger.fatal("Nm response parsing failed");
|
logger.fatal("Nm response parsing failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (varAddresses.size() == 0) {
|
if (varAddresses.size() == 0) {
|
||||||
throw new MoteTypeCreationException("Variable name to addresses mappings could not be created");
|
throw new MoteTypeCreationException(
|
||||||
|
"Variable name to addresses mappings could not be created");
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -345,16 +366,17 @@ public class ContikiMoteType implements MoteType {
|
|||||||
|
|
||||||
if (relDataSectionAddr <= 0 || dataSectionSize <= 0
|
if (relDataSectionAddr <= 0 || dataSectionSize <= 0
|
||||||
|| relBssSectionAddr <= 0 || bssSectionSize <= 0) {
|
|| relBssSectionAddr <= 0 || bssSectionSize <= 0) {
|
||||||
throw new MoteTypeCreationException("Could not parse section addresses correctly");
|
throw new MoteTypeCreationException(
|
||||||
|
"Could not parse section addresses correctly");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create initial memory
|
// Create initial memory
|
||||||
byte[] initialDataSection = new byte[dataSectionSize];
|
byte[] initialDataSection = new byte[dataSectionSize];
|
||||||
getCoreMemory(relDataSectionAddr
|
getCoreMemory(relDataSectionAddr + offsetRelToAbs, dataSectionSize,
|
||||||
+ offsetRelToAbs, dataSectionSize, initialDataSection);
|
initialDataSection);
|
||||||
byte[] initialBssSection = new byte[bssSectionSize];
|
byte[] initialBssSection = new byte[bssSectionSize];
|
||||||
getCoreMemory(
|
getCoreMemory(relBssSectionAddr + offsetRelToAbs, bssSectionSize,
|
||||||
relBssSectionAddr + offsetRelToAbs, bssSectionSize, initialBssSection);
|
initialBssSection);
|
||||||
initialMemory = new SectionMoteMemory(varAddresses);
|
initialMemory = new SectionMoteMemory(varAddresses);
|
||||||
initialMemory.setMemorySegment(relDataSectionAddr, initialDataSection);
|
initialMemory.setMemorySegment(relDataSectionAddr, initialDataSection);
|
||||||
initialMemory.setMemorySegment(relBssSectionAddr, initialBssSection);
|
initialMemory.setMemorySegment(relBssSectionAddr, initialBssSection);
|
||||||
@ -402,19 +424,22 @@ public class ContikiMoteType implements MoteType {
|
|||||||
* @param varAddresses
|
* @param varAddresses
|
||||||
* Properties that should contain the name to addresses mappings.
|
* Properties that should contain the name to addresses mappings.
|
||||||
*/
|
*/
|
||||||
private boolean parseMapFileData(Vector<String> mapFileData, Properties varAddresses) {
|
public static boolean parseMapFileData(Vector<String> mapFileData,
|
||||||
|
Properties varAddresses) {
|
||||||
Vector<String> varNames = getMapFileVarNames(mapFileData);
|
Vector<String> varNames = getMapFileVarNames(mapFileData);
|
||||||
if (varNames == null || varNames.size() == 0)
|
if (varNames == null || varNames.size() == 0) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
for (String varName : varNames) {
|
for (String varName : varNames) {
|
||||||
int varAddress = getMapFileVarAddress(mapFileData, varName);
|
int varAddress = getMapFileVarAddress(mapFileData, varName, varAddresses);
|
||||||
if (varAddress > 0) {
|
if (varAddress > 0) {
|
||||||
varAddresses.put(varName, new Integer(varAddress));
|
varAddresses.put(varName, new Integer(varAddress));
|
||||||
} else
|
} else {
|
||||||
logger.warn("Parsed Contiki variable '" + varName
|
logger.warn("Parsed Contiki variable '" + varName
|
||||||
+ "' but could not find address");
|
+ "' but could not find address");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -428,15 +453,17 @@ public class ContikiMoteType implements MoteType {
|
|||||||
* @param varAddresses
|
* @param varAddresses
|
||||||
* Properties that should contain the name to addresses mappings.
|
* Properties that should contain the name to addresses mappings.
|
||||||
*/
|
*/
|
||||||
public static boolean parseNmData(Vector<String> nmData, Properties varAddresses) {
|
public static boolean parseNmData(Vector<String> nmData,
|
||||||
|
Properties varAddresses) {
|
||||||
int nrNew = 0, nrOld = 0, nrMismatch = 0;
|
int nrNew = 0, nrOld = 0, nrMismatch = 0;
|
||||||
|
|
||||||
Pattern pattern = Pattern.compile(nmRegExp);
|
Pattern pattern = Pattern.compile(GUI
|
||||||
for (String nmLine: nmData) {
|
.getExternalToolsSetting("NM_VAR_NAME_ADDRESS"));
|
||||||
|
for (String nmLine : nmData) {
|
||||||
Matcher matcher = pattern.matcher(nmLine);
|
Matcher matcher = pattern.matcher(nmLine);
|
||||||
|
|
||||||
if (matcher.find()) {
|
if (matcher.find()) {
|
||||||
//logger.debug("Parsing line: " + nmLine);
|
// logger.debug("Parsing line: " + nmLine);
|
||||||
String varName = matcher.group(2);
|
String varName = matcher.group(2);
|
||||||
int varAddress = Integer.parseInt(matcher.group(1), 16);
|
int varAddress = Integer.parseInt(matcher.group(1), 16);
|
||||||
|
|
||||||
@ -446,7 +473,8 @@ public class ContikiMoteType implements MoteType {
|
|||||||
} else {
|
} else {
|
||||||
int oldAddress = (Integer) varAddresses.get(varName);
|
int oldAddress = (Integer) varAddresses.get(varName);
|
||||||
if (oldAddress != varAddress) {
|
if (oldAddress != varAddress) {
|
||||||
logger.warn("Warning, nm response not matching previous entry of: " + varName);
|
logger.warn("Warning, nm response not matching previous entry of: "
|
||||||
|
+ varName);
|
||||||
nrMismatch++;
|
nrMismatch++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -455,10 +483,14 @@ public class ContikiMoteType implements MoteType {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nrMismatch > 0)
|
if (nrMismatch > 0) {
|
||||||
logger.debug("Nm response parsing summary: Added " + nrNew + " variables. Found " + nrOld + " old variables. MISMATCHING ADDRESSES: " + nrMismatch);
|
logger.debug("Nm response parsing summary: Added " + nrNew
|
||||||
else
|
+ " variables. Found " + nrOld
|
||||||
logger.debug("Nm response parsing summary: Added " + nrNew + " variables. Found " + nrOld + " old variables");
|
+ " old variables. MISMATCHING ADDRESSES: " + nrMismatch);
|
||||||
|
} else {
|
||||||
|
logger.debug("Nm response parsing summary: Added " + nrNew
|
||||||
|
+ " variables. Found " + nrOld + " old variables");
|
||||||
|
}
|
||||||
|
|
||||||
return (nrNew + nrOld) > 0;
|
return (nrNew + nrOld) > 0;
|
||||||
}
|
}
|
||||||
@ -476,8 +508,7 @@ public class ContikiMoteType implements MoteType {
|
|||||||
int size = mem.getSizeOfSection(i);
|
int size = mem.getSizeOfSection(i);
|
||||||
byte[] data = mem.getDataOfSection(i);
|
byte[] data = mem.getDataOfSection(i);
|
||||||
|
|
||||||
getCoreMemory(startAddr + offsetRelToAbs,
|
getCoreMemory(startAddr + offsetRelToAbs, size, data);
|
||||||
size, data);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -490,7 +521,8 @@ public class ContikiMoteType implements MoteType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param using Core library has system symbols information
|
* @param using
|
||||||
|
* Core library has system symbols information
|
||||||
*/
|
*/
|
||||||
public void setHasSystemSymbols(boolean using) {
|
public void setHasSystemSymbols(boolean using) {
|
||||||
hasSystemSymbols = using;
|
hasSystemSymbols = using;
|
||||||
@ -504,7 +536,8 @@ public class ContikiMoteType implements MoteType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param commStack Communication stack
|
* @param commStack
|
||||||
|
* Communication stack
|
||||||
*/
|
*/
|
||||||
public void setCommunicationStack(CommunicationStack commStack) {
|
public void setCommunicationStack(CommunicationStack commStack) {
|
||||||
this.commStack = commStack;
|
this.commStack = commStack;
|
||||||
@ -531,7 +564,7 @@ public class ContikiMoteType implements MoteType {
|
|||||||
* Name of variable
|
* Name of variable
|
||||||
* @return Relative memory address of variable or -1 if not found
|
* @return Relative memory address of variable or -1 if not found
|
||||||
*/
|
*/
|
||||||
protected int getMapFileVarAddress(Vector<String> mapFileData, String varName) {
|
public static int getMapFileVarAddress(Vector<String> mapFileData, String varName, Properties varAddresses) {
|
||||||
int varAddr;
|
int varAddr;
|
||||||
String varAddrString;
|
String varAddrString;
|
||||||
if ((varAddrString = varAddresses.getProperty(varName)) != null) {
|
if ((varAddrString = varAddresses.getProperty(varName)) != null) {
|
||||||
@ -539,16 +572,18 @@ public class ContikiMoteType implements MoteType {
|
|||||||
return varAddr;
|
return varAddr;
|
||||||
}
|
}
|
||||||
|
|
||||||
String regExp = varAddressRegExpPrefix + varName + varAddressRegExpSuffix;
|
String regExp = GUI.getExternalToolsSetting("MAPFILE_VAR_ADDRESS_1")
|
||||||
|
+ varName + GUI.getExternalToolsSetting("MAPFILE_VAR_ADDRESS_2");
|
||||||
String retString = getFirstMatchGroup(mapFileData, regExp, 1);
|
String retString = getFirstMatchGroup(mapFileData, regExp, 1);
|
||||||
|
|
||||||
if (retString != null) {
|
if (retString != null) {
|
||||||
varAddresses.setProperty(varName, Integer.toString(Integer.parseInt(
|
varAddresses.setProperty(varName, Integer.toString(Integer.parseInt(
|
||||||
retString.trim(), 16)));
|
retString.trim(), 16)));
|
||||||
return Integer.parseInt(retString.trim(), 16);
|
return Integer.parseInt(retString.trim(), 16);
|
||||||
} else
|
} else {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private int getReferenceAbsAddr() {
|
private int getReferenceAbsAddr() {
|
||||||
return myCoreComm.getReferenceAbsAddr();
|
return myCoreComm.getReferenceAbsAddr();
|
||||||
@ -581,7 +616,7 @@ public class ContikiMoteType implements MoteType {
|
|||||||
*
|
*
|
||||||
* @return Variable names found in the data and bss section
|
* @return Variable names found in the data and bss section
|
||||||
*/
|
*/
|
||||||
private Vector<String> getMapFileVarNames(Vector<String> mapFileData) {
|
public static Vector<String> getMapFileVarNames(Vector<String> mapFileData) {
|
||||||
|
|
||||||
Vector<String> varNames = getAllVariableNames(mapFileData,
|
Vector<String> varNames = getAllVariableNames(mapFileData,
|
||||||
loadRelDataSectionAddr(mapFileData),
|
loadRelDataSectionAddr(mapFileData),
|
||||||
@ -594,11 +629,12 @@ public class ContikiMoteType implements MoteType {
|
|||||||
return varNames;
|
return varNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Vector<String> getAllVariableNames(Vector<String> lines,
|
public static Vector<String> getAllVariableNames(Vector<String> lines,
|
||||||
int startAddress, int endAddress) {
|
int startAddress, int endAddress) {
|
||||||
Vector<String> varNames = new Vector<String>();
|
Vector<String> varNames = new Vector<String>();
|
||||||
|
|
||||||
Pattern pattern = Pattern.compile(varNameRegExp);
|
Pattern pattern = Pattern.compile(GUI
|
||||||
|
.getExternalToolsSetting("MAPFILE_VAR_NAME"));
|
||||||
for (int i = 0; i < lines.size(); i++) {
|
for (int i = 0; i < lines.size(); i++) {
|
||||||
Matcher matcher = pattern.matcher(lines.elementAt(i));
|
Matcher matcher = pattern.matcher(lines.elementAt(i));
|
||||||
if (matcher.find()) {
|
if (matcher.find()) {
|
||||||
@ -612,8 +648,9 @@ public class ContikiMoteType implements MoteType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected int getVariableSize(Vector<String> lines, String varName) {
|
protected int getVariableSize(Vector<String> lines, String varName) {
|
||||||
Pattern pattern = Pattern.compile(varSizeRegExpPrefix + varName
|
Pattern pattern = Pattern.compile(GUI
|
||||||
+ varSizeRegExpSuffix);
|
.getExternalToolsSetting("MAPFILE_VAR_SIZE_1")
|
||||||
|
+ varName + GUI.getExternalToolsSetting("MAPFILE_VAR_SIZE_2"));
|
||||||
for (int i = 0; i < lines.size(); i++) {
|
for (int i = 0; i < lines.size(); i++) {
|
||||||
Matcher matcher = pattern.matcher(lines.elementAt(i));
|
Matcher matcher = pattern.matcher(lines.elementAt(i));
|
||||||
if (matcher.find()) {
|
if (matcher.find()) {
|
||||||
@ -623,53 +660,131 @@ public class ContikiMoteType implements MoteType {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int loadRelDataSectionAddr(Vector<String> mapFileData) {
|
public static int loadRelDataSectionAddr(Vector<String> mapFileData) {
|
||||||
String retString = getFirstMatchGroup(mapFileData, dataSectionAddrRegExp, 1);
|
String retString = getFirstMatchGroup(mapFileData, GUI
|
||||||
|
.getExternalToolsSetting("MAPFILE_DATA_START"), 1);
|
||||||
|
|
||||||
if (retString != null)
|
if (retString != null) {
|
||||||
return Integer.parseInt(retString.trim(), 16);
|
return Integer.parseInt(retString.trim(), 16);
|
||||||
else
|
} else {
|
||||||
return 0;
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int loadDataSectionSize(Vector<String> mapFileData) {
|
public static int loadDataSectionSize(Vector<String> mapFileData) {
|
||||||
String retString = getFirstMatchGroup(mapFileData, dataSectionSizeRegExp, 1);
|
String retString = getFirstMatchGroup(mapFileData, GUI
|
||||||
|
.getExternalToolsSetting("MAPFILE_DATA_SIZE"), 1);
|
||||||
|
|
||||||
if (retString != null)
|
if (retString != null) {
|
||||||
return Integer.parseInt(retString.trim(), 16);
|
return Integer.parseInt(retString.trim(), 16);
|
||||||
else
|
} else {
|
||||||
return 0;
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int loadRelBssSectionAddr(Vector<String> mapFileData) {
|
public static int loadRelBssSectionAddr(Vector<String> mapFileData) {
|
||||||
String retString = getFirstMatchGroup(mapFileData, bssSectionAddrRegExp, 1);
|
String retString = getFirstMatchGroup(mapFileData, GUI
|
||||||
|
.getExternalToolsSetting("MAPFILE_BSS_START"), 1);
|
||||||
|
|
||||||
if (retString != null)
|
if (retString != null) {
|
||||||
return Integer.parseInt(retString.trim(), 16);
|
return Integer.parseInt(retString.trim(), 16);
|
||||||
else
|
} else {
|
||||||
return 0;
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int loadBssSectionSize(Vector<String> mapFileData) {
|
public static int loadBssSectionSize(Vector<String> mapFileData) {
|
||||||
String retString = getFirstMatchGroup(mapFileData, bssSectionSizeRegExp, 1);
|
String retString = getFirstMatchGroup(mapFileData, GUI
|
||||||
|
.getExternalToolsSetting("MAPFILE_BSS_SIZE"), 1);
|
||||||
|
|
||||||
if (retString != null)
|
if (retString != null) {
|
||||||
return Integer.parseInt(retString.trim(), 16);
|
return Integer.parseInt(retString.trim(), 16);
|
||||||
else
|
} else {
|
||||||
return 0;
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int loadNmRelDataSectionAddr(Vector<String> nmData) {
|
||||||
|
String retString = getFirstMatchGroup(nmData, GUI
|
||||||
|
.getExternalToolsSetting("NM_DATA_START"), 1);
|
||||||
|
|
||||||
|
if (retString != null) {
|
||||||
|
return Integer.parseInt(retString.trim(), 16);
|
||||||
|
} else {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int loadNmDataSectionSize(Vector<String> nmData) {
|
||||||
|
String retString;
|
||||||
|
int start, end;
|
||||||
|
|
||||||
|
retString = getFirstMatchGroup(nmData, GUI
|
||||||
|
.getExternalToolsSetting("NM_DATA_START"), 1);
|
||||||
|
if (retString != null) {
|
||||||
|
start = Integer.parseInt(retString.trim(), 16);
|
||||||
|
} else {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
retString = getFirstMatchGroup(nmData, GUI
|
||||||
|
.getExternalToolsSetting("NM_DATA_END"), 1);
|
||||||
|
if (retString != null) {
|
||||||
|
end = Integer.parseInt(retString.trim(), 16);
|
||||||
|
} else {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return end - start;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int loadNmRelBssSectionAddr(Vector<String> nmData) {
|
||||||
|
String retString = getFirstMatchGroup(nmData, GUI
|
||||||
|
.getExternalToolsSetting("NM_BSS_START"), 1);
|
||||||
|
|
||||||
|
if (retString != null) {
|
||||||
|
return Integer.parseInt(retString.trim(), 16);
|
||||||
|
} else {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int loadNmBssSectionSize(Vector<String> nmData) {
|
||||||
|
String retString;
|
||||||
|
int start, end;
|
||||||
|
|
||||||
|
retString = getFirstMatchGroup(nmData, GUI
|
||||||
|
.getExternalToolsSetting("NM_BSS_START"), 1);
|
||||||
|
if (retString != null) {
|
||||||
|
start = Integer.parseInt(retString.trim(), 16);
|
||||||
|
} else {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
retString = getFirstMatchGroup(nmData, GUI
|
||||||
|
.getExternalToolsSetting("NM_BSS_END"), 1);
|
||||||
|
if (retString != null) {
|
||||||
|
end = Integer.parseInt(retString.trim(), 16);
|
||||||
|
} else {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return end - start;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int getRelVarAddr(Vector<String> mapFileData, String varName) {
|
private static int getRelVarAddr(Vector<String> mapFileData, String varName) {
|
||||||
String regExp = varAddressRegExpPrefix + varName + varAddressRegExpSuffix;
|
String regExp = GUI.getExternalToolsSetting("MAPFILE_VAR_ADDRESS_1")
|
||||||
|
+ varName + GUI.getExternalToolsSetting("MAPFILE_VAR_ADDRESS_2");
|
||||||
String retString = getFirstMatchGroup(mapFileData, regExp, 1);
|
String retString = getFirstMatchGroup(mapFileData, regExp, 1);
|
||||||
|
|
||||||
if (retString != null)
|
if (retString != null) {
|
||||||
return Integer.parseInt(retString.trim(), 16);
|
return Integer.parseInt(retString.trim(), 16);
|
||||||
else
|
} else {
|
||||||
return 0;
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Vector<String> loadMapFile(File mapFile) {
|
public static Vector<String> loadMapFile(File mapFile) {
|
||||||
Vector<String> mapFileData = new Vector<String>();
|
Vector<String> mapFileData = new Vector<String>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -693,7 +808,8 @@ public class ContikiMoteType implements MoteType {
|
|||||||
/**
|
/**
|
||||||
* Runs external tool nm on given file and returns the result.
|
* Runs external tool nm on given file and returns the result.
|
||||||
*
|
*
|
||||||
* @param libraryFile File
|
* @param libraryFile
|
||||||
|
* File
|
||||||
* @return Execution response
|
* @return Execution response
|
||||||
*/
|
*/
|
||||||
public static Vector<String> loadNmData(File libraryFile) {
|
public static Vector<String> loadNmData(File libraryFile) {
|
||||||
@ -703,8 +819,9 @@ public class ContikiMoteType implements MoteType {
|
|||||||
String nmPath = GUI.getExternalToolsSetting("PATH_NM");
|
String nmPath = GUI.getExternalToolsSetting("PATH_NM");
|
||||||
String nmArgs = GUI.getExternalToolsSetting("NM_ARGS");
|
String nmArgs = GUI.getExternalToolsSetting("NM_ARGS");
|
||||||
|
|
||||||
if (nmPath == null || nmPath.equals(""))
|
if (nmPath == null || nmPath.equals("")) {
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
String[] nmExecArray;
|
String[] nmExecArray;
|
||||||
if (!nmArgs.trim().equals("")) {
|
if (!nmArgs.trim().equals("")) {
|
||||||
@ -714,8 +831,9 @@ public class ContikiMoteType implements MoteType {
|
|||||||
|
|
||||||
nmExecArray[0] = nmPath.trim();
|
nmExecArray[0] = nmPath.trim();
|
||||||
|
|
||||||
nmExecArray[nmExecArray.length-1] = libraryFile.getAbsolutePath();
|
nmExecArray[nmExecArray.length - 1] = libraryFile.getAbsolutePath();
|
||||||
System.arraycopy(splittedNmArgs, 0, nmExecArray, 1, splittedNmArgs.length);
|
System.arraycopy(splittedNmArgs, 0, nmExecArray, 1,
|
||||||
|
splittedNmArgs.length);
|
||||||
} else {
|
} else {
|
||||||
nmExecArray = new String[2];
|
nmExecArray = new String[2];
|
||||||
nmExecArray[0] = nmPath.trim();
|
nmExecArray[0] = nmPath.trim();
|
||||||
@ -724,22 +842,21 @@ public class ContikiMoteType implements MoteType {
|
|||||||
|
|
||||||
String line;
|
String line;
|
||||||
Process p = Runtime.getRuntime().exec(nmExecArray);
|
Process p = Runtime.getRuntime().exec(nmExecArray);
|
||||||
BufferedReader input =
|
BufferedReader input = new BufferedReader(new InputStreamReader(p
|
||||||
new BufferedReader
|
.getInputStream()));
|
||||||
(new InputStreamReader(p.getInputStream()));
|
|
||||||
p.getErrorStream().close(); // Ignore error stream
|
p.getErrorStream().close(); // Ignore error stream
|
||||||
while ((line = input.readLine()) != null) {
|
while ((line = input.readLine()) != null) {
|
||||||
nmData.add(line);
|
nmData.add(line);
|
||||||
}
|
}
|
||||||
input.close();
|
input.close();
|
||||||
}
|
} catch (Exception err) {
|
||||||
catch (Exception err) {
|
|
||||||
err.printStackTrace();
|
err.printStackTrace();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nmData == null || nmData.size() == 0)
|
if (nmData == null || nmData.size() == 0) {
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return nmData;
|
return nmData;
|
||||||
}
|
}
|
||||||
@ -747,7 +864,8 @@ public class ContikiMoteType implements MoteType {
|
|||||||
/**
|
/**
|
||||||
* Runs external tool objdump on given file and returns the result.
|
* Runs external tool objdump on given file and returns the result.
|
||||||
*
|
*
|
||||||
* @param libraryFile File
|
* @param libraryFile
|
||||||
|
* File
|
||||||
* @return Execution response
|
* @return Execution response
|
||||||
*/
|
*/
|
||||||
public static Vector<String> loadObjdumpData(File libraryFile) {
|
public static Vector<String> loadObjdumpData(File libraryFile) {
|
||||||
@ -757,8 +875,9 @@ public class ContikiMoteType implements MoteType {
|
|||||||
String objdumpPath = GUI.getExternalToolsSetting("PATH_OBJDUMP");
|
String objdumpPath = GUI.getExternalToolsSetting("PATH_OBJDUMP");
|
||||||
String objdumpArgs = GUI.getExternalToolsSetting("OBJDUMP_ARGS");
|
String objdumpArgs = GUI.getExternalToolsSetting("OBJDUMP_ARGS");
|
||||||
|
|
||||||
if (objdumpPath == null || objdumpPath.equals(""))
|
if (objdumpPath == null || objdumpPath.equals("")) {
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
String[] objdumpExecArray;
|
String[] objdumpExecArray;
|
||||||
if (!objdumpArgs.trim().equals("")) {
|
if (!objdumpArgs.trim().equals("")) {
|
||||||
@ -768,8 +887,10 @@ public class ContikiMoteType implements MoteType {
|
|||||||
|
|
||||||
objdumpExecArray[0] = objdumpPath.trim();
|
objdumpExecArray[0] = objdumpPath.trim();
|
||||||
|
|
||||||
objdumpExecArray[objdumpExecArray.length-1] = libraryFile.getAbsolutePath();
|
objdumpExecArray[objdumpExecArray.length - 1] = libraryFile
|
||||||
System.arraycopy(splittedObjdumpArgs, 0, objdumpExecArray, 1, splittedObjdumpArgs.length);
|
.getAbsolutePath();
|
||||||
|
System.arraycopy(splittedObjdumpArgs, 0, objdumpExecArray, 1,
|
||||||
|
splittedObjdumpArgs.length);
|
||||||
} else {
|
} else {
|
||||||
objdumpExecArray = new String[2];
|
objdumpExecArray = new String[2];
|
||||||
objdumpExecArray[0] = objdumpPath.trim();
|
objdumpExecArray[0] = objdumpPath.trim();
|
||||||
@ -778,22 +899,21 @@ public class ContikiMoteType implements MoteType {
|
|||||||
|
|
||||||
String line;
|
String line;
|
||||||
Process p = Runtime.getRuntime().exec(objdumpExecArray);
|
Process p = Runtime.getRuntime().exec(objdumpExecArray);
|
||||||
BufferedReader input =
|
BufferedReader input = new BufferedReader(new InputStreamReader(p
|
||||||
new BufferedReader
|
.getInputStream()));
|
||||||
(new InputStreamReader(p.getInputStream()));
|
|
||||||
p.getErrorStream().close(); // Ignore error stream
|
p.getErrorStream().close(); // Ignore error stream
|
||||||
while ((line = input.readLine()) != null) {
|
while ((line = input.readLine()) != null) {
|
||||||
objdumpData.add(line);
|
objdumpData.add(line);
|
||||||
}
|
}
|
||||||
input.close();
|
input.close();
|
||||||
}
|
} catch (Exception err) {
|
||||||
catch (Exception err) {
|
|
||||||
err.printStackTrace();
|
err.printStackTrace();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (objdumpData == null || objdumpData.size() == 0)
|
if (objdumpData == null || objdumpData.size() == 0) {
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return objdumpData;
|
return objdumpData;
|
||||||
}
|
}
|
||||||
@ -1012,9 +1132,10 @@ public class ContikiMoteType implements MoteType {
|
|||||||
|
|
||||||
while (bytesRead > 0) {
|
while (bytesRead > 0) {
|
||||||
bytesRead = fileInputStream.read(readBytes);
|
bytesRead = fileInputStream.read(readBytes);
|
||||||
if (bytesRead > 0)
|
if (bytesRead > 0) {
|
||||||
messageDigest.update(readBytes, 0, bytesRead);
|
messageDigest.update(readBytes, 0, bytesRead);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
fileInputStream.close();
|
fileInputStream.close();
|
||||||
} catch (NoSuchAlgorithmException e) {
|
} catch (NoSuchAlgorithmException e) {
|
||||||
return null;
|
return null;
|
||||||
@ -1150,14 +1271,14 @@ public class ContikiMoteType implements MoteType {
|
|||||||
config.add(element);
|
config.add(element);
|
||||||
|
|
||||||
// User project directory
|
// User project directory
|
||||||
for (File projectDir: projectDirs) {
|
for (File projectDir : projectDirs) {
|
||||||
element = new Element("projectdir");
|
element = new Element("projectdir");
|
||||||
element.setText(projectDir.getPath());
|
element.setText(projectDir.getPath());
|
||||||
config.add(element);
|
config.add(element);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compilation files
|
// Compilation files
|
||||||
for (File compileFile: compilationFiles) {
|
for (File compileFile : compilationFiles) {
|
||||||
element = new Element("compilefile");
|
element = new Element("compilefile");
|
||||||
element.setText(compileFile.getPath());
|
element.setText(compileFile.getPath());
|
||||||
config.add(element);
|
config.add(element);
|
||||||
@ -1205,7 +1326,8 @@ public class ContikiMoteType implements MoteType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean setConfigXML(Simulation simulation,
|
public boolean setConfigXML(Simulation simulation,
|
||||||
Collection<Element> configXML, boolean visAvailable) throws MoteTypeCreationException {
|
Collection<Element> configXML, boolean visAvailable)
|
||||||
|
throws MoteTypeCreationException {
|
||||||
projectDirs = new Vector<File>();
|
projectDirs = new Vector<File>();
|
||||||
compilationFiles = new Vector<File>();
|
compilationFiles = new Vector<File>();
|
||||||
processes = new Vector<String>();
|
processes = new Vector<String>();
|
||||||
@ -1240,13 +1362,14 @@ public class ContikiMoteType implements MoteType {
|
|||||||
} else if (name.equals("coreinterface")) {
|
} else if (name.equals("coreinterface")) {
|
||||||
coreInterfaces.add(element.getText());
|
coreInterfaces.add(element.getText());
|
||||||
} else if (name.equals("moteinterface")) {
|
} else if (name.equals("moteinterface")) {
|
||||||
Class<? extends MoteInterface> moteInterfaceClass =
|
Class<? extends MoteInterface> moteInterfaceClass = simulation.getGUI()
|
||||||
simulation.getGUI().tryLoadClass(this, MoteInterface.class, element.getText().trim());
|
.tryLoadClass(this, MoteInterface.class, element.getText().trim());
|
||||||
|
|
||||||
if (moteInterfaceClass == null) {
|
if (moteInterfaceClass == null) {
|
||||||
logger.warn("Can't find mote interface class: " + element.getText());
|
logger.warn("Can't find mote interface class: " + element.getText());
|
||||||
} else
|
} else {
|
||||||
moteInterfaces.add(moteInterfaceClass);
|
moteInterfaces.add(moteInterfaceClass);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
logger.fatal("Unrecognized entry in loaded configuration: " + name);
|
logger.fatal("Unrecognized entry in loaded configuration: " + name);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user