diff --git a/Makefile b/Makefile index 8bbeb07..427ffe5 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ # Makefile for mspsim # # Needed stuff in the PATH: -# java, javac (JDK 1.6 or newer) +# java, javac (JDK 1.7 or newer) # # Under MS-DOS/Windows # A GNU compatible Make (for example Cygwin's) @@ -46,7 +46,7 @@ SPACE := ${EMPTY} ${EMPTY} LIBS := ${wildcard lib/*.jar} BUILD := build CLASSPATH=${subst ${SPACE},${SEPARATOR},$(BUILD)/ ${LIBS}} -CCARGS=-deprecation -classpath ".${SEPARATOR}${CLASSPATH}" -d $(BUILD) +CCARGS=-deprecation -Xlint:unchecked -source 1.7 -target 1.7 -classpath ".${SEPARATOR}${CLASSPATH}" -d $(BUILD) JAVAARGS=-classpath "${CLASSPATH}" @@ -71,6 +71,10 @@ TYNDALLFIRMWARE = ${FIRMWAREFILE} EXP5438FIRMWARE = ${FIRMWAREFILE} endif +ifdef MAPFILE +MAPARGS := -map=$(MAPFILE) +endif + CPUTEST := tests/cputest.firmware TIMERTEST := tests/timertest.firmware @@ -107,49 +111,49 @@ $(JARFILE): $(OBJECTS) -@$(RM) JarManifest.txt %.esb: jar - java -jar $(JARFILE) -platform=esb $(ARGS) $@ + java -jar $(JARFILE) -platform=esb $@ $(ARGS) %.sky: jar - java -jar $(JARFILE) -platform=sky $(ARGS) $@ + java -jar $(JARFILE) -platform=sky $@ $(ARGS) %.z1: jar - java -jar $(JARFILE) -platform=z1 $(ARGS) $@ + java -jar $(JARFILE) -platform=z1 $@ $(ARGS) %.exp5438: jar - java -jar $(JARFILE) -platform=exp5438 $(ARGS) $@ + java -jar $(JARFILE) -platform=exp5438 $@ $(ARGS) %.tyndall: jar - java -jar $(JARFILE) -platform=tyndall $(ARGS) $@ + java -jar $(JARFILE) -platform=tyndall $@ $(ARGS) %.wismote: jar - java -jar $(JARFILE) -platform=wismote $(ARGS) $@ + java -jar $(JARFILE) -platform=wismote $@ $(ARGS) help: @echo "Usage: make [all,compile,clean,run,runsky,runesb]" run: compile - $(JAVA) $(JAVAARGS) se.sics.mspsim.util.IHexReader $(ARGS) $(FIRMWAREFILE) $(MAPFILE) + $(JAVA) $(JAVAARGS) se.sics.mspsim.Main $(FIRMWAREFILE) $(MAPARGS) $(ARGS) runesb: compile - $(JAVA) $(JAVAARGS) se.sics.mspsim.platform.esb.ESBNode $(ARGS) $(ESBFIRMWARE) $(MAPFILE) + $(JAVA) $(JAVAARGS) se.sics.mspsim.platform.esb.ESBNode $(ESBFIRMWARE) $(MAPARGS) $(ARGS) runsky: compile - $(JAVA) $(JAVAARGS) se.sics.mspsim.platform.sky.SkyNode $(ARGS) $(SKYFIRMWARE) $(MAPFILE) + $(JAVA) $(JAVAARGS) se.sics.mspsim.platform.sky.SkyNode $(SKYFIRMWARE) $(MAPARGS) $(ARGS) runskyprof: compile - $(JAVA) -agentlib:yjpagent $(JAVAARGS) se.sics.mspsim.platform.sky.SkyNode $(ARGS) $(SKYFIRMWARE) $(MAPFILE) + $(JAVA) -agentlib:yjpagent $(JAVAARGS) se.sics.mspsim.platform.sky.SkyNode $(SKYFIRMWARE) $(MAPARGS) $(ARGS) runtelos: compile - $(JAVA) $(JAVAARGS) se.sics.mspsim.platform.sky.TelosNode $(ARGS) $(SKYFIRMWARE) $(MAPFILE) + $(JAVA) $(JAVAARGS) se.sics.mspsim.platform.sky.TelosNode $(SKYFIRMWARE) $(MAPARGS) $(ARGS) runz1: compile - $(JAVA) $(JAVAARGS) se.sics.mspsim.platform.z1.Z1Node $(ARGS) $(Z1FIRMWARE) $(MAPFILE) + $(JAVA) $(JAVAARGS) se.sics.mspsim.platform.z1.Z1Node $(Z1FIRMWARE) $(MAPARGS) $(ARGS) runtyndall: compile - $(JAVA) $(JAVAARGS) se.sics.mspsim.platform.tyndall.TyndallNode $(ARGS) $(TYNDALLFIRMWARE) $(MAPFILE) + $(JAVA) $(JAVAARGS) se.sics.mspsim.platform.tyndall.TyndallNode $(TYNDALLFIRMWARE) $(MAPARGS) $(ARGS) runwismote: compile - $(JAVA) $(JAVAARGS) se.sics.mspsim.platform.wismote.WismoteNode $(ARGS) $(WISMOTEFIRMWARE) $(MAPFILE) + $(JAVA) $(JAVAARGS) se.sics.mspsim.platform.wismote.WismoteNode $(WISMOTEFIRMWARE) $(MAPARGS) $(ARGS) runexp5438: compile - $(JAVA) $(JAVAARGS) se.sics.mspsim.platform.ti.Exp5438Node $(ARGS) $(EXP5438FIRMWARE) $(MAPFILE) + $(JAVA) $(JAVAARGS) se.sics.mspsim.platform.ti.Exp5438Node $(EXP5438FIRMWARE) $(MAPARGS) $(ARGS) test: cputest @@ -196,3 +200,6 @@ $(BUILD)/%.class : %.java $(BUILD) clean: -$(RM) -r $(BUILD) + +distclean: clean + -$(RM) -f $(JARFILE) diff --git a/README.txt b/README.txt index 015c8ba..5483169 100644 --- a/README.txt +++ b/README.txt @@ -7,9 +7,8 @@ some tools for monitoring stack, setting breakpoints, and profiling. * System requirements -You need a recent Java to run MSPSim. Java SE 1.5 or newer is -recommended. The current version of MSPSim also requires make for -compiling. +You need a recent Java to run MSPSim. Java SE 1.7 or newer is recommended. +The current version of MSPSim also requires make or ant for compiling. * Building MSPSim @@ -60,4 +59,4 @@ Run the default example on the Sky node emulator by typing: - currently the emulator runs as if it can use all memory as RAM (e.g. flash writes, etc not supported) - no DMA implementation -- timer system not 100% emulated \ No newline at end of file +- timer system not 100% emulated diff --git a/build.xml b/build.xml index be31c78..c92bcb7 100644 --- a/build.xml +++ b/build.xml @@ -8,6 +8,9 @@ + + + @@ -23,8 +26,12 @@ - + + + + + @@ -42,6 +49,7 @@ + @@ -49,6 +57,7 @@ + @@ -57,6 +66,7 @@ + @@ -64,6 +74,7 @@ + @@ -71,6 +82,7 @@ + @@ -78,6 +90,7 @@ + @@ -85,10 +98,17 @@ + - + + + + + + + @@ -98,6 +118,7 @@ + diff --git a/scripts/autorun.sc b/scripts/autorun.sc index 282e6db..4d7e61a 100644 --- a/scripts/autorun.sc +++ b/scripts/autorun.sc @@ -13,5 +13,4 @@ service -f nodegui start service -f serialgui start #service -f stackchart start #rflistener output CC2420 >> rfdata.txt -stop -#start +start diff --git a/se/sics/mspsim/Main.java b/se/sics/mspsim/Main.java index 31b73a9..7270aac 100644 --- a/se/sics/mspsim/Main.java +++ b/se/sics/mspsim/Main.java @@ -28,16 +28,12 @@ * * This file is part of MSPSim. * - * $Id$ - * * ----------------------------------------------------------------- * * Main * * Authors : Joakim Eriksson, Niclas Finne * Created : 6 nov 2008 - * Updated : $Date$ - * $Revision$ */ package se.sics.mspsim; @@ -104,7 +100,21 @@ public class Main { if (nodeType != null) { node = createNode(nodeType); } else { - platform = config.getProperty("platform", "sky"); + platform = config.getProperty("platform"); + if (platform == null) { + // Default platform + platform = "sky"; + + // Guess platform based on firmware filename suffix. + // TinyOS firmware files are often named 'main.exe'. + String[] a = config.getArguments(); + if (a.length > 0 && !"main.exe".equals(a[0])) { + int index = a[0].lastIndexOf('.'); + if (index > 0) { + platform = a[0].substring(index + 1); + } + } + } nodeType = getNodeTypeByPlatform(platform); node = createNode(nodeType); } diff --git a/se/sics/mspsim/cli/CommandHandler.java b/se/sics/mspsim/cli/CommandHandler.java index 22f5122..f8a44ca 100644 --- a/se/sics/mspsim/cli/CommandHandler.java +++ b/se/sics/mspsim/cli/CommandHandler.java @@ -4,7 +4,6 @@ import java.io.PrintStream; import java.util.ArrayList; import java.util.Arrays; import java.util.Hashtable; - import se.sics.mspsim.core.EmulationException; import se.sics.mspsim.util.ActiveComponent; import se.sics.mspsim.util.ComponentRegistry; @@ -32,7 +31,7 @@ public class CommandHandler implements ActiveComponent, LineListener { private MapTable getMapTable() { if (mapTable == null && registry != null) { - mapTable = (MapTable) registry.getComponent(MapTable.class); + mapTable = registry.getComponent(MapTable.class); } return mapTable; } @@ -42,6 +41,7 @@ public class CommandHandler implements ActiveComponent, LineListener { commands.put(cmd, command); } + @SuppressWarnings("resource") public int executeCommand(String commandLine, CommandContext context) { String[][] parts; final PrintStream cOut = context == null ? this.out : context.out; diff --git a/se/sics/mspsim/config/MSP430f1611Config.java b/se/sics/mspsim/config/MSP430f1611Config.java index 99e4dfc..79b8ee2 100644 --- a/se/sics/mspsim/config/MSP430f1611Config.java +++ b/se/sics/mspsim/config/MSP430f1611Config.java @@ -113,7 +113,7 @@ public class MSP430f1611Config extends MSP430Config { cpu.setIORange(0x080, 16, adc12); cpu.setIORange(0x140, 16, adc12); cpu.setIORange(0x150, 16, adc12); - cpu.setIORange(0x1a0, 8, adc12); + cpu.setIORange(0x1a0, 10, adc12); return 3 + 6; } diff --git a/se/sics/mspsim/config/MSP430f2617Config.java b/se/sics/mspsim/config/MSP430f2617Config.java index 6f450e9..cdd8d46 100644 --- a/se/sics/mspsim/config/MSP430f2617Config.java +++ b/se/sics/mspsim/config/MSP430f2617Config.java @@ -127,15 +127,20 @@ public class MSP430f2617Config extends MSP430Config { cpu.setIORange(0x080, 16, adc12); cpu.setIORange(0x140, 16, adc12); cpu.setIORange(0x150, 16, adc12); - cpu.setIORange(0x1a0, 8, adc12); + cpu.setIORange(0x1a0, 10, adc12); /* 4 usci units + 6 io port*/ return 4 + 6; } + @Override + public int getMaxClockSpeed() { + return 9000000; + } + @Override public String getAddressAsString(int addr) { return Utils.hex20(addr); } -} \ No newline at end of file +} diff --git a/se/sics/mspsim/core/BasicClockModule.java b/se/sics/mspsim/core/BasicClockModule.java index 4ebf955..307cd2b 100644 --- a/se/sics/mspsim/core/BasicClockModule.java +++ b/se/sics/mspsim/core/BasicClockModule.java @@ -57,9 +57,9 @@ public class BasicClockModule extends ClockSystem { // Max speed is 8Mhz (CPU limits it) - is max DCO 8Mhz? // Based on the scatterweb code it looks like less than // 5Mhz is more correct... - private static final int MAX_DCO_FRQ = 4915200; - private static final int MIN_DCO_FRQ = 1000; - private static final int DCO_FACTOR = (MAX_DCO_FRQ - MIN_DCO_FRQ) / 2048; + private final int MAX_DCO_FRQ; + private final int MIN_DCO_FRQ = 1000; + private final int DCO_FACTOR; private Timer[] timers; @@ -81,8 +81,11 @@ public class BasicClockModule extends ClockSystem { * Creates a new BasicClockModule instance. * */ - public BasicClockModule(MSP430Core core, int[] memory, int offset, Timer[] timers) { + public BasicClockModule(MSP430Core core, int[] memory, int offset, Timer[] timers, int maxClockSpeed) { + super("BasicClockModule", core, memory, offset); + MAX_DCO_FRQ = maxClockSpeed; + DCO_FACTOR = (MAX_DCO_FRQ - MIN_DCO_FRQ) / 2048; this.timers = timers; // reset(0); } diff --git a/se/sics/mspsim/core/Chip.java b/se/sics/mspsim/core/Chip.java index e23901c..ed91697 100644 --- a/se/sics/mspsim/core/Chip.java +++ b/se/sics/mspsim/core/Chip.java @@ -35,8 +35,6 @@ * Created : 17 jan 2008 */ package se.sics.mspsim.core; -import java.io.PrintStream; - import se.sics.mspsim.core.EmulationLogger.WarningType; import se.sics.mspsim.util.ArrayUtils; @@ -63,7 +61,6 @@ public abstract class Chip implements Loggable, EventSource { private int mode; private int chipState; protected EmulationLogger logger; - private PrintStream log; protected boolean DEBUG = false; protected int logLevel; diff --git a/se/sics/mspsim/core/MSP430.java b/se/sics/mspsim/core/MSP430.java index fe99de1..15dc730 100644 --- a/se/sics/mspsim/core/MSP430.java +++ b/se/sics/mspsim/core/MSP430.java @@ -146,7 +146,8 @@ public class MSP430 extends MSP430Core { isStopping = isBreaking = false; } - public long step() throws EmulationException { + /* Use stepInstructions or stepMicros instead */ + @Deprecated public long step() throws EmulationException { return stepMicros(1, 1); } @@ -156,16 +157,18 @@ public class MSP430 extends MSP430Core { } setRunning(true); try { - while (count-- > 0 && !isStopping) { + while (count > 0 && !isStopping) { int pc = emulateOP(-1); if (pc >= 0) { + count--; if (execCounter != null) { execCounter[pc]++; } if (trace != null) { trace[tracePos++] = pc; - if (tracePos >= trace.length) - tracePos = 0; + if (tracePos >= trace.length) { + tracePos = 0; + } } // ------------------------------------------------------------------- diff --git a/se/sics/mspsim/core/MSP430Config.java b/se/sics/mspsim/core/MSP430Config.java index 158cb32..40084d0 100644 --- a/se/sics/mspsim/core/MSP430Config.java +++ b/se/sics/mspsim/core/MSP430Config.java @@ -152,12 +152,16 @@ public abstract class MSP430Config { ramMirrorAddress = address; } + public int getMaxClockSpeed() { + return 4915200; + } + public void ioMemSize(int size) { maxMemIO = size; } public ClockSystem createClockSystem(MSP430Core cpu, int[] memory, Timer[] timers) { - return new BasicClockModule(cpu, memory, 0, timers); + return new BasicClockModule(cpu, memory, 0, timers, getMaxClockSpeed()); } } diff --git a/se/sics/mspsim/emulink/EmuLink.java b/se/sics/mspsim/emulink/EmuLink.java index 2dd042f..155af60 100755 --- a/se/sics/mspsim/emulink/EmuLink.java +++ b/se/sics/mspsim/emulink/EmuLink.java @@ -324,9 +324,8 @@ public class EmuLink { } } - public void run() throws IOException { - try { - ServerSocket serverSocket = new ServerSocket(8000); + public void run() { + try (ServerSocket serverSocket = new ServerSocket(8000)) { while(true) { @@ -356,7 +355,7 @@ public class EmuLink { } } - public static void main(String[] args) throws IOException { + public static void main(String[] args) { EmuLink el = new EmuLink(); el.run(); } diff --git a/se/sics/mspsim/platform/GenericNode.java b/se/sics/mspsim/platform/GenericNode.java index f41566a..1fbf72c 100644 --- a/se/sics/mspsim/platform/GenericNode.java +++ b/se/sics/mspsim/platform/GenericNode.java @@ -41,9 +41,7 @@ import java.io.IOException; import java.io.PrintStream; import java.net.URISyntaxException; import java.net.URL; - import javax.swing.JFrame; - import se.sics.mspsim.cli.CommandHandler; import se.sics.mspsim.cli.DebugCommands; import se.sics.mspsim.cli.FileCommands; @@ -54,7 +52,6 @@ import se.sics.mspsim.cli.StreamCommandHandler; import se.sics.mspsim.cli.WindowCommands; import se.sics.mspsim.core.Chip; import se.sics.mspsim.core.EmulationException; -import se.sics.mspsim.core.EmulationLogger; import se.sics.mspsim.core.MSP430; import se.sics.mspsim.core.MSP430Config; import se.sics.mspsim.core.MSP430Constants; @@ -67,7 +64,6 @@ import se.sics.mspsim.ui.WindowUtils; import se.sics.mspsim.util.ArgumentManager; import se.sics.mspsim.util.ComponentRegistry; import se.sics.mspsim.util.ConfigManager; -import se.sics.mspsim.util.DefaultEmulationLogger; import se.sics.mspsim.util.ELF; import se.sics.mspsim.util.IHexReader; import se.sics.mspsim.util.MapTable; @@ -140,17 +136,21 @@ public abstract class GenericNode extends Chip implements Runnable { } } - int[] memory = cpu.memory; if (firmwareFile.endsWith("ihex")) { // IHEX Reading + int[] memory = cpu.memory; IHexReader reader = new IHexReader(); reader.readFile(memory, firmwareFile); } else { - loadFirmware(firmwareFile, memory); + loadFirmware(firmwareFile); } - if (args.length > 1) { - MapTable map = new MapTable(args[1]); + config.setProperty("firmwareFile", firmwareFile); + + String mapFile = config.getProperty("map"); + if (mapFile != null) { + MapTable map = new MapTable(mapFile); cpu.getDisAsm().setMap(map); + cpu.setMap(map); registry.registerComponent("mapTable", map); } @@ -163,18 +163,16 @@ public abstract class GenericNode extends Chip implements Runnable { registry.registerComponent("controlgui", control); registry.registerComponent("stackchart", new StackUI(cpu)); HighlightSourceViewer sourceViewer = new HighlightSourceViewer(); - if (firmwareFile != null) { - // Add the firmware location to the search path - File fp = new File(firmwareFile).getParentFile(); - if (fp != null) { + // Add the firmware location to the search path + File fp = new File(firmwareFile).getParentFile(); + if (fp != null) { try { - // Get absolute path - fp = fp.getCanonicalFile(); + // Get absolute path + fp = fp.getCanonicalFile(); } catch (Exception e) { - // Ignore + // Ignore } sourceViewer.addSearchPath(fp); - } } control.setSourceViewer(sourceViewer); } @@ -183,7 +181,7 @@ public abstract class GenericNode extends Chip implements Runnable { if (script != null) { File fp = new File(script); if (fp.canRead()) { - CommandHandler ch = (CommandHandler) registry.getComponent("commandHandler"); + CommandHandler ch = registry.getComponent(CommandHandler.class, "commandHandler"); script = script.replace('\\', '/'); System.out.println("Autoloading script: " + script); config.setProperty("autoloadScript", script); @@ -192,7 +190,17 @@ public abstract class GenericNode extends Chip implements Runnable { } } } - config.setProperty("firmwareFile", firmwareFile); + + if (args.length > 1) { + // Run the following arguments as commands + CommandHandler ch = registry.getComponent(CommandHandler.class, "commandHandler"); + if (ch != null) { + for (int i = 1; i < args.length; i++) { + System.out.println("calling '" + args[i] + "'"); + ch.lineRead(args[i]); + } + } + } System.out.println("-----------------------------------------------"); System.out.println("MSPSim " + MSP430Constants.VERSION + " starting firmware: " + firmwareFile); System.out.println("-----------------------------------------------"); @@ -276,11 +284,9 @@ public abstract class GenericNode extends Chip implements Runnable { public void stop() { cpu.stop(); } - + public void step() throws EmulationException { - if (!cpu.isRunning()) { - cpu.step(); - } + step(1); } // A step that will break out of breakpoints! diff --git a/se/sics/mspsim/ui/DebugUI.java b/se/sics/mspsim/ui/DebugUI.java index 98e601d..a8b96e5 100644 --- a/se/sics/mspsim/ui/DebugUI.java +++ b/se/sics/mspsim/ui/DebugUI.java @@ -47,19 +47,19 @@ import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JPanel; import javax.swing.ListCellRenderer; - -import se.sics.mspsim.core.*; +import se.sics.mspsim.core.DbgInstruction; +import se.sics.mspsim.core.DisAsm; +import se.sics.mspsim.core.MSP430; import se.sics.mspsim.util.Utils; public class DebugUI extends JPanel { private static final long serialVersionUID = 2123628878332126912L; - private JList disList; + private JList disList; + private DbgListModel listModel; private JLabel[] regsLabel; private MSP430 cpu; - private DbgListModel listModel; - private int currentAddress = 0; private DisAsm disAsm; @@ -76,7 +76,8 @@ public class DebugUI extends JPanel { this.cpu = cpu; disAsm = cpu.getDisAsm(); - disList = new JList(listModel = new DbgListModel()); + listModel = new DbgListModel(); + disList = new JList(listModel); disList.setFont(new Font("courier", 0, 12)); disList.setCellRenderer(new MyCellRenderer()); disList.setPreferredSize(new Dimension(500, 350)); @@ -102,7 +103,7 @@ public class DebugUI extends JPanel { repaint(); } - private class DbgListModel extends AbstractListModel { + private class DbgListModel extends AbstractListModel { private static final long serialVersionUID = -2856626511548201481L; int startPos = -1; @@ -111,44 +112,36 @@ public class DebugUI extends JPanel { DbgInstruction[] instructions = new DbgInstruction[size]; - // 64K Dbg instructions... - // private DbgInstruction[] instrs = new DbgInstruction[0x10000]; - - public void setCurrentAddress(int address) { - startPos = address; - } - // ------------------------------------------------------------------- // ListAPI // ------------------------------------------------------------------- + @Override public int getSize() { return size; } private void checkPC() { - int pc = cpu.reg[MSP430Core.PC]; + int pc = cpu.getPC(); if (pc < startPos || pc > endPos) { startPos = pc; // recalculate index!!! with PC at the top of the "page" int currentPos = pc; - DbgInstruction inst; for (int i = 0, n = size; i < n; i++) { - if (cpu.getExecCount(currentPos) != 0 || true) { - inst = disAsm.getDbgInstruction(currentPos, cpu); - inst.setPos(currentPos); - currentPos += inst.getSize(); - } else { - inst = new DbgInstruction(); - inst.setASMLine(" " + Utils.hex16(currentPos) + " " + - Utils.hex8(cpu.memory[currentPos]) + " " + - Utils.hex8(cpu.memory[currentPos + 1]) + - " .word " + Utils.hex8(cpu.memory[currentPos]) + - Utils.hex8(cpu.memory[currentPos + 1])); - inst.setPos(currentPos); - currentPos += 2; - } - instructions[i] = inst; +// if (cpu.getExecCount(currentPos) == 0) { +// inst = new DbgInstruction(); +// inst.setInstruction(cpu.memory[currentPos] + (cpu.memory[currentPos + 1] << 8), 2); +// inst.setASMLine(" " + Utils.hex(currentPos, 4) + " " + +// Utils.hex8(cpu.memory[currentPos]) + " " + +// Utils.hex8(cpu.memory[currentPos + 1]) + +// " .word " + Utils.hex8(cpu.memory[currentPos]) + +// Utils.hex8(cpu.memory[currentPos + 1])); +// } else { + + DbgInstruction inst = disAsm.getDbgInstruction(currentPos, cpu); + inst.setPos(currentPos); + currentPos += inst.getSize(); + instructions[i] = inst; } endPos = currentPos; } @@ -157,13 +150,14 @@ public class DebugUI extends JPanel { // Should cache the current 20 (or size) instructions to get a faster // version of this... // And have a call to "update" instead... - public Object getElementAt(int index) { + @Override + public DbgInstruction getElementAt(int index) { checkPC(); return instructions[index]; } } - class MyCellRenderer extends JLabel implements ListCellRenderer { + class MyCellRenderer extends JLabel implements ListCellRenderer { private static final long serialVersionUID = -2633138712695105181L; @@ -171,36 +165,32 @@ public class DebugUI extends JPanel { setOpaque(true); } + @Override public Component getListCellRendererComponent( - JList list, - Object value, // value to display + JList list, + DbgInstruction instruction, // instruct to display int index, // cell index boolean isSelected, // is the cell selected boolean cellHasFocus) // the list and the cell have the focus { String s; int pos = 0; - if (value == null) { - s = "---"; + if (instruction == null) { + s = "---"; } else { - if (value instanceof DbgInstruction) { - DbgInstruction i = (DbgInstruction) value; - s = i.getASMLine(false); - if (i.getFunction() != null) { - s += "; " + i.getFunction(); - } - pos = i.getPos(); + pos = instruction.getPos(); + s = instruction.getASMLine(false); if (cpu.hasWatchPoint(pos)) { s = "*B " + s; } else { s = " " + s; } - } else { - s = value.toString(); - } + if (instruction.getFunction() != null) { + s += "; " + instruction.getFunction(); + } } setText(s); - if (pos == cpu.reg[MSP430Core.PC]) { + if (pos == cpu.getPC()) { setBackground(Color.green); } else { if (isSelected) { diff --git a/se/sics/mspsim/util/ArgumentManager.java b/se/sics/mspsim/util/ArgumentManager.java index 6623852..5de9524 100644 --- a/se/sics/mspsim/util/ArgumentManager.java +++ b/se/sics/mspsim/util/ArgumentManager.java @@ -76,6 +76,13 @@ public class ArgumentManager extends ConfigManager { ArrayList list = new ArrayList(); ArrayList config = new ArrayList(); for (int i = 0, n = args.length; i < n; i++) { + if ("-".equals(args[i])) { + // The rest should be considered arguments + for(++i; i < args.length; i++) { + list.add(args[i]); + } + break; + } if (args[i].startsWith("-")) { String param = args[i].substring(1); String value = "";