mirror of https://github.com/contiki-ng/mspsim
minor fix to see LEDS as printout on Z1 + fix for watch command
git-svn-id: https://mspsim.svn.sourceforge.net/svnroot/mspsim/mspsim@787 23d1a52b-0c3c-0410-b72d-8f29ab48fe35
This commit is contained in:
parent
55acf74d94
commit
92586cafe3
|
|
@ -110,17 +110,17 @@ public class DebugCommands implements CommandBundle {
|
|||
if (Character.isDigit(modeStr.charAt(0))) {
|
||||
length = Integer.parseInt(modeStr);
|
||||
} else if ("char".equals(modeStr)) {
|
||||
mode = 1;
|
||||
mode = Utils.ASCII_UNMODIFIED; // 4
|
||||
} else if ("break".equals(modeStr)) {
|
||||
mode = 2;
|
||||
mode = 10;
|
||||
} else if ("hex".equals(modeStr)) {
|
||||
mode = 3;
|
||||
mode = Utils.HEX; // 2
|
||||
}
|
||||
}
|
||||
}
|
||||
CPUMonitor monitor = new CPUMonitor() {
|
||||
public void cpuAction(int type, int adr, int data) {
|
||||
if (mode == 0 || mode == 2) {
|
||||
if (mode == 0 || mode == 10) {
|
||||
int pc = cpu.readRegister(0);
|
||||
String adrStr = getSymOrAddr(context, adr);
|
||||
String pcStr = getSymOrAddrELF(getELF(), pc);
|
||||
|
|
@ -132,17 +132,17 @@ public class DebugCommands implements CommandBundle {
|
|||
}
|
||||
context.out.println("*** " + op + " from " + pcStr +
|
||||
": " + adrStr + " = " + data);
|
||||
if (mode == 2) {
|
||||
if (mode == 10) {
|
||||
cpu.stop();
|
||||
}
|
||||
} else {
|
||||
if (length > 1) {
|
||||
for (int i = address; i < address + length; i++) {
|
||||
context.out.print(Utils.toString(cpu.memory[i], Utils.BYTE, mode == 1 ? Utils.ASCII : Utils.HEX));
|
||||
context.out.print(Utils.toString(cpu.memory[i], Utils.BYTE, mode));
|
||||
}
|
||||
context.out.println();
|
||||
} else {
|
||||
context.out.print(Utils.toString(data, Utils.BYTE, mode == 1 ? Utils.ASCII : Utils.HEX));
|
||||
context.out.print(Utils.toString(data, Utils.BYTE, mode));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ public class MSP430Core extends Chip implements MSP430Constants {
|
|||
public static final int RETURN = 0x4130;
|
||||
|
||||
public static final boolean DEBUG = false;
|
||||
public static final boolean debugInterrupts = true;//false;
|
||||
public static final boolean debugInterrupts = false;
|
||||
|
||||
public static final boolean EXCEPTION_ON_BAD_OPERATION = true;
|
||||
|
||||
|
|
|
|||
|
|
@ -7,12 +7,17 @@ import se.sics.mspsim.core.IOPort;
|
|||
import se.sics.mspsim.core.IOUnit;
|
||||
import se.sics.mspsim.core.PortListener;
|
||||
import se.sics.mspsim.platform.GenericNode;
|
||||
import se.sics.mspsim.platform.esb.ESBNode;
|
||||
import se.sics.mspsim.util.ArgumentManager;
|
||||
|
||||
public class Z1Node extends GenericNode implements PortListener {
|
||||
|
||||
IOPort port1;
|
||||
IOPort port5;
|
||||
|
||||
public static final int LEDS_CONF_RED = 0x10;
|
||||
public static final int LEDS_CONF_GREEN = 0x40;
|
||||
public static final int LEDS_CONF_YELLOW = 0x20;
|
||||
|
||||
|
||||
public Z1Node() {
|
||||
super("Z1", new MSP430f2617Config());
|
||||
|
|
@ -20,6 +25,11 @@ public class Z1Node extends GenericNode implements PortListener {
|
|||
|
||||
public void portWrite(IOPort source, int data) {
|
||||
System.out.println("Write to port: " + source + " => " + data);
|
||||
if (source == port5) {
|
||||
System.out.println("LEDS GREEN = " + ((data & LEDS_CONF_GREEN) > 0));
|
||||
System.out.println("LEDS RED = " + ((data & LEDS_CONF_RED) > 0));
|
||||
System.out.println("LEDS YELLOW = " + ((data & LEDS_CONF_YELLOW) > 0));
|
||||
}
|
||||
}
|
||||
|
||||
private void setupNodePorts() {
|
||||
|
|
@ -28,6 +38,11 @@ public class Z1Node extends GenericNode implements PortListener {
|
|||
port1 = (IOPort) unit;
|
||||
port1.setPortListener(this);
|
||||
}
|
||||
unit = cpu.getIOUnit("P5");
|
||||
if (unit instanceof IOPort) {
|
||||
port5 = (IOPort) unit;
|
||||
port5.setPortListener(this);
|
||||
}
|
||||
}
|
||||
|
||||
public void setupNode() {
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ public class Utils {
|
|||
public static final int ASCII = 1;
|
||||
public static final int HEX = 2;
|
||||
public static final int DEC = 3;
|
||||
public static final int ASCII_UNMODIFIED = 4;
|
||||
|
||||
public static int size(int type) {
|
||||
return 1 + (type / 2);
|
||||
|
|
@ -65,6 +66,8 @@ public class Utils {
|
|||
} else {
|
||||
return ".";
|
||||
}
|
||||
case ASCII_UNMODIFIED:
|
||||
return "" + ((char) data);
|
||||
case HEX:
|
||||
return (size == 2 ? Utils.hex16(data):Utils.hex8(data));
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue