activated communication stack selection for contiki mote types
This commit is contained in:
parent
5ed4a247f7
commit
fe1f594d73
|
@ -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: CompileContiki.java,v 1.3 2009/03/21 16:44:29 fros4943 Exp $
|
* $Id: CompileContiki.java,v 1.4 2009/04/01 14:00:00 fros4943 Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package se.sics.cooja.dialogs;
|
package se.sics.cooja.dialogs;
|
||||||
|
@ -49,6 +49,7 @@ import org.apache.log4j.Logger;
|
||||||
import se.sics.cooja.GUI;
|
import se.sics.cooja.GUI;
|
||||||
import se.sics.cooja.MoteType.MoteTypeCreationException;
|
import se.sics.cooja.MoteType.MoteTypeCreationException;
|
||||||
import se.sics.cooja.contikimote.ContikiMoteType;
|
import se.sics.cooja.contikimote.ContikiMoteType;
|
||||||
|
import se.sics.cooja.contikimote.ContikiMoteType.CommunicationStack;
|
||||||
import se.sics.cooja.dialogs.MessageList;
|
import se.sics.cooja.dialogs.MessageList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -376,7 +377,8 @@ public class CompileContiki {
|
||||||
File contikiApp,
|
File contikiApp,
|
||||||
File mapFile,
|
File mapFile,
|
||||||
File libFile,
|
File libFile,
|
||||||
File archiveFile)
|
File archiveFile,
|
||||||
|
CommunicationStack commStack)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
|
|
||||||
if (identifier == null) {
|
if (identifier == null) {
|
||||||
|
@ -438,10 +440,14 @@ public class CompileContiki {
|
||||||
ccFlags = ccFlags.replace("$(JAVA_HOME)", javaHome);
|
ccFlags = ccFlags.replace("$(JAVA_HOME)", javaHome);
|
||||||
|
|
||||||
/* Strip away contiki application .c extension */
|
/* 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 contikiAppNoExtension = contikiApp.getName().substring(0, contikiApp.getName().length()-2);
|
||||||
env[0] = new String[] { "LIBNAME", identifier };
|
env[0] = new String[] { "LIBNAME", identifier };
|
||||||
env[1] = new String[] { "CONTIKI_APP", contikiAppNoExtension };
|
env[1] = new String[] { "CONTIKI_APP", contikiAppNoExtension };
|
||||||
env[2] = new String[] { "COOJA_SOURCEFILES", "cooja-radio.c init-net-rime.c" };
|
env[2] = new String[] { "COOJA_SOURCEFILES", commStackFiles };
|
||||||
env[3] = new String[] { "CC", GUI.getExternalToolsSetting("PATH_C_COMPILER") };
|
env[3] = new String[] { "CC", GUI.getExternalToolsSetting("PATH_C_COMPILER") };
|
||||||
env[4] = new String[] { "EXTRA_CC_ARGS", ccFlags };
|
env[4] = new String[] { "EXTRA_CC_ARGS", ccFlags };
|
||||||
env[5] = new String[] { "LD", GUI.getExternalToolsSetting("PATH_LINKER") };
|
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
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: ConfigurationWizard.java,v 1.2 2009/03/11 08:44:32 fros4943 Exp $
|
* $Id: ConfigurationWizard.java,v 1.3 2009/04/01 14:00:40 fros4943 Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package se.sics.cooja.dialogs;
|
package se.sics.cooja.dialogs;
|
||||||
|
@ -56,6 +56,7 @@ import se.sics.cooja.GUI;
|
||||||
import se.sics.cooja.SectionMoteMemory;
|
import se.sics.cooja.SectionMoteMemory;
|
||||||
import se.sics.cooja.MoteType.MoteTypeCreationException;
|
import se.sics.cooja.MoteType.MoteTypeCreationException;
|
||||||
import se.sics.cooja.contikimote.ContikiMoteType;
|
import se.sics.cooja.contikimote.ContikiMoteType;
|
||||||
|
import se.sics.cooja.contikimote.ContikiMoteType.CommunicationStack;
|
||||||
|
|
||||||
public class ConfigurationWizard extends JDialog {
|
public class ConfigurationWizard extends JDialog {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
@ -573,7 +574,8 @@ public class ConfigurationWizard extends JDialog {
|
||||||
new File(cLibraryName + ".c"),
|
new File(cLibraryName + ".c"),
|
||||||
new File(cLibraryName + ContikiMoteType.mapSuffix),
|
new File(cLibraryName + ContikiMoteType.mapSuffix),
|
||||||
new File(cLibraryName + ContikiMoteType.librarySuffix),
|
new File(cLibraryName + ContikiMoteType.librarySuffix),
|
||||||
new File(cLibraryName + ContikiMoteType.dependSuffix)
|
new File(cLibraryName + ContikiMoteType.dependSuffix),
|
||||||
|
CommunicationStack.RIME
|
||||||
);
|
);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
testOutput.addMessage("### Error: Compiler environment failed", MessageList.ERROR);
|
testOutput.addMessage("### Error: Compiler environment failed", MessageList.ERROR);
|
||||||
|
|
|
@ -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: ContikiMoteCompileDialog.java,v 1.2 2009/03/11 18:18:57 fros4943 Exp $
|
* $Id: ContikiMoteCompileDialog.java,v 1.3 2009/04/01 14:00:30 fros4943 Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package se.sics.cooja.dialogs;
|
package se.sics.cooja.dialogs;
|
||||||
|
@ -39,7 +39,6 @@ import java.awt.event.ActionListener;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import javax.swing.Box;
|
import javax.swing.Box;
|
||||||
import javax.swing.JButton;
|
import javax.swing.JButton;
|
||||||
import javax.swing.JCheckBox;
|
|
||||||
import javax.swing.JComboBox;
|
import javax.swing.JComboBox;
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
|
@ -67,6 +66,8 @@ import se.sics.cooja.contikimote.ContikiMoteType.CommunicationStack;
|
||||||
public class ContikiMoteCompileDialog extends AbstractCompileDialog {
|
public class ContikiMoteCompileDialog extends AbstractCompileDialog {
|
||||||
private static Logger logger = Logger.getLogger(ContikiMoteCompileDialog.class);
|
private static Logger logger = Logger.getLogger(ContikiMoteCompileDialog.class);
|
||||||
|
|
||||||
|
private JComboBox commStackComboBox = new JComboBox(CommunicationStack.values());
|
||||||
|
|
||||||
public static boolean showDialog(
|
public static boolean showDialog(
|
||||||
Container parent,
|
Container parent,
|
||||||
Simulation simulation,
|
Simulation simulation,
|
||||||
|
@ -94,7 +95,7 @@ public class ContikiMoteCompileDialog extends AbstractCompileDialog {
|
||||||
|
|
||||||
/* Add Contiki mote type specifics */
|
/* Add Contiki mote type specifics */
|
||||||
addMoteInterfaceClasses();
|
addMoteInterfaceClasses();
|
||||||
/* TODO addAdvancedTab(tabbedPane);*/
|
addAdvancedTab(tabbedPane);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canLoadFirmware(File file) {
|
public boolean canLoadFirmware(File file) {
|
||||||
|
@ -157,12 +158,9 @@ public class ContikiMoteCompileDialog extends AbstractCompileDialog {
|
||||||
source,
|
source,
|
||||||
((ContikiMoteType)moteType).mapFile,
|
((ContikiMoteType)moteType).mapFile,
|
||||||
((ContikiMoteType)moteType).libFile,
|
((ContikiMoteType)moteType).libFile,
|
||||||
((ContikiMoteType)moteType).archiveFile
|
((ContikiMoteType)moteType).archiveFile,
|
||||||
|
((ContikiMoteType) moteType).getCommunicationStack()
|
||||||
);
|
);
|
||||||
} catch (Exception e) {
|
|
||||||
logger.warn("Error when creating environment: " + e.getMessage());
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
String[] envOneDimension = new String[env.length];
|
String[] envOneDimension = new String[env.length];
|
||||||
for (int i=0; i < env.length; i++) {
|
for (int i=0; i < env.length; i++) {
|
||||||
envOneDimension[i] = env[i][0] + "=" + env[i][1];
|
envOneDimension[i] = env[i][0] + "=" + env[i][1];
|
||||||
|
@ -171,10 +169,22 @@ public class ContikiMoteCompileDialog extends AbstractCompileDialog {
|
||||||
|
|
||||||
/* Prepare compiler with environment variables */
|
/* Prepare compiler with environment variables */
|
||||||
this.compilationEnvironment = envOneDimension;
|
this.compilationEnvironment = envOneDimension;
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.warn("Error when creating environment: " + e.getMessage());
|
||||||
|
e.printStackTrace();
|
||||||
|
env = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
String defines = "";
|
||||||
|
if (((ContikiMoteType) moteType).getCommunicationStack() == CommunicationStack.UIP) {
|
||||||
|
defines = " DEFINES=WITH_UIP=1";
|
||||||
|
}
|
||||||
|
if (((ContikiMoteType) moteType).getCommunicationStack() == CommunicationStack.UIPV6) {
|
||||||
|
defines = " DEFINES=UIP_CONF_IPV6=1";
|
||||||
|
}
|
||||||
return
|
return
|
||||||
/*"make clean TARGET=cooja\n" + */
|
/*"make clean TARGET=cooja\n" + */
|
||||||
"make " + getExpectedFirmwareFile(source).getName() + " TARGET=cooja";
|
"make " + getExpectedFirmwareFile(source).getName() + " TARGET=cooja" + defines;
|
||||||
}
|
}
|
||||||
|
|
||||||
public File getExpectedFirmwareFile(File source) {
|
public File getExpectedFirmwareFile(File source) {
|
||||||
|
@ -207,20 +217,25 @@ public class ContikiMoteCompileDialog extends AbstractCompileDialog {
|
||||||
private void addAdvancedTab(JTabbedPane parent) {
|
private void addAdvancedTab(JTabbedPane parent) {
|
||||||
|
|
||||||
/* TODO System symbols */
|
/* TODO System symbols */
|
||||||
JCheckBox symbolsCheckBox = new JCheckBox("With system symbols", false);
|
/*JCheckBox symbolsCheckBox = new JCheckBox("With system symbols", false);
|
||||||
symbolsCheckBox.setAlignmentX(Component.LEFT_ALIGNMENT);
|
symbolsCheckBox.setAlignmentX(Component.LEFT_ALIGNMENT);
|
||||||
symbolsCheckBox.setEnabled(false);
|
symbolsCheckBox.setEnabled(false);
|
||||||
symbolsCheckBox.setToolTipText("Not implemented");
|
symbolsCheckBox.setToolTipText("Not implemented");*/
|
||||||
|
|
||||||
/* TODO Communication stack */
|
/* Communication stack */
|
||||||
JLabel label = new JLabel("Communication stack");
|
JLabel label = new JLabel("Communication stack");
|
||||||
label.setPreferredSize(LABEL_DIMENSION);
|
label.setPreferredSize(LABEL_DIMENSION);
|
||||||
JComboBox commStackComboBox = new JComboBox(CommunicationStack.values());
|
commStackComboBox.setSelectedItem(((ContikiMoteType)moteType).getCommunicationStack());
|
||||||
commStackComboBox.setSelectedIndex(0);
|
|
||||||
commStackComboBox.setEnabled(true);
|
commStackComboBox.setEnabled(true);
|
||||||
commStackComboBox.setPreferredSize(LABEL_DIMENSION);
|
commStackComboBox.setPreferredSize(LABEL_DIMENSION);
|
||||||
commStackComboBox.setMaximumSize(LABEL_DIMENSION);
|
commStackComboBox.setMaximumSize(LABEL_DIMENSION);
|
||||||
commStackComboBox.setToolTipText("Not implemented");
|
commStackComboBox.addActionListener(new ActionListener() {
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
((ContikiMoteType)moteType).setCommunicationStack(
|
||||||
|
(CommunicationStack)commStackComboBox.getSelectedItem());
|
||||||
|
setDialogState(DialogState.SELECTED_SOURCE);
|
||||||
|
}
|
||||||
|
});
|
||||||
Box commStackBox = Box.createHorizontalBox();
|
Box commStackBox = Box.createHorizontalBox();
|
||||||
commStackBox.setAlignmentX(Component.LEFT_ALIGNMENT);
|
commStackBox.setAlignmentX(Component.LEFT_ALIGNMENT);
|
||||||
commStackBox.add(label);
|
commStackBox.add(label);
|
||||||
|
@ -229,7 +244,7 @@ public class ContikiMoteCompileDialog extends AbstractCompileDialog {
|
||||||
|
|
||||||
/* Advanced tab */
|
/* Advanced tab */
|
||||||
Box box = Box.createVerticalBox();
|
Box box = Box.createVerticalBox();
|
||||||
box.add(symbolsCheckBox);
|
/*box.add(symbolsCheckBox);*/
|
||||||
box.add(commStackBox);
|
box.add(commStackBox);
|
||||||
box.add(Box.createVerticalGlue());
|
box.add(Box.createVerticalGlue());
|
||||||
parent.addTab("Advanced", null, new JScrollPane(box), "Advanced Contiki Mote Type settings");
|
parent.addTab("Advanced", null, new JScrollPane(box), "Advanced Contiki Mote Type settings");
|
||||||
|
@ -291,9 +306,6 @@ public class ContikiMoteCompileDialog extends AbstractCompileDialog {
|
||||||
|
|
||||||
/* TODO System symbols */
|
/* TODO System symbols */
|
||||||
((ContikiMoteType)moteType).setHasSystemSymbols(false);
|
((ContikiMoteType)moteType).setHasSystemSymbols(false);
|
||||||
|
|
||||||
/* TODO Communication stack */
|
|
||||||
((ContikiMoteType)moteType).setCommunicationStack(ContikiMoteType.CommunicationStack.RIME);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void compileContiki()
|
public void compileContiki()
|
||||||
|
|
Loading…
Reference in a new issue