removed contiki motes' communication stack configuration; the network stack instead depends on compiler flags/contiki-conf.h
This commit is contained in:
parent
98929bd2f5
commit
70dd5454fc
3 changed files with 59 additions and 61 deletions
|
@ -26,7 +26,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: ContikiMoteType.java,v 1.40 2010/03/09 08:09:57 fros4943 Exp $
|
||||
* $Id: ContikiMoteType.java,v 1.41 2010/03/10 07:52:05 fros4943 Exp $
|
||||
*/
|
||||
|
||||
package se.sics.cooja.contikimote;
|
||||
|
@ -124,48 +124,49 @@ public class ContikiMoteType implements MoteType {
|
|||
/**
|
||||
* Communication stacks in Contiki.
|
||||
*/
|
||||
public enum CommunicationStack {
|
||||
RIME, UIP, UIPV6;
|
||||
|
||||
public enum NetworkStack {
|
||||
DEFAULT, MANUAL;
|
||||
public String manualHeader = "netstack-conf-example.h";
|
||||
|
||||
public String toString() {
|
||||
if (this == UIPV6) {
|
||||
return "uIPv6";
|
||||
}
|
||||
if (this == UIP) {
|
||||
return "uIPv4";
|
||||
}
|
||||
if (this == RIME) {
|
||||
return "Rime";
|
||||
if (this == DEFAULT) {
|
||||
return "Default (from contiki-conf.h)";
|
||||
} else if (this == MANUAL) {
|
||||
return "Manual netstack header";
|
||||
}
|
||||
return "[unknown]";
|
||||
}
|
||||
|
||||
public String getSourceFilenamesString() {
|
||||
// if (this == UIPV6) {
|
||||
// return " init-net-uipv6.c";
|
||||
// }
|
||||
// if (this == UIP) {
|
||||
// return " init-net-uip.c";
|
||||
// }
|
||||
// if (this == RIME) {
|
||||
// return " init-net-rime.c";
|
||||
// }
|
||||
return " ";
|
||||
public String getHeaderFile() {
|
||||
if (this == DEFAULT) {
|
||||
return null;
|
||||
} else if (this == MANUAL) {
|
||||
return manualHeader;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static CommunicationStack parse(String name) {
|
||||
if (name.equals("uIPv4") || name.equals("UIP")) {
|
||||
return UIP;
|
||||
public String getConfig() {
|
||||
if (this == DEFAULT) {
|
||||
return "DEFAULT";
|
||||
} else if (this == MANUAL) {
|
||||
return "MANUAL:" + manualHeader;
|
||||
}
|
||||
if (name.equals("uIPv6") || name.equals("UIPV6")) {
|
||||
return UIPV6;
|
||||
}
|
||||
if (name.equals("Rime") || name.equals("RIME")) {
|
||||
return RIME;
|
||||
return "[unknown]";
|
||||
}
|
||||
|
||||
public static NetworkStack parseConfig(String config) {
|
||||
if (config.equals("DEFAULT")) {
|
||||
return DEFAULT;
|
||||
} else if (config.startsWith("MANUAL")) {
|
||||
NetworkStack st = MANUAL;
|
||||
st.manualHeader = config.split(":")[1];
|
||||
return st;
|
||||
}
|
||||
|
||||
logger.warn("Can't parse communication stack name: " + name);
|
||||
return RIME;
|
||||
/* TODO Backwards compatibility */
|
||||
logger.warn("Bad network stack config: '" + config + "', using default");
|
||||
return DEFAULT;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -191,7 +192,7 @@ public class ContikiMoteType implements MoteType {
|
|||
|
||||
private boolean hasSystemSymbols = false;
|
||||
|
||||
private CommunicationStack commStack = CommunicationStack.RIME;
|
||||
private NetworkStack netStack = NetworkStack.DEFAULT;
|
||||
|
||||
private Simulation simulation = null;
|
||||
|
||||
|
@ -292,8 +293,7 @@ public class ContikiMoteType implements MoteType {
|
|||
contikiApp,
|
||||
mapFile,
|
||||
libFile,
|
||||
archiveFile,
|
||||
commStack);
|
||||
archiveFile);
|
||||
} catch (Exception e) {
|
||||
throw (MoteTypeCreationException) new MoteTypeCreationException(
|
||||
"Error when creating environment: " + e.getMessage()).initCause(e);
|
||||
|
@ -665,17 +665,17 @@ public class ContikiMoteType implements MoteType {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param commStack Communication stack
|
||||
* @param netStack Contiki network stack
|
||||
*/
|
||||
public void setCommunicationStack(CommunicationStack commStack) {
|
||||
this.commStack = commStack;
|
||||
public void setNetworkStack(NetworkStack netStack) {
|
||||
this.netStack = netStack;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Contiki communication stack
|
||||
* @return Contiki network stack
|
||||
*/
|
||||
public CommunicationStack getCommunicationStack() {
|
||||
return commStack;
|
||||
public NetworkStack getNetworkStack() {
|
||||
return netStack;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1257,9 +1257,11 @@ public class ContikiMoteType implements MoteType {
|
|||
element.setText(new Boolean(hasSystemSymbols()).toString());
|
||||
config.add(element);
|
||||
|
||||
element = new Element("commstack");
|
||||
element.setText(getCommunicationStack().toString());
|
||||
config.add(element);
|
||||
if (getNetworkStack() != NetworkStack.DEFAULT) {
|
||||
element = new Element("netstack");
|
||||
element.setText(getNetworkStack().getConfig());
|
||||
config.add(element);
|
||||
}
|
||||
|
||||
return config;
|
||||
}
|
||||
|
@ -1299,7 +1301,11 @@ public class ContikiMoteType implements MoteType {
|
|||
} else if (name.equals("symbols")) {
|
||||
hasSystemSymbols = Boolean.parseBoolean(element.getText());
|
||||
} else if (name.equals("commstack")) {
|
||||
commStack = CommunicationStack.parse(element.getText());
|
||||
logger.warn("COOJA's communication stack config was removed: " + element.getText());
|
||||
logger.warn("Instead assuming default network stack.");
|
||||
netStack = NetworkStack.DEFAULT;
|
||||
} else if (name.equals("netstack")) {
|
||||
netStack = NetworkStack.parseConfig(element.getText());
|
||||
} else if (name.equals("moteinterface")) {
|
||||
if (element.getText().trim().equals("se.sics.cooja.contikimote.interfaces.ContikiLog")) {
|
||||
/* Backwards compatibility: ContikiLog was removed */
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: CompileContiki.java,v 1.4 2009/04/01 14:00:00 fros4943 Exp $
|
||||
* $Id: CompileContiki.java,v 1.5 2010/03/10 07:49:25 fros4943 Exp $
|
||||
*/
|
||||
|
||||
package se.sics.cooja.dialogs;
|
||||
|
@ -42,6 +42,7 @@ import java.io.InputStream;
|
|||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.Reader;
|
||||
|
||||
import javax.swing.Action;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
@ -49,8 +50,6 @@ import org.apache.log4j.Logger;
|
|||
import se.sics.cooja.GUI;
|
||||
import se.sics.cooja.MoteType.MoteTypeCreationException;
|
||||
import se.sics.cooja.contikimote.ContikiMoteType;
|
||||
import se.sics.cooja.contikimote.ContikiMoteType.CommunicationStack;
|
||||
import se.sics.cooja.dialogs.MessageList;
|
||||
|
||||
/**
|
||||
* Contiki compiler library.
|
||||
|
@ -377,8 +376,7 @@ public class CompileContiki {
|
|||
File contikiApp,
|
||||
File mapFile,
|
||||
File libFile,
|
||||
File archiveFile,
|
||||
CommunicationStack commStack)
|
||||
File archiveFile)
|
||||
throws Exception {
|
||||
|
||||
if (identifier == null) {
|
||||
|
@ -397,7 +395,6 @@ public class CompileContiki {
|
|||
throw new Exception("No archive file specified");
|
||||
}
|
||||
|
||||
String[][] env = new String[13][];
|
||||
boolean includeSymbols = false; /* TODO */
|
||||
|
||||
/* Fetch configuration from external tools */
|
||||
|
@ -440,14 +437,11 @@ public class CompileContiki {
|
|||
ccFlags = ccFlags.replace("$(JAVA_HOME)", javaHome);
|
||||
|
||||
/* Strip away contiki application .c extension */
|
||||
String commStackFiles = "";
|
||||
if (commStack != null) {
|
||||
commStackFiles = commStack.getSourceFilenamesString();
|
||||
}
|
||||
String contikiAppNoExtension = contikiApp.getName().substring(0, contikiApp.getName().length()-2);
|
||||
String[][] env = new String[13][];
|
||||
env[0] = new String[] { "LIBNAME", identifier };
|
||||
env[1] = new String[] { "CONTIKI_APP", contikiAppNoExtension };
|
||||
env[2] = new String[] { "COOJA_SOURCEFILES", commStackFiles };
|
||||
env[2] = new String[] { "COOJA_SOURCEFILES", "" };
|
||||
env[3] = new String[] { "CC", GUI.getExternalToolsSetting("PATH_C_COMPILER") };
|
||||
env[4] = new String[] { "EXTRA_CC_ARGS", ccFlags };
|
||||
env[5] = new String[] { "LD", GUI.getExternalToolsSetting("PATH_LINKER") };
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: ConfigurationWizard.java,v 1.7 2010/02/03 15:49:24 fros4943 Exp $
|
||||
* $Id: ConfigurationWizard.java,v 1.8 2010/03/10 07:49:46 fros4943 Exp $
|
||||
*/
|
||||
|
||||
package se.sics.cooja.dialogs;
|
||||
|
@ -69,7 +69,6 @@ import se.sics.cooja.GUI;
|
|||
import se.sics.cooja.SectionMoteMemory;
|
||||
import se.sics.cooja.MoteType.MoteTypeCreationException;
|
||||
import se.sics.cooja.contikimote.ContikiMoteType;
|
||||
import se.sics.cooja.contikimote.ContikiMoteType.CommunicationStack;
|
||||
|
||||
/* TODO Test common section */
|
||||
|
||||
|
@ -602,8 +601,7 @@ public class ConfigurationWizard extends JDialog {
|
|||
new File(cLibraryName + ".c"),
|
||||
new File(cLibraryName + ContikiMoteType.mapSuffix),
|
||||
new File(cLibraryName + ContikiMoteType.librarySuffix),
|
||||
new File(cLibraryName + ContikiMoteType.dependSuffix),
|
||||
CommunicationStack.RIME
|
||||
new File(cLibraryName + ContikiMoteType.dependSuffix)
|
||||
);
|
||||
} catch (Exception e) {
|
||||
testOutput.addMessage("### Error: Compiler environment failed", MessageList.ERROR);
|
||||
|
|
Loading…
Reference in a new issue