mirror of
https://github.com/oliverschmidt/contiki.git
synced 2024-12-22 10:30:13 +00:00
updated to mspsims new watchpoint api
This commit is contained in:
parent
681b40c3c1
commit
5bcb6ad8a5
@ -67,6 +67,7 @@ public class MspDebugOutput extends Log {
|
||||
private MspMoteMemory mem;
|
||||
|
||||
private String lastLog = null;
|
||||
private CPUMonitor cpuMonitor = null;
|
||||
|
||||
public MspDebugOutput(Mote mote) {
|
||||
this.mote = (MspMote) mote;
|
||||
@ -76,8 +77,8 @@ public class MspDebugOutput extends Log {
|
||||
/* Disabled */
|
||||
return;
|
||||
}
|
||||
this.mote.getCPU().setBreakPoint(mem.getVariableAddress(CONTIKI_POINTER),
|
||||
new CPUMonitor() {
|
||||
this.mote.getCPU().addWatchPoint(mem.getVariableAddress(CONTIKI_POINTER),
|
||||
cpuMonitor = new CPUMonitor() {
|
||||
public void cpuAction(int type, int adr, int data) {
|
||||
if (type != MEMORY_WRITE) {
|
||||
return;
|
||||
@ -136,6 +137,9 @@ public class MspDebugOutput extends Log {
|
||||
|
||||
public void removed() {
|
||||
super.removed();
|
||||
/* TODO Remove watchpoint */
|
||||
|
||||
if (cpuMonitor != null) {
|
||||
mote.getCPU().removeWatchPoint(mem.getVariableAddress(CONTIKI_POINTER), cpuMonitor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -64,6 +64,8 @@ public class MspMoteID extends MoteID {
|
||||
private boolean writeFlashHeader = true;
|
||||
private int moteID = -1;
|
||||
|
||||
private CPUMonitor cpuMonitor;
|
||||
|
||||
/**
|
||||
* Creates an interface to the mote ID at mote.
|
||||
*
|
||||
@ -81,61 +83,33 @@ public class MspMoteID extends MoteID {
|
||||
}
|
||||
};
|
||||
|
||||
cpuMonitor = new CPUMonitor() {
|
||||
public void cpuAction(int type, int adr, int data) {
|
||||
if (type != MEMORY_WRITE) {
|
||||
return;
|
||||
}
|
||||
if (data == moteID) {
|
||||
return;
|
||||
}
|
||||
Simulation s = mote.getSimulation();
|
||||
if (writeIDEvent.isScheduled()) {
|
||||
return;
|
||||
}
|
||||
s.scheduleEvent(writeIDEvent, s.getSimulationTime());
|
||||
}
|
||||
};
|
||||
|
||||
if (moteMem.variableExists("node_id")) {
|
||||
this.mote.getCPU().setBreakPoint(moteMem.getVariableAddress("node_id"), new CPUMonitor() {
|
||||
public void cpuAction(int type, int adr, int data) {
|
||||
if (type != MEMORY_WRITE) {
|
||||
return;
|
||||
}
|
||||
if (data == moteID) {
|
||||
return;
|
||||
}
|
||||
Simulation s = mote.getSimulation();
|
||||
s.scheduleEvent(writeIDEvent, s.getSimulationTime());
|
||||
}
|
||||
});
|
||||
this.mote.getCPU().addWatchPoint(moteMem.getVariableAddress("node_id"), cpuMonitor);
|
||||
}
|
||||
if (moteMem.variableExists("TOS_NODE_ID")) {
|
||||
this.mote.getCPU().setBreakPoint(moteMem.getVariableAddress("TOS_NODE_ID"), new CPUMonitor() {
|
||||
public void cpuAction(int type, int adr, int data) {
|
||||
if (type != MEMORY_WRITE) {
|
||||
return;
|
||||
}
|
||||
if (data == moteID) {
|
||||
return;
|
||||
}
|
||||
Simulation s = mote.getSimulation();
|
||||
s.scheduleEvent(writeIDEvent, s.getSimulationTime());
|
||||
}
|
||||
});
|
||||
this.mote.getCPU().addWatchPoint(moteMem.getVariableAddress("TOS_NODE_ID"), cpuMonitor);
|
||||
}
|
||||
if (moteMem.variableExists("ActiveMessageAddressC__addr")) {
|
||||
this.mote.getCPU().setBreakPoint(moteMem.getVariableAddress("ActiveMessageAddressC__addr"), new CPUMonitor() {
|
||||
public void cpuAction(int type, int adr, int data) {
|
||||
if (type != MEMORY_WRITE) {
|
||||
return;
|
||||
}
|
||||
if (data == moteID) {
|
||||
return;
|
||||
}
|
||||
Simulation s = mote.getSimulation();
|
||||
s.scheduleEvent(writeIDEvent, s.getSimulationTime());
|
||||
}
|
||||
});
|
||||
this.mote.getCPU().addWatchPoint(moteMem.getVariableAddress("ActiveMessageAddressC__addr"), cpuMonitor);
|
||||
}
|
||||
if (moteMem.variableExists("ActiveMessageAddressC$addr")) {
|
||||
this.mote.getCPU().setBreakPoint(moteMem.getVariableAddress("ActiveMessageAddressC$addr"), new CPUMonitor() {
|
||||
public void cpuAction(int type, int adr, int data) {
|
||||
if (type != MEMORY_WRITE) {
|
||||
return;
|
||||
}
|
||||
if (data == moteID) {
|
||||
return;
|
||||
}
|
||||
Simulation s = mote.getSimulation();
|
||||
s.scheduleEvent(writeIDEvent, s.getSimulationTime());
|
||||
}
|
||||
});
|
||||
this.mote.getCPU().addWatchPoint(moteMem.getVariableAddress("ActiveMessageAddressC$addr"), cpuMonitor);
|
||||
}
|
||||
}
|
||||
|
||||
@ -224,4 +198,20 @@ public class MspMoteID extends MoteID {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void removed() {
|
||||
super.removed();
|
||||
if (moteMem.variableExists("node_id")) {
|
||||
this.mote.getCPU().removeWatchPoint(moteMem.getVariableAddress("node_id"), cpuMonitor);
|
||||
}
|
||||
if (moteMem.variableExists("TOS_NODE_ID")) {
|
||||
this.mote.getCPU().removeWatchPoint(moteMem.getVariableAddress("TOS_NODE_ID"), cpuMonitor);
|
||||
}
|
||||
if (moteMem.variableExists("ActiveMessageAddressC__addr")) {
|
||||
this.mote.getCPU().removeWatchPoint(moteMem.getVariableAddress("ActiveMessageAddressC__addr"), cpuMonitor);
|
||||
}
|
||||
if (moteMem.variableExists("ActiveMessageAddressC$addr")) {
|
||||
this.mote.getCPU().removeWatchPoint(moteMem.getVariableAddress("ActiveMessageAddressC$addr"), cpuMonitor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -128,11 +128,11 @@ public class MspBreakpoint implements Watchpoint {
|
||||
breakpoints.signalBreakpointTrigger(MspBreakpoint.this);
|
||||
}
|
||||
};
|
||||
mspMote.getCPU().setBreakPoint(address, cpuMonitor);
|
||||
mspMote.getCPU().addWatchPoint(address, cpuMonitor);
|
||||
}
|
||||
|
||||
public void unregisterBreakpoint() {
|
||||
mspMote.getCPU().setBreakPoint(address, null);
|
||||
mspMote.getCPU().removeWatchPoint(address, cpuMonitor);
|
||||
}
|
||||
|
||||
public Collection<Element> getConfigXML() {
|
||||
|
Loading…
Reference in New Issue
Block a user