diff --git a/tools/cooja/java/org/contikios/cooja/contikimote/ContikiMoteType.java b/tools/cooja/java/org/contikios/cooja/contikimote/ContikiMoteType.java index 2a633f67a..adeed023d 100644 --- a/tools/cooja/java/org/contikios/cooja/contikimote/ContikiMoteType.java +++ b/tools/cooja/java/org/contikios/cooja/contikimote/ContikiMoteType.java @@ -212,6 +212,9 @@ public class ContikiMoteType implements MoteType { // Initial memory for all motes of this type private SectionMoteMemory initialMemory = null; + /** Offset between native (cooja) and contiki address space */ + long offset; + /** * Creates a new uninitialized Cooja mote type. This mote type needs to load * a library file and parse a map file before it can be used. @@ -484,9 +487,8 @@ public class ContikiMoteType implements MoteType { * * This offset will be used in Cooja in the memory abstraction to match * Contiki's and Cooja's address spaces */ - int offset; { - SectionMoteMemory tmp = new SectionMoteMemory(variables, 0); + SectionMoteMemory tmp = new SectionMoteMemory(variables); VarMemory varMem = new VarMemory(tmp); tmp.addMemorySection("tmp.data", dataSecParser.parse()); @@ -508,7 +510,7 @@ public class ContikiMoteType implements MoteType { } /* Create initial memory: data+bss+optional common */ - initialMemory = new SectionMoteMemory(variables, offset); + initialMemory = new SectionMoteMemory(variables); initialMemory.addMemorySection("data", dataSecParser.parse()); diff --git a/tools/cooja/java/org/contikios/cooja/dialogs/ConfigurationWizard.java b/tools/cooja/java/org/contikios/cooja/dialogs/ConfigurationWizard.java index de4beff02..40202fc7a 100644 --- a/tools/cooja/java/org/contikios/cooja/dialogs/ConfigurationWizard.java +++ b/tools/cooja/java/org/contikios/cooja/dialogs/ConfigurationWizard.java @@ -963,7 +963,7 @@ public class ConfigurationWizard extends JDialog { byte[] initialBssSection = new byte[bssSectionSize]; javaLibrary.getMemory(relDataSectionAddr, dataSectionSize, initialDataSection); javaLibrary.getMemory(relBssSectionAddr, bssSectionSize, initialBssSection); - SectionMoteMemory memory = new SectionMoteMemory(addresses, 0); + SectionMoteMemory memory = new SectionMoteMemory(addresses); VarMemory varMem = new VarMemory(memory); memory.setMemorySegment(relDataSectionAddr, initialDataSection); memory.setMemorySegment(relBssSectionAddr, initialBssSection); diff --git a/tools/cooja/java/org/contikios/cooja/mote/memory/SectionMoteMemory.java b/tools/cooja/java/org/contikios/cooja/mote/memory/SectionMoteMemory.java index f1a43cebe..62c12df24 100644 --- a/tools/cooja/java/org/contikios/cooja/mote/memory/SectionMoteMemory.java +++ b/tools/cooja/java/org/contikios/cooja/mote/memory/SectionMoteMemory.java @@ -57,16 +57,11 @@ public class SectionMoteMemory implements MemoryInterface { private MemoryLayout memLayout; private long startAddr = Long.MAX_VALUE; - /* used to map Cooja's address space to native (Contiki's) addresses */ - private final int offset; - /** * @param symbols Symbol addresses - * @param offset Offset for internally used addresses */ - public SectionMoteMemory(Map symbols, int offset) { + public SectionMoteMemory(Map symbols) { this.symbols = symbols; - this.offset = offset; } /** @@ -248,10 +243,6 @@ public class SectionMoteMemory implements MemoryInterface { address, address + data.length - 1); } - public void setMemorySegmentNative(long address, byte[] data) throws MoteMemoryException { - setMemorySegment(address + offset, data); - } - @Override public long getStartAddr() { return startAddr; @@ -292,7 +283,7 @@ public class SectionMoteMemory implements MemoryInterface { @Override public SectionMoteMemory clone() { - SectionMoteMemory clone = new SectionMoteMemory(symbols, offset); + SectionMoteMemory clone = new SectionMoteMemory(symbols); for (String secname : sections.keySet()) { // Copy section memory to new ArrayMemory diff --git a/tools/cooja/java/org/contikios/cooja/motes/AbstractApplicationMote.java b/tools/cooja/java/org/contikios/cooja/motes/AbstractApplicationMote.java index a7a8deaf6..98de78327 100644 --- a/tools/cooja/java/org/contikios/cooja/motes/AbstractApplicationMote.java +++ b/tools/cooja/java/org/contikios/cooja/motes/AbstractApplicationMote.java @@ -92,7 +92,7 @@ public abstract class AbstractApplicationMote extends AbstractWakeupMote impleme setSimulation(sim); this.moteType = moteType; MemoryLayout.getNative(); - this.memory = new SectionMoteMemory(new HashMap(), 0); + this.memory = new SectionMoteMemory(new HashMap()); this.moteInterfaces = new MoteInterfaceHandler(this, moteType.getMoteInterfaceClasses()); this.moteInterfaces.getRadio().addObserver(radioDataObserver); requestImmediateWakeup(); @@ -152,7 +152,7 @@ public abstract class AbstractApplicationMote extends AbstractWakeupMote impleme public boolean setConfigXML(Simulation simulation, Collection configXML, boolean visAvailable) { setSimulation(simulation); - this.memory = new SectionMoteMemory(new HashMap(), 0); + this.memory = new SectionMoteMemory(new HashMap()); moteInterfaces.getRadio().addObserver(radioDataObserver); for (Element element : configXML) {