You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(21) |
Nov
(12) |
Dec
(41) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(25) |
Feb
(54) |
Mar
(63) |
Apr
(52) |
May
(17) |
Jun
(3) |
Jul
(3) |
Aug
(5) |
Sep
(49) |
Oct
(50) |
Nov
(34) |
Dec
(14) |
2009 |
Jan
(9) |
Feb
(15) |
Mar
(38) |
Apr
(12) |
May
(35) |
Jun
(20) |
Jul
(2) |
Aug
(7) |
Sep
(36) |
Oct
(24) |
Nov
(2) |
Dec
(2) |
2010 |
Jan
(14) |
Feb
(1) |
Mar
(36) |
Apr
(2) |
May
(4) |
Jun
(6) |
Jul
(35) |
Aug
(11) |
Sep
(8) |
Oct
(3) |
Nov
|
Dec
(1) |
2011 |
Jan
(11) |
Feb
(12) |
Mar
(3) |
Apr
(7) |
May
(12) |
Jun
(8) |
Jul
|
Aug
(3) |
Sep
(4) |
Oct
|
Nov
(2) |
Dec
(4) |
2012 |
Jan
(2) |
Feb
(1) |
Mar
(14) |
Apr
(5) |
May
(28) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(21) |
Nov
(4) |
Dec
(1) |
2013 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2014 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <jo...@us...> - 2009-09-13 19:37:27
|
Revision: 612 http://mspsim.svn.sourceforge.net/mspsim/?rev=612&view=rev Author: joxe Date: 2009-09-13 19:37:19 +0000 (Sun, 13 Sep 2009) Log Message: ----------- added argument to sysinfo Modified Paths: -------------- mspsim/se/sics/mspsim/cli/CommandContext.java mspsim/se/sics/mspsim/cli/MiscCommands.java Modified: mspsim/se/sics/mspsim/cli/CommandContext.java =================================================================== --- mspsim/se/sics/mspsim/cli/CommandContext.java 2009-09-13 19:23:10 UTC (rev 611) +++ mspsim/se/sics/mspsim/cli/CommandContext.java 2009-09-13 19:37:19 UTC (rev 612) @@ -174,6 +174,15 @@ } } + public boolean getOption(String optionName) { + for (int i = 0; i < args.length; i++) { + if (args[i].equals("-" + optionName)) { + return true; + } + } + return false; + } + public boolean getArgumentAsBoolean(int index) { String v = getArgument(index); return "true".equalsIgnoreCase(v) || "1".equals(v); Modified: mspsim/se/sics/mspsim/cli/MiscCommands.java =================================================================== --- mspsim/se/sics/mspsim/cli/MiscCommands.java 2009-09-13 19:23:10 UTC (rev 611) +++ mspsim/se/sics/mspsim/cli/MiscCommands.java 2009-09-13 19:37:19 UTC (rev 612) @@ -388,16 +388,20 @@ } }); - handler.registerCommand("sysinfo", new BasicCommand("show info about the MSPSim system", "") { + handler.registerCommand("sysinfo", new BasicCommand("show info about the MSPSim system", "[-registry]") { public int executeCommand(CommandContext context) { ArgumentManager config = (ArgumentManager) registry.getComponent("config"); context.out.println("--------- System info ----------\n"); context.out.println("MSPSim version: " + MSP430Constants.VERSION); + context.out.println("Java version : " + System.getProperty("java.version") + " " + + System.getProperty("java.vendor")); context.out.println("Firmware : " + config.getProperty("firmwareFile")); context.out.println("AutoloadScript: " + config.getProperty("autoloadScript")); context.out.println(); - context.out.println("--------- Registry info --------\n"); - registry.printRegistry(context.out); + if (context.getOption("registry")) { + context.out.println("--------- Registry info --------\n"); + registry.printRegistry(context.out); + } return 0; } }); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2009-09-13 19:23:17
|
Revision: 611 http://mspsim.svn.sourceforge.net/mspsim/?rev=611&view=rev Author: joxe Date: 2009-09-13 19:23:10 +0000 (Sun, 13 Sep 2009) Log Message: ----------- moved quit command and added verbose to source Modified Paths: -------------- mspsim/se/sics/mspsim/cli/MiscCommands.java Modified: mspsim/se/sics/mspsim/cli/MiscCommands.java =================================================================== --- mspsim/se/sics/mspsim/cli/MiscCommands.java 2009-09-11 12:13:59 UTC (rev 610) +++ mspsim/se/sics/mspsim/cli/MiscCommands.java 2009-09-13 19:23:10 UTC (rev 611) @@ -147,14 +147,6 @@ } }); - handler.registerCommand("quit", new BasicCommand("exit MSPSim", "") { - public int executeCommand(CommandContext context) { - /* TODO: flush all files, etc.... */ - System.exit(0); - return 0; - } - }); - handler.registerCommand("echo", new BasicCommand("echo arguments", "") { public int executeCommand(CommandContext context) { StringBuilder sb = new StringBuilder(); @@ -169,9 +161,13 @@ - handler.registerCommand("source", new BasicCommand("run script", "<filename>") { + handler.registerCommand("source", new BasicCommand("run script", "[-v] <filename>") { public int executeCommand(CommandContext context) { - File fp = new File(context.getArgument(0)); + boolean verbose = false; + if (context.getArgumentCount() > 1) { + verbose = "-v".equals(context.getArgument(0)); + } + File fp = new File(context.getArgument(context.getArgumentCount() - 1)); if (!fp.canRead()) { context.err.println("could not find the script file '" + context.getArgument(0) + "'."); return 1; @@ -182,6 +178,7 @@ try { String line; while ((line = input.readLine()) != null) { + if (verbose) context.out.println(line); context.executeCommand(line); } } finally { @@ -405,6 +402,14 @@ } }); + handler.registerCommand("quit", new BasicCommand("exit MSPSim", "") { + public int executeCommand(CommandContext context) { + /* TODO: flush all files, etc.... */ + System.exit(0); + return 0; + } + }); + handler.registerCommand("exit", new BasicCommand("exit MSPSim", "") { public int executeCommand(CommandContext context) { System.exit(0); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2009-09-11 13:22:27
|
Revision: 610 http://mspsim.svn.sourceforge.net/mspsim/?rev=610&view=rev Author: joxe Date: 2009-09-11 12:13:59 +0000 (Fri, 11 Sep 2009) Log Message: ----------- fixed buggy script Modified Paths: -------------- mspsim/scripts/duty.sc Modified: mspsim/scripts/duty.sc =================================================================== --- mspsim/scripts/duty.sc 2009-09-10 17:27:44 UTC (rev 609) +++ mspsim/scripts/duty.sc 2009-09-11 12:13:59 UTC (rev 610) @@ -1,8 +1,7 @@ -echo "#!type line" >#duty -duty 10 "MSP430 Core.active" CC2420.listen CC2420.transmit "Tmote Sky.0" >#duty -echo "#!" -echo "#!set 0 label CPU" >#duty -echo "#!set 1 label Listen" >#duty -echo "#!set 2 label Transmit" >#duty -echo "#!set 3 label LEDS" >#duty -echo "#!title Duty Cycle" >#duty \ No newline at end of file +echo "#!type line" | window duty +duty 10 "MSP430 Core.active" CC2420.listen CC2420.transmit "Tmote Sky.0" | window duty +echo "#!set 0 label CPU" | window duty +echo "#!set 1 label Listen" | window duty +echo "#!set 2 label Transmit" | window duty +echo "#!set 3 label LEDS" | window duty +echo "#!title Duty Cycle" | window duty \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2009-09-10 17:27:51
|
Revision: 609 http://mspsim.svn.sourceforge.net/mspsim/?rev=609&view=rev Author: nifi Date: 2009-09-10 17:27:44 +0000 (Thu, 10 Sep 2009) Log Message: ----------- fixed typo Modified Paths: -------------- mspsim/se/sics/mspsim/cli/DebugCommands.java Modified: mspsim/se/sics/mspsim/cli/DebugCommands.java =================================================================== --- mspsim/se/sics/mspsim/cli/DebugCommands.java 2009-09-10 17:25:31 UTC (rev 608) +++ mspsim/se/sics/mspsim/cli/DebugCommands.java 2009-09-10 17:27:44 UTC (rev 609) @@ -214,7 +214,7 @@ } }); - ch.registerCommand("line", new BasicCommand("print line number of address/symbol", "<addres or symbol>") { + ch.registerCommand("line", new BasicCommand("print line number of address/symbol", "<address or symbol>") { public int executeCommand(final CommandContext context) { int adr = context.getArgumentAsAddress(0); DebugInfo di = getELF().getDebugInfo(adr); @@ -242,7 +242,7 @@ return 0; } }); - ch.registerCommand("step", new BasicCommand("singlestep the CPU", "[number of instructions]") { + ch.registerCommand("step", new BasicCommand("single step the CPU", "[number of instructions]") { public int executeCommand(CommandContext context) { int nr = context.getArgumentCount() > 0 ? context.getArgumentAsInt(0) : 1; long cyc = cpu.cycles; @@ -311,7 +311,7 @@ } }); - ch.registerCommand("mem", new BasicCommand("dump memory", "<start address> <num_emtries> [type]") { + ch.registerCommand("mem", new BasicCommand("dump memory", "<start address> <num_entries> [type]") { public int executeCommand(final CommandContext context) { int start = context.getArgumentAsAddress(0); int count = context.getArgumentAsInt(1); @@ -358,7 +358,7 @@ /****************************************************** * handle external memory (flash, etc). ******************************************************/ - ch.registerCommand("xmem", new BasicCommand("dump flash memory", "<start address> <num_emtries> [type]") { + ch.registerCommand("xmem", new BasicCommand("dump flash memory", "<start address> <num_entries> [type]") { public int executeCommand(final CommandContext context) { Memory xmem = (Memory) DebugCommands.this.registry.getComponent("xmem"); if (xmem == null) { @@ -417,7 +417,7 @@ private GDBStubs stubs = null; public int executeCommand(CommandContext context) { if (stubs != null) { - context.err.println("GDBStubs alread openend"); + context.err.println("GDBStubs already open"); } else { int port = context.getArgumentAsInt(0); stubs = new GDBStubs(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2009-09-10 17:25:40
|
Revision: 608 http://mspsim.svn.sourceforge.net/mspsim/?rev=608&view=rev Author: joxe Date: 2009-09-10 17:25:31 +0000 (Thu, 10 Sep 2009) Log Message: ----------- added exit command Modified Paths: -------------- mspsim/se/sics/mspsim/cli/MiscCommands.java Modified: mspsim/se/sics/mspsim/cli/MiscCommands.java =================================================================== --- mspsim/se/sics/mspsim/cli/MiscCommands.java 2009-09-10 17:15:22 UTC (rev 607) +++ mspsim/se/sics/mspsim/cli/MiscCommands.java 2009-09-10 17:25:31 UTC (rev 608) @@ -404,6 +404,14 @@ return 0; } }); + + handler.registerCommand("exit", new BasicCommand("exit MSPSim", "") { + public int executeCommand(CommandContext context) { + System.exit(0); + return 0; + } + }); + } private static ServiceComponent getServiceForName(ComponentRegistry registry, String name) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2009-09-10 17:15:30
|
Revision: 607 http://mspsim.svn.sourceforge.net/mspsim/?rev=607&view=rev Author: joxe Date: 2009-09-10 17:15:22 +0000 (Thu, 10 Sep 2009) Log Message: ----------- added window pack when adding a panel to ManagedWindows Modified Paths: -------------- mspsim/se/sics/mspsim/ui/JFrameWindowManager.java mspsim/se/sics/mspsim/ui/StackUI.java Modified: mspsim/se/sics/mspsim/ui/JFrameWindowManager.java =================================================================== --- mspsim/se/sics/mspsim/ui/JFrameWindowManager.java 2009-09-10 16:15:07 UTC (rev 606) +++ mspsim/se/sics/mspsim/ui/JFrameWindowManager.java 2009-09-10 17:15:22 UTC (rev 607) @@ -17,6 +17,7 @@ WindowUtils.addSaveOnShutdown(name, window); } window.add(component); + window.pack(); } public void setVisible(boolean b) { window.setVisible(b); Modified: mspsim/se/sics/mspsim/ui/StackUI.java =================================================================== --- mspsim/se/sics/mspsim/ui/StackUI.java 2009-09-10 16:15:07 UTC (rev 606) +++ mspsim/se/sics/mspsim/ui/StackUI.java 2009-09-10 17:15:22 UTC (rev 607) @@ -133,6 +133,7 @@ chartPanel.setAxisChart(maxStackChart); add(chartPanel, BorderLayout.CENTER); + chartPanel.setMinimumSize(new Dimension(320, 200)); setPreferredSize(new Dimension(320, 200)); setSize(320, 200); setMinimumSize(new Dimension(320, 200)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2009-09-10 16:15:16
|
Revision: 606 http://mspsim.svn.sourceforge.net/mspsim/?rev=606&view=rev Author: joxe Date: 2009-09-10 16:15:07 +0000 (Thu, 10 Sep 2009) Log Message: ----------- made stackui a service Modified Paths: -------------- mspsim/scripts/autorun.sc mspsim/se/sics/mspsim/platform/GenericNode.java mspsim/se/sics/mspsim/ui/ControlUI.java mspsim/se/sics/mspsim/ui/StackUI.java Modified: mspsim/scripts/autorun.sc =================================================================== --- mspsim/scripts/autorun.sc 2009-09-10 15:53:33 UTC (rev 605) +++ mspsim/scripts/autorun.sc 2009-09-10 16:15:07 UTC (rev 606) @@ -11,4 +11,5 @@ #start the nodegui serice service controlgui start service nodegui start +service stackui start start Modified: mspsim/se/sics/mspsim/platform/GenericNode.java =================================================================== --- mspsim/se/sics/mspsim/platform/GenericNode.java 2009-09-10 15:53:33 UTC (rev 605) +++ mspsim/se/sics/mspsim/platform/GenericNode.java 2009-09-10 16:15:07 UTC (rev 606) @@ -59,6 +59,7 @@ import se.sics.mspsim.extutil.highlight.HighlightSourceViewer; import se.sics.mspsim.ui.ControlUI; import se.sics.mspsim.ui.JFrameWindowManager; +import se.sics.mspsim.ui.StackUI; import se.sics.mspsim.util.ArgumentManager; import se.sics.mspsim.util.ComponentRegistry; import se.sics.mspsim.util.ConfigManager; @@ -146,6 +147,7 @@ // Setup control and other UI components ControlUI control = new ControlUI(); registry.registerComponent("controlgui", control); + registry.registerComponent("stackui", new StackUI(cpu)); HighlightSourceViewer sourceViewer = new HighlightSourceViewer(); if (firmwareFile != null) { // Add the firmware location to the search path Modified: mspsim/se/sics/mspsim/ui/ControlUI.java =================================================================== --- mspsim/se/sics/mspsim/ui/ControlUI.java 2009-09-10 15:53:33 UTC (rev 605) +++ mspsim/se/sics/mspsim/ui/ControlUI.java 2009-09-10 16:15:07 UTC (rev 606) @@ -49,35 +49,29 @@ import javax.swing.AbstractAction; import javax.swing.Action; import javax.swing.JButton; -import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.KeyStroke; import se.sics.mspsim.core.MSP430; import se.sics.mspsim.core.MSP430Constants; import se.sics.mspsim.core.SimEvent; import se.sics.mspsim.core.SimEventListener; -import se.sics.mspsim.extutil.jfreechart.DataChart; import se.sics.mspsim.platform.GenericNode; import se.sics.mspsim.util.ComponentRegistry; import se.sics.mspsim.util.DebugInfo; import se.sics.mspsim.util.ELF; import se.sics.mspsim.util.ServiceComponent; -import se.sics.mspsim.util.ServiceComponent.Status; public class ControlUI extends JPanel implements ActionListener, SimEventListener, ServiceComponent { private static final long serialVersionUID = -2431892192775232653L; private static final String TITLE = "MSPSim monitor"; - private static final boolean USE_STACKUI = false; private ManagedWindow window; private JButton controlButton; private MSP430 cpu; private GenericNode node; private DebugUI dui; - private JFrame stackWindow; - private StackUI stackUI; private ELF elfData; private SourceViewer sourceViewer; @@ -99,16 +93,6 @@ this.node = (GenericNode) registry.getComponent("node"); elfData = (ELF) registry.getComponent("elf"); - DataChart test = new DataChart("Stack Monitor", "Bytes"); - test.setupStackFrame(cpu); - if (USE_STACKUI) { - this.stackUI = new StackUI(cpu); - stackWindow = new JFrame("Stack"); - stackWindow.add(this.stackUI); - WindowUtils.restoreWindowBounds("StackUI", stackWindow); - WindowUtils.addSaveOnShutdown("StackUI", stackWindow); - stackWindow.setVisible(true); - } WindowManager wm = (WindowManager) registry.getComponent("windowManager"); window = wm.createWindow("ControlUI"); JPanel jp = new JPanel(); Modified: mspsim/se/sics/mspsim/ui/StackUI.java =================================================================== --- mspsim/se/sics/mspsim/ui/StackUI.java 2009-09-10 15:53:33 UTC (rev 605) +++ mspsim/se/sics/mspsim/ui/StackUI.java 2009-09-10 16:15:07 UTC (rev 606) @@ -49,9 +49,12 @@ import se.sics.mspsim.core.CPUMonitor; import se.sics.mspsim.core.MSP430; +import se.sics.mspsim.util.ComponentRegistry; import se.sics.mspsim.util.MapTable; +import se.sics.mspsim.util.ServiceComponent; +import se.sics.mspsim.util.ServiceComponent.Status; -public class StackUI extends JPanel implements CPUMonitor { +public class StackUI extends JPanel implements CPUMonitor, ServiceComponent { private static final long serialVersionUID = 8648239617509299768L; @@ -77,6 +80,14 @@ private boolean update = false; +private Status status; + +private ComponentRegistry registry; + +private ManagedWindow window; + +private String name; + public StackUI(MSP430 cpu) { this(cpu, 2500); } @@ -102,29 +113,37 @@ // this.stackStartAddress - this.heapStartAddress); // diagram.setShowGrid(true); // add(diagram, BorderLayout.CENTER); - chartPanel = new ChartPanel(); + } - ConstantLineChart maxChart = new ConstantLineChart("Max", this.stackStartAddress - this.heapStartAddress); - maxChart.setConfig("color", Color.red); - chartPanel.addChart(maxChart); + private void setup() { + if (chartPanel != null) return; + chartPanel = new ChartPanel(); - minStackChart = new LineChart("Min Stack"); - minStackChart.setConfig("color", Color.green); - chartPanel.addChart(minStackChart); + ConstantLineChart maxChart = new ConstantLineChart("Max", this.stackStartAddress - this.heapStartAddress); + maxChart.setConfig("color", Color.red); + chartPanel.addChart(maxChart); - maxStackChart = new LineChart("Max Stack"); - maxStackChart.setConfig("color", Color.green); - chartPanel.addChart(maxStackChart); - chartPanel.setAxisChart(maxStackChart); + minStackChart = new LineChart("Min Stack"); + minStackChart.setConfig("color", Color.green); + chartPanel.addChart(minStackChart); - add(chartPanel, BorderLayout.CENTER); - setPreferredSize(new Dimension(320, 200)); + maxStackChart = new LineChart("Max Stack"); + maxStackChart.setConfig("color", Color.green); + chartPanel.addChart(maxStackChart); + chartPanel.setAxisChart(maxStackChart); + + add(chartPanel, BorderLayout.CENTER); + setPreferredSize(new Dimension(320, 200)); + setSize(320, 200); + setMinimumSize(new Dimension(320, 200)); + + WindowManager wm = (WindowManager) registry.getComponent("windowManager"); + if (wm != null) { + window = wm.createWindow("stackui"); + window.add(this); + } } -// public void addNote(String note) { -// notes[pos] = note; -// } - public void paint(Graphics g) { if (update) { update = false; @@ -174,4 +193,28 @@ } } +public Status getStatus() { + return status; } + +public void init(String name, ComponentRegistry registry) { + this.registry = registry; + this.name = name; +} + +public String getName() { + return name; +} + +public void start() { + setup(); + status = Status.STARTED; + window.setVisible(true); +} + +public void stop() { + status = Status.STOPPED; + window.setVisible(false); +} + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2009-09-10 15:53:46
|
Revision: 605 http://mspsim.svn.sourceforge.net/mspsim/?rev=605&view=rev Author: joxe Date: 2009-09-10 15:53:33 +0000 (Thu, 10 Sep 2009) Log Message: ----------- fixed controlgui to be a service Modified Paths: -------------- mspsim/scripts/autorun.sc mspsim/se/sics/mspsim/platform/GenericNode.java mspsim/se/sics/mspsim/ui/ControlUI.java mspsim/se/sics/mspsim/ui/JFrameWindowManager.java mspsim/se/sics/mspsim/ui/ManagedWindow.java Modified: mspsim/scripts/autorun.sc =================================================================== --- mspsim/scripts/autorun.sc 2009-09-10 15:31:21 UTC (rev 604) +++ mspsim/scripts/autorun.sc 2009-09-10 15:53:33 UTC (rev 605) @@ -9,5 +9,6 @@ # contikichecker #start the nodegui serice +service controlgui start service nodegui start start Modified: mspsim/se/sics/mspsim/platform/GenericNode.java =================================================================== --- mspsim/se/sics/mspsim/platform/GenericNode.java 2009-09-10 15:31:21 UTC (rev 604) +++ mspsim/se/sics/mspsim/platform/GenericNode.java 2009-09-10 15:53:33 UTC (rev 605) @@ -144,7 +144,8 @@ if (!config.getPropertyAsBoolean("nogui", false)) { // Setup control and other UI components - ControlUI control = new ControlUI(registry); + ControlUI control = new ControlUI(); + registry.registerComponent("controlgui", control); HighlightSourceViewer sourceViewer = new HighlightSourceViewer(); if (firmwareFile != null) { // Add the firmware location to the search path Modified: mspsim/se/sics/mspsim/ui/ControlUI.java =================================================================== --- mspsim/se/sics/mspsim/ui/ControlUI.java 2009-09-10 15:31:21 UTC (rev 604) +++ mspsim/se/sics/mspsim/ui/ControlUI.java 2009-09-10 15:53:33 UTC (rev 605) @@ -61,15 +61,17 @@ import se.sics.mspsim.util.ComponentRegistry; import se.sics.mspsim.util.DebugInfo; import se.sics.mspsim.util.ELF; +import se.sics.mspsim.util.ServiceComponent; +import se.sics.mspsim.util.ServiceComponent.Status; -public class ControlUI extends JPanel implements ActionListener, SimEventListener { +public class ControlUI extends JPanel implements ActionListener, SimEventListener, ServiceComponent { private static final long serialVersionUID = -2431892192775232653L; private static final String TITLE = "MSPSim monitor"; private static final boolean USE_STACKUI = false; - private JFrame window; + private ManagedWindow window; private JButton controlButton; private MSP430 cpu; private GenericNode node; @@ -81,9 +83,18 @@ private SourceViewer sourceViewer; private Action stepAction; + private ComponentRegistry registry; - public ControlUI(ComponentRegistry registry) { - super(new GridLayout(0, 1)); +private Status status; + +private String name; + + public ControlUI() { + super(new GridLayout(0, 1)); + }; + + private void setup() { + if (window != null) return; this.cpu = (MSP430) registry.getComponent("cpu"); this.node = (GenericNode) registry.getComponent("node"); elfData = (ELF) registry.getComponent("elf"); @@ -98,15 +109,15 @@ WindowUtils.addSaveOnShutdown("StackUI", stackWindow); stackWindow.setVisible(true); } + WindowManager wm = (WindowManager) registry.getComponent("windowManager"); + window = wm.createWindow("ControlUI"); + JPanel jp = new JPanel(); + jp.setLayout(new BorderLayout()); - window = new JFrame(TITLE); -// window.setSize(320,240); - window.setLayout(new BorderLayout()); - window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - - window.add(this, BorderLayout.WEST); - window.add(dui = new DebugUI(cpu), BorderLayout.CENTER); - + jp.add(this, BorderLayout.WEST); + jp.add(dui = new DebugUI(cpu), BorderLayout.CENTER); + window.add(jp); + createButton("Debug On"); controlButton = createButton(cpu.isRunning() ? "Stop" : "Run"); stepAction = new AbstractAction("Single Step") { @@ -157,8 +168,6 @@ cpu.addSimEventListener(this); - WindowUtils.restoreWindowBounds("ControlUI", window); - WindowUtils.addSaveOnShutdown("ControlUI", window); window.setVisible(true); } @@ -247,4 +256,29 @@ break; } } + + @Override + public Status getStatus() { + return status; + } + + public String getName() { + return name; + } + + public void init(String name, ComponentRegistry registry) { + this.name = name; + this.registry = registry; + } + + public void start() { + setup(); + status = Status.STARTED; + window.setVisible(true); + } + + public void stop() { + status = Status.STOPPED; + window.setVisible(false); + } } Modified: mspsim/se/sics/mspsim/ui/JFrameWindowManager.java =================================================================== --- mspsim/se/sics/mspsim/ui/JFrameWindowManager.java 2009-09-10 15:31:21 UTC (rev 604) +++ mspsim/se/sics/mspsim/ui/JFrameWindowManager.java 2009-09-10 15:53:33 UTC (rev 605) @@ -21,6 +21,9 @@ public void setVisible(boolean b) { window.setVisible(b); } + public void setTitle(String name) { + window.setTitle(name); + } }; return w; } Modified: mspsim/se/sics/mspsim/ui/ManagedWindow.java =================================================================== --- mspsim/se/sics/mspsim/ui/ManagedWindow.java 2009-09-10 15:31:21 UTC (rev 604) +++ mspsim/se/sics/mspsim/ui/ManagedWindow.java 2009-09-10 15:53:33 UTC (rev 605) @@ -8,4 +8,6 @@ public void setVisible(boolean b); + public void setTitle(String string); + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2009-09-10 15:31:30
|
Revision: 604 http://mspsim.svn.sourceforge.net/mspsim/?rev=604&view=rev Author: joxe Date: 2009-09-10 15:31:21 +0000 (Thu, 10 Sep 2009) Log Message: ----------- renamed skygui to nodegui and added start of gui in autostart script Modified Paths: -------------- mspsim/scripts/autorun.sc mspsim/se/sics/mspsim/platform/sky/MoteIVNode.java Modified: mspsim/scripts/autorun.sc =================================================================== --- mspsim/scripts/autorun.sc 2009-09-10 15:26:02 UTC (rev 603) +++ mspsim/scripts/autorun.sc 2009-09-10 15:31:21 UTC (rev 604) @@ -8,4 +8,6 @@ # install ContikiChecker # contikichecker +#start the nodegui serice +service nodegui start start Modified: mspsim/se/sics/mspsim/platform/sky/MoteIVNode.java =================================================================== --- mspsim/se/sics/mspsim/platform/sky/MoteIVNode.java 2009-09-10 15:26:02 UTC (rev 603) +++ mspsim/se/sics/mspsim/platform/sky/MoteIVNode.java 2009-09-10 15:31:21 UTC (rev 604) @@ -191,7 +191,7 @@ if (!config.getPropertyAsBoolean("nogui", true)) { gui = new SkyGui(this); - registry.registerComponent("skygui", gui); + registry.registerComponent("nodegui", gui); // A HACK for some "graphs"!!! DataChart dataChart = new DataChart("Duty Cycle", "Duty Cycle"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2009-09-10 15:26:11
|
Revision: 603 http://mspsim.svn.sourceforge.net/mspsim/?rev=603&view=rev Author: joxe Date: 2009-09-10 15:26:02 +0000 (Thu, 10 Sep 2009) Log Message: ----------- Created window manager and registered it in registry Modified Paths: -------------- mspsim/se/sics/mspsim/platform/GenericNode.java mspsim/se/sics/mspsim/platform/sky/SkyGui.java Added Paths: ----------- mspsim/se/sics/mspsim/ui/JFrameWindowManager.java Modified: mspsim/se/sics/mspsim/platform/GenericNode.java =================================================================== --- mspsim/se/sics/mspsim/platform/GenericNode.java 2009-09-10 13:55:37 UTC (rev 602) +++ mspsim/se/sics/mspsim/platform/GenericNode.java 2009-09-10 15:26:02 UTC (rev 603) @@ -58,6 +58,7 @@ import se.sics.mspsim.core.MSP430Constants; import se.sics.mspsim.extutil.highlight.HighlightSourceViewer; import se.sics.mspsim.ui.ControlUI; +import se.sics.mspsim.ui.JFrameWindowManager; import se.sics.mspsim.util.ArgumentManager; import se.sics.mspsim.util.ComponentRegistry; import se.sics.mspsim.util.ConfigManager; @@ -209,6 +210,7 @@ registry.registerComponent("wincmd", new WindowCommands()); registry.registerComponent("profilecmd", new ProfilerCommands()); registry.registerComponent("netcmd", new NetCommands()); + registry.registerComponent("windowManager", new JFrameWindowManager()); // Monitor execution cpu.setMonitorExec(true); Modified: mspsim/se/sics/mspsim/platform/sky/SkyGui.java =================================================================== --- mspsim/se/sics/mspsim/platform/sky/SkyGui.java 2009-09-10 13:55:37 UTC (rev 602) +++ mspsim/se/sics/mspsim/platform/sky/SkyGui.java 2009-09-10 15:26:02 UTC (rev 603) @@ -117,12 +117,10 @@ setPreferredSize(new Dimension(skyImage.getIconWidth(), skyImage.getIconHeight())); - WindowManager wm = (WindowManager) registry.getComponent("WindowManager"); - window = wm.createWindow("Sky"); -// window.setSize(190,240); + WindowManager wm = (WindowManager) registry.getComponent("windowManager"); + window = wm.createWindow("SkyGui"); + setSize(190, 240); window.add(this); -// WindowUtils.restoreWindowBounds("SkyGui", window); -// WindowUtils.addSaveOnShutdown("SkyGui", window); window.setVisible(true); MouseAdapter mouseHandler = new MouseAdapter() { Added: mspsim/se/sics/mspsim/ui/JFrameWindowManager.java =================================================================== --- mspsim/se/sics/mspsim/ui/JFrameWindowManager.java (rev 0) +++ mspsim/se/sics/mspsim/ui/JFrameWindowManager.java 2009-09-10 15:26:02 UTC (rev 603) @@ -0,0 +1,28 @@ +package se.sics.mspsim.ui; + +import java.awt.Component; + +import javax.swing.JFrame; + +public class JFrameWindowManager implements WindowManager { + + public ManagedWindow createWindow(final String name) { + ManagedWindow w = new ManagedWindow() { + private JFrame window = new JFrame(name); + private boolean restored = false; + + public void add(Component component) { + if (!restored) { + WindowUtils.restoreWindowBounds(name, window); + WindowUtils.addSaveOnShutdown(name, window); + } + window.add(component); + } + public void setVisible(boolean b) { + window.setVisible(b); + } + }; + return w; + } + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2009-09-10 13:55:52
|
Revision: 602 http://mspsim.svn.sourceforge.net/mspsim/?rev=602&view=rev Author: joxe Date: 2009-09-10 13:55:37 +0000 (Thu, 10 Sep 2009) Log Message: ----------- fixed SkyGUI to be a service and use ManagedWindow Modified Paths: -------------- mspsim/se/sics/mspsim/platform/sky/MoteIVNode.java mspsim/se/sics/mspsim/platform/sky/SkyGui.java Modified: mspsim/se/sics/mspsim/platform/sky/MoteIVNode.java =================================================================== --- mspsim/se/sics/mspsim/platform/sky/MoteIVNode.java 2009-09-10 13:54:47 UTC (rev 601) +++ mspsim/se/sics/mspsim/platform/sky/MoteIVNode.java 2009-09-10 13:55:37 UTC (rev 602) @@ -191,6 +191,7 @@ if (!config.getPropertyAsBoolean("nogui", true)) { gui = new SkyGui(this); + registry.registerComponent("skygui", gui); // A HACK for some "graphs"!!! DataChart dataChart = new DataChart("Duty Cycle", "Duty Cycle"); Modified: mspsim/se/sics/mspsim/platform/sky/SkyGui.java =================================================================== --- mspsim/se/sics/mspsim/platform/sky/SkyGui.java 2009-09-10 13:54:47 UTC (rev 601) +++ mspsim/se/sics/mspsim/platform/sky/SkyGui.java 2009-09-10 13:55:37 UTC (rev 602) @@ -43,27 +43,29 @@ import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; -import java.awt.event.KeyAdapter; -import java.awt.event.KeyEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.net.URL; import javax.swing.ImageIcon; import javax.swing.JComponent; -import javax.swing.JFrame; import se.sics.mspsim.core.IOUnit; import se.sics.mspsim.core.MSP430; import se.sics.mspsim.core.USART; +import se.sics.mspsim.ui.ManagedWindow; import se.sics.mspsim.ui.SerialMon; -import se.sics.mspsim.ui.WindowUtils; +import se.sics.mspsim.ui.WindowManager; +import se.sics.mspsim.util.ComponentRegistry; +import se.sics.mspsim.util.ServiceComponent; -public class SkyGui extends JComponent { +public class SkyGui extends JComponent implements ServiceComponent { /** * */ private static final long serialVersionUID = 7753659717805292786L; + private ServiceComponent.Status status = Status.STOPPED; + public static final int GREEN_Y = 40; public static final int BLUE_Y = 46; public static final int RED_Y = 34; @@ -80,12 +82,22 @@ private SerialMon serial; private ImageIcon skyImage; - private JFrame window; + private ManagedWindow window; private MoteIVNode node; + private ComponentRegistry registry; + + private String name; + public SkyGui(MoteIVNode node) { this.node = node; + } + public String getName() { + return name; + } + + public void start() { setBackground(Color.black); setOpaque(true); @@ -105,24 +117,14 @@ setPreferredSize(new Dimension(skyImage.getIconWidth(), skyImage.getIconHeight())); - window = new JFrame("Sky"); + WindowManager wm = (WindowManager) registry.getComponent("WindowManager"); + window = wm.createWindow("Sky"); // window.setSize(190,240); window.add(this); - WindowUtils.restoreWindowBounds("SkyGui", window); - WindowUtils.addSaveOnShutdown("SkyGui", window); +// WindowUtils.restoreWindowBounds("SkyGui", window); +// WindowUtils.addSaveOnShutdown("SkyGui", window); window.setVisible(true); - window.addKeyListener(new KeyAdapter() { - - public void keyPressed(KeyEvent key) { -// System.out.println("Key Pressed: " + key.getKeyChar()); - if (key.getKeyChar() == 'd') { - SkyGui.this.node.setDebug(!SkyGui.this.node.getDebug()); - } - } - - }); - MouseAdapter mouseHandler = new MouseAdapter() { private boolean buttonDown = false; @@ -155,9 +157,9 @@ } } }; -// window.addMouseMotionListener(mouseHandler); - window.addMouseListener(mouseHandler); + this.addMouseListener(mouseHandler); + // Add some windows for listening to serial output MSP430 cpu = node.getCPU(); IOUnit usart = cpu.getIOUnit("USART 1"); @@ -165,6 +167,7 @@ serial = new SerialMon((USART)usart, "USART1 Port Output"); ((USART) usart).setUSARTListener(serial); } + status = Status.STARTED; } protected void paintComponent(Graphics g) { @@ -203,4 +206,16 @@ g.setColor(old); } + public Status getStatus() { + return status; + } + + public void init(String name, ComponentRegistry registry) { + this.name = name; + this.registry = registry; + } + + public void stop() { + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2009-09-10 13:54:55
|
Revision: 601 http://mspsim.svn.sourceforge.net/mspsim/?rev=601&view=rev Author: joxe Date: 2009-09-10 13:54:47 +0000 (Thu, 10 Sep 2009) Log Message: ----------- added window manager interfaces Added Paths: ----------- mspsim/se/sics/mspsim/ui/ManagedWindow.java mspsim/se/sics/mspsim/ui/WindowManager.java Added: mspsim/se/sics/mspsim/ui/ManagedWindow.java =================================================================== --- mspsim/se/sics/mspsim/ui/ManagedWindow.java (rev 0) +++ mspsim/se/sics/mspsim/ui/ManagedWindow.java 2009-09-10 13:54:47 UTC (rev 601) @@ -0,0 +1,11 @@ +package se.sics.mspsim.ui; + +import java.awt.Component; + +public interface ManagedWindow { + + public void add(Component component); + + public void setVisible(boolean b); + +} Added: mspsim/se/sics/mspsim/ui/WindowManager.java =================================================================== --- mspsim/se/sics/mspsim/ui/WindowManager.java (rev 0) +++ mspsim/se/sics/mspsim/ui/WindowManager.java 2009-09-10 13:54:47 UTC (rev 601) @@ -0,0 +1,5 @@ +package se.sics.mspsim.ui; + +public interface WindowManager { + public ManagedWindow createWindow(String name); +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2009-09-10 13:26:56
|
Revision: 600 http://mspsim.svn.sourceforge.net/mspsim/?rev=600&view=rev Author: nifi Date: 2009-09-10 13:26:43 +0000 (Thu, 10 Sep 2009) Log Message: ----------- changed map file parser to extract module sizes (data/bss) Modified Paths: -------------- mspsim/se/sics/mspsim/util/MapEntry.java mspsim/se/sics/mspsim/util/MapTable.java Modified: mspsim/se/sics/mspsim/util/MapEntry.java =================================================================== --- mspsim/se/sics/mspsim/util/MapEntry.java 2009-09-10 13:26:02 UTC (rev 599) +++ mspsim/se/sics/mspsim/util/MapEntry.java 2009-09-10 13:26:43 UTC (rev 600) @@ -51,6 +51,10 @@ private String name; private String file; private boolean isLocal; + private int dataAddr; + private int dataSize; + private int bssAddr; + private int bssSize; public MapEntry(TYPE type, int address, int size, String name, String file, boolean isLocal) { this.type = type; @@ -60,11 +64,33 @@ this.isLocal = isLocal; this.size = size; } - + + void setData(int dataAddr, int dataSize) { + this.dataAddr = dataAddr; + this.dataSize = dataSize; + } + + void setBSS(int bssAddr, int bssSize) { + this.bssAddr = bssAddr; + this.bssSize = bssSize; + } + + void setSize(int size) { + this.size = size; + } + public int getSize() { return size; } - + + public int getDataSize() { + return dataSize; + } + + public int getBSSSize() { + return bssSize; + } + public TYPE getType() { return type; } Modified: mspsim/se/sics/mspsim/util/MapTable.java =================================================================== --- mspsim/se/sics/mspsim/util/MapTable.java 2009-09-10 13:26:02 UTC (rev 599) +++ mspsim/se/sics/mspsim/util/MapTable.java 2009-09-10 13:26:43 UTC (rev 600) @@ -45,6 +45,7 @@ import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; +import java.util.HashMap; import java.util.regex.Pattern; @@ -61,11 +62,15 @@ */ public class MapTable { + private final static boolean DEBUG = false; + private enum Mode {NONE,CODE,DATA,BSS}; private Mode mode; public int heapStartAddress = -1; public int stackStartAddress = -1; + private int bssFill = 0; + private int dataFill = 0; private ArrayList<MapEntry> modules = new ArrayList<MapEntry>(); private MapEntry[] entries; @@ -77,35 +82,92 @@ loadMap(file); } + private MapEntry getModuleEntry(HashMap<String,MapEntry> moduleTable, + int addr, int size, String name) { + MapEntry entry = moduleTable.get(name); + if (entry == null) { + entry = new MapEntry(MapEntry.TYPE.module, addr, size, name, null, false); + moduleTable.put(name, entry); + modules.add(entry); + } else if (size > 0) { + entry.setSize(entry.getSize() + size); + } + return entry; + } + /** * <code>parseMapLine</code> * parses a line of a map file! * @param line a <code>String</code> value */ - public void parseMapLine(String line) { + private void parseMapLine(HashMap<String,MapEntry> moduleTable, String line) { String parts[] = line.split("\\s+"); if (line.startsWith(".text")) { mode = Mode.CODE; - System.out.println("CODE Mode"); + if (DEBUG) { + System.out.println("CODE Mode"); + } } else if (line.startsWith(".bss")) { mode = Mode.BSS; - System.out.println("BSS Mode!"); + if (DEBUG) { + System.out.println("BSS Mode!"); + } } else if (line.startsWith(".data")) { mode = Mode.DATA; - System.out.println("Data Mode!"); - } else if (line.startsWith(" .text")) { + if (DEBUG) { + System.out.println("Data Mode!"); + } + } else if (line.startsWith(" .text") || line.startsWith(" .init") + || line.startsWith(" .vectors")) { if (parts.length > 3) { int addr = Integer.parseInt(parts[2].substring(2), 16); int size = Integer.parseInt(parts[3].substring(2), 16); - System.out.println("Module add: " + addr + " Size:" + size + " file:" + parts[4]); - modules.add(new MapEntry(MapEntry.TYPE.module, addr, size, parts[4], null, false)); + MapEntry entry = getModuleEntry(moduleTable, addr, size, parts[4]); + if (DEBUG) { + System.out.println("Module add: " + addr + " Size:" + size + + " file:" + parts[4]); + } } + } else if (line.startsWith(" .data")) { + if (parts.length > 3) { + int addr = Integer.parseInt(parts[2].substring(2), 16); + int size = Integer.parseInt(parts[3].substring(2), 16); + MapEntry entry = getModuleEntry(moduleTable, addr, 0, parts[4]); + if (DEBUG) { + System.out.println("Module add data: " + addr + " Size:" + size + + " file:" + parts[4]); + } + entry.setData(addr, size); + } + } else if (line.startsWith(" .bss") || line.startsWith(" COMMON")) { + if (parts.length > 3) { + int addr = Integer.parseInt(parts[2].substring(2), 16); + int size = Integer.parseInt(parts[3].substring(2), 16); + MapEntry entry = getModuleEntry(moduleTable, addr, 0, parts[4]); + if (DEBUG) { + System.out.println("Module add bss: " + addr + " Size:" + size + + " file: " + parts[4]); + } + entry.setBSS(addr, entry.getBSSSize() + size); + } + } else if (line.startsWith(" *fill*")) { + if(parts.length > 3) { + int size = Integer.parseInt(parts[3].substring(2), 16); + if (mode == Mode.BSS) { + bssFill += size; + } else if (mode == Mode.DATA) { + dataFill += size; + } + } + } else if (mode == Mode.CODE && line.startsWith(" ")) { if (parts.length > 2) { // Scrap 0x and parse as hex! int val = Integer.parseInt(parts[1].substring(2), 16); - System.out.println("Function: " + parts[2] + " at " + - Utils.hex16(val)); + if (DEBUG) { + System.out.println("Function: " + parts[2] + " at " + + Utils.hex16(val)); + } // Add the file part later some time... // After the demo... setEntry(new MapEntry(MapEntry.TYPE.function, val, 0, parts[2], null, false)); @@ -116,15 +178,25 @@ } else if (line.contains("PROVIDE (__stack") && parts.length > 2) { stackStartAddress = Integer.parseInt(parts[1].substring(2), 16); + +// } else if ((line.startsWith("text ") +// || line.startsWith("data ") +// || line.startsWith("vectors ") +// || line.startsWith("bootloader ") +// || line.startsWith("infomem ") +// || line.startsWith("infomemnobits ")) && parts.length == 4) { + // Memory configuration + } } public void loadMap(String file) throws IOException { FileInputStream fInput = new FileInputStream(file); BufferedReader bInput = new BufferedReader(new InputStreamReader(fInput)); + HashMap<String,MapEntry> moduleTable = new HashMap<String,MapEntry>(); String line; while ((line = bInput.readLine()) != null) { - parseMapLine(line); + parseMapLine(moduleTable, line); } bInput.close(); fInput.close(); @@ -147,10 +219,12 @@ public MapEntry[] getAllEntries() { ArrayList<MapEntry> allEntries = new ArrayList<MapEntry>(); - for (int address=0; address < entries.length; address++) { - MapEntry entry = getEntry(address); - if (entry != null) { - allEntries.add(entry); + if (entries != null) { + for (int address = 0; address < entries.length; address++) { + MapEntry entry = getEntry(address); + if (entry != null) { + allEntries.add(entry); + } } } return allEntries.toArray(new MapEntry[allEntries.size()]); @@ -159,16 +233,17 @@ public MapEntry[] getEntries(String regexp) { Pattern pattern = Pattern.compile(regexp); ArrayList<MapEntry> allEntries = new ArrayList<MapEntry>(); - for (int address=0; address < entries.length; address++) { - MapEntry entry = getEntry(address); - if (entry != null && pattern.matcher(entry.getName()).find()) { - allEntries.add(entry); + if (entries != null) { + for (int address = 0; address < entries.length; address++) { + MapEntry entry = getEntry(address); + if (entry != null && pattern.matcher(entry.getName()).find()) { + allEntries.add(entry); + } } } return allEntries.toArray(new MapEntry[allEntries.size()]); } - // Should be any symbol... not just function... public void setFunctionName(int address, String name) { setEntry(new MapEntry(MapEntry.TYPE.function, address, 0, name, null, false)); @@ -186,9 +261,11 @@ // Really slow way to find a specific function address!!!! // Either reimplement this or cache in hashtable... public int getFunctionAddress(String function) { - for (int i = 0, n = entries.length; i < n; i++) { - if (entries[i] != null && function.equals(entries[i].getName())) { - return i; + if (entries != null) { + for (int i = 0, n = entries.length; i < n; i++) { + if (entries[i] != null && function.equals(entries[i].getName())) { + return i; + } } } return -1; @@ -205,11 +282,23 @@ public static void main(String[] args) throws IOException { MapTable map = new MapTable(args[0]); int totsize = 0; + int totdata = map.dataFill, totbss = map.bssFill; + int totmemory = totdata + totbss; + System.out.printf("%6s %6s %6s %4s %s\n", + "text", "data", "bss", "addr", "name"); for (int i = 0; i < map.modules.size(); i++) { MapEntry module = map.modules.get(i); totsize += module.getSize(); - System.out.println("Module: " + module.getName() + " addr: " + module.getAddress() + " size: " + module.getSize()); + totdata += module.getDataSize(); + totbss += module.getBSSSize(); + totmemory += module.getDataSize() + module.getBSSSize(); + System.out.printf("%7d %7d %7d $%04x %s\n", module.getSize(), + module.getDataSize(), module.getBSSSize(), + module.getAddress(), module.getName()); } - System.out.println("Total size: " + totsize + " " + Integer.toHexString(totsize)); + System.out.printf("%7d %7d %7d Total Size\n", + totsize, totdata, totbss); +// System.out.println("Total size: " + totsize + " (0x" + Integer.toHexString(totsize) + ')'); +// System.out.println("Total data/bss size: " + totmemory + " (0x" + Integer.toHexString(totmemory) + ") data: " + totdata + " bss: " + totbss); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2009-09-10 13:26:12
|
Revision: 599 http://mspsim.svn.sourceforge.net/mspsim/?rev=599&view=rev Author: nifi Date: 2009-09-10 13:26:02 +0000 (Thu, 10 Sep 2009) Log Message: ----------- Load from standard classloader if no plugin directory exists Modified Paths: -------------- mspsim/se/sics/mspsim/util/PluginRepository.java Modified: mspsim/se/sics/mspsim/util/PluginRepository.java =================================================================== --- mspsim/se/sics/mspsim/util/PluginRepository.java 2009-09-10 13:20:28 UTC (rev 598) +++ mspsim/se/sics/mspsim/util/PluginRepository.java 2009-09-10 13:26:02 UTC (rev 599) @@ -95,10 +95,12 @@ } public Class<?> loadClass(String name) throws ClassNotFoundException { - if (classLoader == null) throw new ClassNotFoundException(name); + if (classLoader == null) { + return Class.forName(name); + } return classLoader.loadClass(name); } - + public void start() { } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2009-09-10 13:20:36
|
Revision: 598 http://mspsim.svn.sourceforge.net/mspsim/?rev=598&view=rev Author: joxe Date: 2009-09-10 13:20:28 +0000 (Thu, 10 Sep 2009) Log Message: ----------- added service component and minor fixes to installation of plugins Modified Paths: -------------- mspsim/se/sics/mspsim/cli/MiscCommands.java mspsim/se/sics/mspsim/util/ActiveComponent.java mspsim/se/sics/mspsim/util/ComponentRegistry.java mspsim/se/sics/mspsim/util/PluginRepository.java Added Paths: ----------- mspsim/se/sics/mspsim/util/ServiceComponent.java Modified: mspsim/se/sics/mspsim/cli/MiscCommands.java =================================================================== --- mspsim/se/sics/mspsim/cli/MiscCommands.java 2009-09-08 18:29:32 UTC (rev 597) +++ mspsim/se/sics/mspsim/cli/MiscCommands.java 2009-09-10 13:20:28 UTC (rev 598) @@ -59,6 +59,7 @@ import se.sics.mspsim.util.ArgumentManager; import se.sics.mspsim.util.ComponentRegistry; import se.sics.mspsim.util.PluginRepository; +import se.sics.mspsim.util.ServiceComponent; import se.sics.mspsim.util.Utils; /** @@ -279,11 +280,19 @@ context.executeCommand(command); } }); - - handler.registerCommand("install", new BasicCommand("install and start a plugin", "ClassName") { + + handler.registerCommand("install", new BasicCommand("install and start a plugin", "ClassName [Name]") { @Override public int executeCommand(CommandContext context) { String className = context.getArgument(0); + String name = className; + if (context.getArgumentCount() > 1) { + name = context.getArgument(1); + } + if (registry.getComponent(name) != null) { + context.err.println("Another component with name " + name + " is already installed"); + return 1; + } Class pluginClass = null; PluginRepository plugins = (PluginRepository) registry.getComponent("pluginRepository"); try { @@ -291,12 +300,12 @@ pluginClass = plugins != null ? plugins.loadClass(className) : Class.forName(className); } catch (ClassNotFoundException e) { - className = "se.sics.mspsim.plugin." + className; - pluginClass = plugins != null ? plugins.loadClass(className) : - Class.forName(className); + String newClassName = "se.sics.mspsim.plugin." + className; + pluginClass = plugins != null ? plugins.loadClass(newClassName) : + Class.forName(newClassName); } - ActiveComponent component = (ActiveComponent) pluginClass.newInstance(); - registry.registerComponent(className, component); + Object component = pluginClass.newInstance(); + registry.registerComponent(name, component); return 0; } catch (Exception e1) { e1.printStackTrace(context.err); @@ -305,6 +314,47 @@ return 1; } }); + + handler.registerCommand("service", new BasicCommand("handle service plugins", "[class name|service name] [start|stop|install]") { + @Override + public int executeCommand(CommandContext context) { + if (context.getArgumentCount() == 0) { + ServiceComponent[] sc = (ServiceComponent[]) registry.getAllComponents(ServiceComponent.class); + for (int i = 0; i < sc.length; i++) { + context.out.printf(" %-20s %s\n",sc[i].getName(),sc[i].getStatus()); + } + } else if (context.getArgumentCount() == 1){ + String name = context.getArgument(0); + ServiceComponent sc = getServiceForName(registry, name); + if (sc != null) { + context.out.printf(" %-20s %s\n",sc.getName(),sc.getStatus()); + } else { + context.out.println("can not find service" + name); + } + } else { + String name = context.getArgument(0); + String operation = context.getArgument(1); + if ("start".equals(operation)) { + ServiceComponent sc = getServiceForName(registry, name); + if (sc != null) { + sc.start(); + context.out.println("service " + sc.getName() + " started"); + } else { + context.out.println("can not find service" + name); + } + } else if ("stop".equals(operation)) { + ServiceComponent sc = getServiceForName(registry, name); + if (sc != null) { + sc.start(); + context.out.println("service " + sc.getName() + " started"); + } else { + context.out.println("can not find service" + name); + } + } + } + return 0; + } + }); handler.registerCommand("rflistener", new BasicLineCommand("an rflisteer", "[input|output] <rf-chip>") { CommandContext context; @@ -356,4 +406,11 @@ }); } + private static ServiceComponent getServiceForName(ComponentRegistry registry, String name) { + Object o = registry.getComponent(name); + if (o instanceof ServiceComponent) { + return (ServiceComponent) o; + } + return null; + } } Modified: mspsim/se/sics/mspsim/util/ActiveComponent.java =================================================================== --- mspsim/se/sics/mspsim/util/ActiveComponent.java 2009-09-08 18:29:32 UTC (rev 597) +++ mspsim/se/sics/mspsim/util/ActiveComponent.java 2009-09-10 13:20:28 UTC (rev 598) @@ -1,5 +1,6 @@ package se.sics.mspsim.util; +/* Active components are always started when added to registry */ public interface ActiveComponent { public void init(String name, ComponentRegistry registry); public void start(); Modified: mspsim/se/sics/mspsim/util/ComponentRegistry.java =================================================================== --- mspsim/se/sics/mspsim/util/ComponentRegistry.java 2009-09-08 18:29:32 UTC (rev 597) +++ mspsim/se/sics/mspsim/util/ComponentRegistry.java 2009-09-10 13:20:28 UTC (rev 598) @@ -16,6 +16,8 @@ if (running) { ((ActiveComponent)component).start(); } + } else if (component instanceof ServiceComponent) { + ((ServiceComponent)component).init(name, this); } } @@ -58,7 +60,7 @@ list.add(component); } } - return list.toArray(); + return list.toArray((Object[]) java.lang.reflect.Array.newInstance(name, list.size())); } public void start() { Modified: mspsim/se/sics/mspsim/util/PluginRepository.java =================================================================== --- mspsim/se/sics/mspsim/util/PluginRepository.java 2009-09-08 18:29:32 UTC (rev 597) +++ mspsim/se/sics/mspsim/util/PluginRepository.java 2009-09-10 13:20:28 UTC (rev 598) @@ -54,7 +54,7 @@ private URLClassLoader classLoader; public void init(String name, ComponentRegistry registry) { - File dir = new File("lib"); + File dir = new File("plugins"); if (dir.isDirectory()) { File[] files = dir.listFiles(new JarFilter()); if (files != null) { Added: mspsim/se/sics/mspsim/util/ServiceComponent.java =================================================================== --- mspsim/se/sics/mspsim/util/ServiceComponent.java (rev 0) +++ mspsim/se/sics/mspsim/util/ServiceComponent.java 2009-09-10 13:20:28 UTC (rev 598) @@ -0,0 +1,13 @@ +package se.sics.mspsim.util; + +/* Service component that can be stopped and is not autostarted when + * registered (unless it also implements ActiveComponent) + */ +public interface ServiceComponent { + public static enum Status {STARTED, STOPPED, ERROR}; + public String getName(); + public Status getStatus(); + public void init(String name, ComponentRegistry registry); + public void start(); + public void stop(); +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2009-09-08 18:29:41
|
Revision: 597 http://mspsim.svn.sourceforge.net/mspsim/?rev=597&view=rev Author: joxe Date: 2009-09-08 18:29:32 +0000 (Tue, 08 Sep 2009) Log Message: ----------- fixed window -clear command Modified Paths: -------------- mspsim/se/sics/mspsim/cli/WindowCommands.java Modified: mspsim/se/sics/mspsim/cli/WindowCommands.java =================================================================== --- mspsim/se/sics/mspsim/cli/WindowCommands.java 2009-09-08 18:22:12 UTC (rev 596) +++ mspsim/se/sics/mspsim/cli/WindowCommands.java 2009-09-08 18:29:32 UTC (rev 597) @@ -63,7 +63,7 @@ if ("-close".equals(name)) { exit = close = true; } else if ("-clear".equals(name)) { - exit = clear = true; + clear = true; } else if ("-list".equals(name)) { WindowTarget tgts[] = windowTargets.values().toArray(new WindowTarget[windowTargets.size()]); if (tgts != null && tgts.length > 0) { @@ -85,7 +85,7 @@ wt.clear(); } /* command is no longer running */ - context.exit(0); + if (exit) context.exit(0); return 0; } else { context.err.println("Could not find the window " + name); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2009-09-08 18:22:24
|
Revision: 596 http://mspsim.svn.sourceforge.net/mspsim/?rev=596&view=rev Author: joxe Date: 2009-09-08 18:22:12 +0000 (Tue, 08 Sep 2009) Log Message: ----------- made window command instead of window redirect Modified Paths: -------------- mspsim/se/sics/mspsim/cli/WindowCommands.java Modified: mspsim/se/sics/mspsim/cli/WindowCommands.java =================================================================== --- mspsim/se/sics/mspsim/cli/WindowCommands.java 2009-09-08 18:21:45 UTC (rev 595) +++ mspsim/se/sics/mspsim/cli/WindowCommands.java 2009-09-08 18:22:12 UTC (rev 596) @@ -50,7 +50,7 @@ private Hashtable <String, WindowTarget> windowTargets = new Hashtable<String, WindowTarget>(); public void setupCommands(ComponentRegistry registry, CommandHandler handler) { - handler.registerCommand("window", new BasicLineCommand("redirect input to a window", "<windowname>") { + handler.registerCommand("window", new BasicLineCommand("redirect input to a window", "[-close|-clear|-list] <windowname>") { WindowTarget wt; CommandContext context; public int executeCommand(CommandContext context) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2009-09-08 18:21:52
|
Revision: 595 http://mspsim.svn.sourceforge.net/mspsim/?rev=595&view=rev Author: joxe Date: 2009-09-08 18:21:45 +0000 (Tue, 08 Sep 2009) Log Message: ----------- made window command instead of window redirect Modified Paths: -------------- mspsim/se/sics/mspsim/cli/CommandHandler.java mspsim/se/sics/mspsim/cli/WindowCommands.java mspsim/se/sics/mspsim/cli/WindowTarget.java Modified: mspsim/se/sics/mspsim/cli/CommandHandler.java =================================================================== --- mspsim/se/sics/mspsim/cli/CommandHandler.java 2009-09-08 16:45:15 UTC (rev 594) +++ mspsim/se/sics/mspsim/cli/CommandHandler.java 2009-09-08 18:21:45 UTC (rev 595) @@ -68,6 +68,7 @@ pid = ++pidCounter; } commands[i] = new CommandContext(this, getMapTable(), commandLine, args, pid, cmd); + if (i > 0) { PrintStream po = new PrintStream(new LineOutputStream((LineListener) commands[i].getCommand())); commands[i - 1].setOutput(po, err); @@ -105,9 +106,19 @@ } return 1; } else if (pid >= 0) { - synchronized (currentAsyncCommands) { - currentAsyncCommands.add(commands); + boolean exited = false; + for (int i = 0; i < commands.length && !exited; i++) { + if (commands[i].hasExited()) { + exited = true; + } } + if (exited) { + exitCommands(commands); + } else { + synchronized (currentAsyncCommands) { + currentAsyncCommands.add(commands); + } + } } return 0; } @@ -281,18 +292,22 @@ } } } - if (contexts != null) { - for (int i = 0; i < contexts.length; i++) { - Command command = contexts[i].getCommand(); - // Stop any commands that have not yet been stopped... - if (command instanceof AsyncCommand && !contexts[i].hasExited()) { - AsyncCommand ac = (AsyncCommand) command; - ac.stopCommand(contexts[i]); - } + return exitCommands(contexts); + } + + private boolean exitCommands(CommandContext[] contexts) { + if (contexts != null) { + for (int i = 0; i < contexts.length; i++) { + Command command = contexts[i].getCommand(); + // Stop any commands that have not yet been stopped... + if (command instanceof AsyncCommand && !contexts[i].hasExited()) { + AsyncCommand ac = (AsyncCommand) command; + ac.stopCommand(contexts[i]); + } + } + return true; } - return true; - } - return false; + return false; } public void lineRead(String line) { Modified: mspsim/se/sics/mspsim/cli/WindowCommands.java =================================================================== --- mspsim/se/sics/mspsim/cli/WindowCommands.java 2009-09-08 16:45:15 UTC (rev 594) +++ mspsim/se/sics/mspsim/cli/WindowCommands.java 2009-09-08 18:21:45 UTC (rev 595) @@ -47,50 +47,100 @@ public class WindowCommands implements CommandBundle { - private Hashtable <String, WindowTarget> windowTargets = new Hashtable<String, WindowTarget>(); + private Hashtable <String, WindowTarget> windowTargets = new Hashtable<String, WindowTarget>(); - public void setupCommands(ComponentRegistry registry, CommandHandler handler) { - handler.registerCommand(">#", new BasicLineCommand(null, "<windowname>") { - WindowTarget wt; - public int executeCommand(CommandContext context) { - String windowName = context.getArgument(0); - wt = windowTargets.get(windowName); + public void setupCommands(ComponentRegistry registry, CommandHandler handler) { + handler.registerCommand("window", new BasicLineCommand("redirect input to a window", "<windowname>") { + WindowTarget wt; + CommandContext context; + public int executeCommand(CommandContext context) { + boolean close = false; + boolean clear = false; + boolean exit = false; + this.context = context; + for (int i = 0; i < context.getArgumentCount(); i++) { + String name = context.getArgument(i); + if ("-close".equals(name)) { + exit = close = true; + } else if ("-clear".equals(name)) { + exit = clear = true; + } else if ("-list".equals(name)) { + WindowTarget tgts[] = windowTargets.values().toArray(new WindowTarget[windowTargets.size()]); + if (tgts != null && tgts.length > 0) { + context.out.println("Window Name PIDs"); + } + for (int j = 0; j < tgts.length; j++) { + tgts[j].print(context.out); + } + exit = true; + } else if (i == context.getArgumentCount() - 1) { + if (clear || close) { + wt = windowTargets.get(name); + if (wt != null) { + if (close) { + context.out.println("Closing window " + name); + removeTarget(wt); + wt.close(); + } else if (clear) { + wt.clear(); + } + /* command is no longer running */ + context.exit(0); + return 0; + } else { + context.err.println("Could not find the window " + name); + /* command is no longer running */ + context.exit(1); + return 1; + } + } else { + wt = addTarget(context, name); + } + } + } + if (exit) { + context.exit(0); + } + return 0; + } + + public void lineRead(String line) { + if (line != null) { + wt.lineRead(line); + } else { + wt.removeContext(context); + context.exit(0); + } + } + + public void stopCommand(CommandContext context) { + // Should this do anything? + // Probably depending on the wt's config + System.out.println("Stopping window target: " + wt.getName()); + wt.removeContext(context); + } + }); + + handler.registerCommand("wclear", new BasicCommand("resets stored window positions", "") { + public int executeCommand(CommandContext context) { + WindowUtils.clearState(); + return 0; + } + }); + } + + protected WindowTarget addTarget(CommandContext context, String name) { + WindowTarget wt = windowTargets.get(name); if (wt == null) { - wt = new WindowTarget(windowName); - windowTargets.put(windowName, wt); + wt = new WindowTarget(name); + windowTargets.put(name, wt); } - return 0; - } - public void lineRead(String line) { - wt.lineRead(line); - } - public void stopCommand(CommandContext context) { - // Should this do anything? - // Probably depending on the wt's config - System.out.println("Stopping window target: " + wt.getName()); - } - }); - - handler.registerCommand("wclose", new BasicCommand("close the specified window", "<windowname>") { - public int executeCommand(CommandContext context) { - String name = context.getArgument(0); - WindowTarget wt = windowTargets.get(name); - if (wt != null) { - context.out.println("Closing window " + name); - windowTargets.remove(name); - wt.close(); - return 0; - } else { - context.err.println("Could not find the window " + name); - return 1; - } - } - }); - handler.registerCommand("wclear", new BasicCommand("resets stored window positions", "") { - public int executeCommand(CommandContext context) { - WindowUtils.clearState(); - return 0; - } - }); - } -} + wt.addContext(context); + return wt; + } + + protected void removeTarget(WindowTarget target) { + /* needs to close down PIDs that are currently writing to the target too !!!??? */ + windowTargets.remove(target.getName()); + } +} \ No newline at end of file Modified: mspsim/se/sics/mspsim/cli/WindowTarget.java =================================================================== --- mspsim/se/sics/mspsim/cli/WindowTarget.java 2009-09-08 16:45:15 UTC (rev 594) +++ mspsim/se/sics/mspsim/cli/WindowTarget.java 2009-09-08 18:21:45 UTC (rev 595) @@ -1,6 +1,9 @@ package se.sics.mspsim.cli; import java.awt.Font; +import java.io.PrintStream; +import java.util.ArrayList; + import javax.swing.JFrame; import javax.swing.JScrollPane; import javax.swing.JTextArea; @@ -16,6 +19,7 @@ // Default in the current version - TODO: replace with better private JTextArea jta = new JTextArea(40,80); private WindowDataHandler dataHandler = null; + private ArrayList<CommandContext> pids = new ArrayList<CommandContext>(); public WindowTarget(String name) { jta.setFont(Font.decode("Courier")); @@ -27,6 +31,16 @@ targetName = name; } + public void addContext(CommandContext c) { + if (c.getPID() != -1) { + pids.add(c); + } + } + + public void removeContext(CommandContext c) { + pids.remove(c); + } + public void lineRead(final String line) { if (line != null && window != null) { SwingUtilities.invokeLater(new Runnable() { @@ -104,7 +118,21 @@ window = null; } + public void clear() { + jta.setText(""); + } + public String getName() { return targetName; } + + public void print(PrintStream out) { + out.print("Window: " + targetName + " PIDs: ["); + CommandContext[] ctx = pids.toArray(new CommandContext[pids.size()]); + for (int i = 0; i < ctx.length; i++) { + if (i > 0) out.print(" ,"); + out.print(ctx[i].getPID()); + } + out.println("]"); + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2009-09-08 16:45:26
|
Revision: 594 http://mspsim.svn.sourceforge.net/mspsim/?rev=594&view=rev Author: joxe Date: 2009-09-08 16:45:15 +0000 (Tue, 08 Sep 2009) Log Message: ----------- refactored file commands out of misc commands Modified Paths: -------------- mspsim/se/sics/mspsim/cli/MiscCommands.java mspsim/se/sics/mspsim/platform/GenericNode.java Added Paths: ----------- mspsim/se/sics/mspsim/cli/FileCommands.java Added: mspsim/se/sics/mspsim/cli/FileCommands.java =================================================================== --- mspsim/se/sics/mspsim/cli/FileCommands.java (rev 0) +++ mspsim/se/sics/mspsim/cli/FileCommands.java 2009-09-08 16:45:15 UTC (rev 594) @@ -0,0 +1,47 @@ +package se.sics.mspsim.cli; + +import java.util.Hashtable; +import java.util.Iterator; + +import se.sics.mspsim.util.ComponentRegistry; + +public class FileCommands implements CommandBundle { + + private Hashtable <String, FileTarget> fileTargets = new Hashtable<String, FileTarget>(); + + public void setupCommands(final ComponentRegistry registry, CommandHandler handler) { + // TODO: this should also be "registered" as a "sink". + // probably this should be handled using ">" instead! + handler.registerCommand(">", new FileTargetCommand(fileTargets, + null, "<filename>", false)); + handler.registerCommand("tee", new FileTargetCommand(fileTargets, + "redirect to file and std-out", "<filename>", true)); + + handler.registerCommand("fclose", new BasicCommand("close the specified file", "<filename>") { + public int executeCommand(CommandContext context) { + String name = context.getArgument(0); + FileTarget ft = fileTargets.get(name); + if (ft != null) { + context.out.println("Closing file " + name); + fileTargets.remove(name); + ft.close(); + return 0; + } else { + context.err.println("Could not find the open file " + name); + return 1; + } + } + }); + + handler.registerCommand("files", new BasicCommand("list open files", "") { + public int executeCommand(CommandContext context) { + for (Iterator<FileTarget> iterator = fileTargets.values().iterator(); iterator.hasNext();) { + FileTarget type = iterator.next(); + context.out.println(type.getName()); + } + return 0; + } + }); + } + +} Modified: mspsim/se/sics/mspsim/cli/MiscCommands.java =================================================================== --- mspsim/se/sics/mspsim/cli/MiscCommands.java 2009-09-08 09:47:22 UTC (rev 593) +++ mspsim/se/sics/mspsim/cli/MiscCommands.java 2009-09-08 16:45:15 UTC (rev 594) @@ -121,39 +121,7 @@ } }); - // TODO: this should also be "registered" as a "sink". - // probably this should be handled using ">" instead! - handler.registerCommand(">", new FileTargetCommand(fileTargets, - null, "<filename>", false)); - handler.registerCommand("tee", new FileTargetCommand(fileTargets, - "redirect to file and std-out", "<filename>", true)); - handler.registerCommand("fclose", new BasicCommand("close the specified file", "<filename>") { - public int executeCommand(CommandContext context) { - String name = context.getArgument(0); - FileTarget ft = fileTargets.get(name); - if (ft != null) { - context.out.println("Closing file " + name); - fileTargets.remove(name); - ft.close(); - return 0; - } else { - context.err.println("Could not find the open file " + name); - return 1; - } - } - }); - - handler.registerCommand("files", new BasicCommand("list open files", "") { - public int executeCommand(CommandContext context) { - for (Iterator<FileTarget> iterator = fileTargets.values().iterator(); iterator.hasNext();) { - FileTarget type = iterator.next(); - context.out.println(type.getName()); - } - return 0; - } - }); - handler.registerCommand("speed", new BasicCommand("set the speed factor for the CPU", "[factor]") { public int executeCommand(CommandContext context) { MSP430 cpu = (MSP430) registry.getComponent(MSP430.class); Modified: mspsim/se/sics/mspsim/platform/GenericNode.java =================================================================== --- mspsim/se/sics/mspsim/platform/GenericNode.java 2009-09-08 09:47:22 UTC (rev 593) +++ mspsim/se/sics/mspsim/platform/GenericNode.java 2009-09-08 16:45:15 UTC (rev 594) @@ -45,6 +45,7 @@ import java.net.URL; import se.sics.mspsim.cli.CommandHandler; import se.sics.mspsim.cli.DebugCommands; +import se.sics.mspsim.cli.FileCommands; import se.sics.mspsim.cli.MiscCommands; import se.sics.mspsim.cli.NetCommands; import se.sics.mspsim.cli.ProfilerCommands; @@ -203,6 +204,7 @@ registry.registerComponent("pluginRepository", new PluginRepository()); registry.registerComponent("debugcmd", new DebugCommands()); registry.registerComponent("misccmd", new MiscCommands()); + registry.registerComponent("filecmd", new FileCommands()); registry.registerComponent("statcmd", new StatCommands(cpu, stats)); registry.registerComponent("wincmd", new WindowCommands()); registry.registerComponent("profilecmd", new ProfilerCommands()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2009-09-08 09:47:29
|
Revision: 593 http://mspsim.svn.sourceforge.net/mspsim/?rev=593&view=rev Author: joxe Date: 2009-09-08 09:47:22 +0000 (Tue, 08 Sep 2009) Log Message: ----------- fixed so that pluginrepository is used for loading plugins from the lib and added load from repos. for install command Modified Paths: -------------- mspsim/se/sics/mspsim/cli/MiscCommands.java mspsim/se/sics/mspsim/platform/GenericNode.java mspsim/se/sics/mspsim/util/PluginBundle.java mspsim/se/sics/mspsim/util/PluginRepository.java Modified: mspsim/se/sics/mspsim/cli/MiscCommands.java =================================================================== --- mspsim/se/sics/mspsim/cli/MiscCommands.java 2009-09-07 22:39:39 UTC (rev 592) +++ mspsim/se/sics/mspsim/cli/MiscCommands.java 2009-09-08 09:47:22 UTC (rev 593) @@ -58,6 +58,7 @@ import se.sics.mspsim.util.ActiveComponent; import se.sics.mspsim.util.ArgumentManager; import se.sics.mspsim.util.ComponentRegistry; +import se.sics.mspsim.util.PluginRepository; import se.sics.mspsim.util.Utils; /** @@ -316,20 +317,24 @@ public int executeCommand(CommandContext context) { String className = context.getArgument(0); Class pluginClass = null; + PluginRepository plugins = (PluginRepository) registry.getComponent("pluginRepository"); try { try { - pluginClass = Class.forName(className); + pluginClass = plugins != null ? plugins.loadClass(className) : + Class.forName(className); } catch (ClassNotFoundException e) { - pluginClass = Class.forName("se.sics.mspsim.plugin." + className); + className = "se.sics.mspsim.plugin." + className; + pluginClass = plugins != null ? plugins.loadClass(className) : + Class.forName(className); } ActiveComponent component = (ActiveComponent) pluginClass.newInstance(); registry.registerComponent(className, component); return 0; - } catch (Exception e1) { // TODO Auto-generated catch block - e1.printStackTrace(context.err); - } - // TODO Auto-generated method stub - return 1; + } catch (Exception e1) { + e1.printStackTrace(context.err); + } + // TODO Auto-generated method stub + return 1; } }); Modified: mspsim/se/sics/mspsim/platform/GenericNode.java =================================================================== --- mspsim/se/sics/mspsim/platform/GenericNode.java 2009-09-07 22:39:39 UTC (rev 592) +++ mspsim/se/sics/mspsim/platform/GenericNode.java 2009-09-08 09:47:22 UTC (rev 593) @@ -65,6 +65,7 @@ import se.sics.mspsim.util.IHexReader; import se.sics.mspsim.util.MapTable; import se.sics.mspsim.util.OperatingModeStatistics; +import se.sics.mspsim.util.PluginRepository; import se.sics.mspsim.util.StatCommands; public abstract class GenericNode extends Chip implements Runnable { @@ -198,6 +199,8 @@ registry.registerComponent("commandHandler", ch); } stats = new OperatingModeStatistics(cpu); + + registry.registerComponent("pluginRepository", new PluginRepository()); registry.registerComponent("debugcmd", new DebugCommands()); registry.registerComponent("misccmd", new MiscCommands()); registry.registerComponent("statcmd", new StatCommands(cpu, stats)); Modified: mspsim/se/sics/mspsim/util/PluginBundle.java =================================================================== --- mspsim/se/sics/mspsim/util/PluginBundle.java 2009-09-07 22:39:39 UTC (rev 592) +++ mspsim/se/sics/mspsim/util/PluginBundle.java 2009-09-08 09:47:22 UTC (rev 593) @@ -42,5 +42,5 @@ package se.sics.mspsim.util; public interface PluginBundle { - + public void init(ComponentRegistry registry); } Modified: mspsim/se/sics/mspsim/util/PluginRepository.java =================================================================== --- mspsim/se/sics/mspsim/util/PluginRepository.java 2009-09-07 22:39:39 UTC (rev 592) +++ mspsim/se/sics/mspsim/util/PluginRepository.java 2009-09-08 09:47:22 UTC (rev 593) @@ -49,19 +49,11 @@ import java.util.jar.JarFile; import java.util.jar.Manifest; -public class PluginRepository { +public class PluginRepository implements ActiveComponent { - private static PluginRepository repository = new PluginRepository(); - - public static PluginRepository getDefault() { - return repository; - } - - private URLClassLoader classLoader; - private PluginBundle[] pluginBundles; - private PluginRepository() { + public void init(String name, ComponentRegistry registry) { File dir = new File("lib"); if (dir.isDirectory()) { File[] files = dir.listFiles(new JarFilter()); @@ -85,20 +77,16 @@ classLoader = URLClassLoader.newInstance(jarFiles); - PluginBundle[] bundles = new PluginBundle[pluginCount]; for (int i = 0; i < pluginCount; i++) { - bundles[i] = (PluginBundle) classLoader.loadClass(plugins[i]).newInstance(); -// System.out.println("PluginBundle: " + bundles[i].getClass() -// + " (" + plugins[i] + ')'); + try { + PluginBundle bundle = (PluginBundle) classLoader.loadClass(plugins[i]).newInstance(); + // System.out.println("PluginBundle: " + bundles[i].getClass() + // + " (" + plugins[i] + ')'); + bundle.init(registry); + } catch (Exception e) { + // TODO: handle exception + } } - this.pluginBundles = bundles; - - } catch (ClassNotFoundException e) { - e.printStackTrace(); - } catch (InstantiationException e) { - e.printStackTrace(); - } catch (IllegalAccessException e) { - e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } @@ -106,9 +94,13 @@ } } - public PluginBundle[] getBundles() { - return pluginBundles; + public Class<?> loadClass(String name) throws ClassNotFoundException { + if (classLoader == null) throw new ClassNotFoundException(name); + return classLoader.loadClass(name); } + + public void start() { + } private static class JarFilter implements FileFilter { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2009-09-07 22:39:53
|
Revision: 592 http://mspsim.svn.sourceforge.net/mspsim/?rev=592&view=rev Author: nifi Date: 2009-09-07 22:39:39 +0000 (Mon, 07 Sep 2009) Log Message: ----------- Plugin for Contiki OS: warns if modules are used before they are initialized Modified Paths: -------------- mspsim/Makefile mspsim/scripts/autorun.sc Added Paths: ----------- mspsim/se/sics/mspsim/plugin/ mspsim/se/sics/mspsim/plugin/ContikiChecker.java Modified: mspsim/Makefile =================================================================== --- mspsim/Makefile 2009-09-07 22:28:01 UTC (rev 591) +++ mspsim/Makefile 2009-09-07 22:39:39 UTC (rev 592) @@ -68,7 +68,7 @@ SCRIPTS := ${addprefix scripts/,autorun.sc duty.sc} BINARY := README.txt license.txt CHANGE_LOG.txt images/*.jpg firmware/*/*.firmware ${SCRIPTS} -PACKAGES := se/sics/mspsim ${addprefix se/sics/mspsim/,core platform platform/esb platform/sky cli ui util chip net extutil/highlight extutil/jfreechart} +PACKAGES := se/sics/mspsim ${addprefix se/sics/mspsim/,core platform platform/esb platform/sky cli ui util chip net plugin extutil/highlight extutil/jfreechart} SOURCES := ${wildcard *.java $(addsuffix /*.java,$(PACKAGES))} Modified: mspsim/scripts/autorun.sc =================================================================== --- mspsim/scripts/autorun.sc 2009-09-07 22:28:01 UTC (rev 591) +++ mspsim/scripts/autorun.sc 2009-09-07 22:39:39 UTC (rev 592) @@ -3,4 +3,9 @@ #exec rm log.txt #log CC2420 >log.txt #printcalls >log.txt + +# Install and activate the plugin 'ContikiChecker' +# install ContikiChecker +# contikichecker + start Added: mspsim/se/sics/mspsim/plugin/ContikiChecker.java =================================================================== --- mspsim/se/sics/mspsim/plugin/ContikiChecker.java (rev 0) +++ mspsim/se/sics/mspsim/plugin/ContikiChecker.java 2009-09-07 22:39:39 UTC (rev 592) @@ -0,0 +1,135 @@ +/* + * Copyright (c) 2009, Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $Id$ + * + * ----------------------------------------------------------------- + * + * ContikiChecker + * + * Authors : Joakim Eriksson, Niclas Finne + * Created : 7 sep 2009 + * Updated : $Date$ + * $Revision$ + */ + +package se.sics.mspsim.plugin; +import java.util.Hashtable; +import se.sics.mspsim.cli.BasicAsyncCommand; +import se.sics.mspsim.cli.CommandContext; +import se.sics.mspsim.cli.CommandHandler; +import se.sics.mspsim.core.MSP430; +import se.sics.mspsim.core.Profiler; +import se.sics.mspsim.profiler.CallListener; +import se.sics.mspsim.util.ActiveComponent; +import se.sics.mspsim.util.ComponentRegistry; +import se.sics.mspsim.util.MapEntry; + +/** + * + */ +public class ContikiChecker implements CallListener, ActiveComponent { + + private ComponentRegistry registry; + + private CommandContext context; + private Profiler profiler; + + private Hashtable<String,Integer> callTable = new Hashtable<String,Integer>(); + private int callCount = 0; + + public void init(String name, ComponentRegistry registry) { + this.registry = registry; + } + + public void start() { + CommandHandler commandHandler = (CommandHandler) registry.getComponent("commandHandler"); + if (commandHandler != null) { + commandHandler.registerCommand("contikichecker", new BasicAsyncCommand("enable the Contiki checker", "") { + + @Override + public int executeCommand(CommandContext context) { + if (profiler != null) { + context.err.println("already running"); + return 1; + } + MSP430 cpu = (MSP430) registry.getComponent(MSP430.class); + profiler = cpu.getProfiler(); + if (profiler == null) { + context.err.println("no profiler available"); + return 1; + } + ContikiChecker.this.context = context; + profiler.addCallListener(ContikiChecker.this); + return 0; + } + + public void stopCommand(CommandContext context) { + if (profiler != null) { + profiler.removeCallListener(ContikiChecker.this); + profiler = null; + } + ContikiChecker.this.context = null; + }}); + } + } + + public void functionCall(Profiler source, MapEntry entry) { + // Check for function calls before <prefix>_init() has been called. + String name = entry.getName(); + if (name != null && callTable.get(name) == null) { + boolean addEntry = true; + int index = name.indexOf('_'); + if (index > 0 && !name.endsWith("_init")) { + int lastIndex = name.lastIndexOf('_'); + String init1 = name.substring(0, index + 1) + "init"; + String init2 = index != lastIndex ? (name.substring(0, lastIndex + 1) + "init") : null; + if (callTable.get(init1) == null && (init2 == null || callTable.get(init2) == null)) { + // Warning, lookup in case an init function exists + if (context.getMapTable().getFunctionAddress(init1) > 0) { + context.err.println("ContikiChecker: warning, " + name + " is called before " + init1); + profiler.printStackTrace(context.err); + addEntry = false; + } else if (init2 != null && context.getMapTable().getFunctionAddress(init2) > 0) { + context.err.println("ContikiChecker: warning, " + name + " is called before " + init2); + profiler.printStackTrace(context.err); + addEntry = false; + } + } + } + if (addEntry) { + callTable.put(name, ++callCount); + } + } + } + + public void functionReturn(Profiler source, MapEntry entry) { + // Ignore returns + } + +} Property changes on: mspsim/se/sics/mspsim/plugin/ContikiChecker.java ___________________________________________________________________ Added: svn:keywords + Rev Date Id Added: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2009-09-07 22:28:15
|
Revision: 591 http://mspsim.svn.sourceforge.net/mspsim/?rev=591&view=rev Author: nifi Date: 2009-09-07 22:28:01 +0000 (Mon, 07 Sep 2009) Log Message: ----------- ignore empty lines Modified Paths: -------------- mspsim/se/sics/mspsim/cli/CommandParser.java Modified: mspsim/se/sics/mspsim/cli/CommandParser.java =================================================================== --- mspsim/se/sics/mspsim/cli/CommandParser.java 2009-09-07 21:30:45 UTC (rev 590) +++ mspsim/se/sics/mspsim/cli/CommandParser.java 2009-09-07 22:28:01 UTC (rev 591) @@ -62,10 +62,11 @@ } public static String[][] parseLine(String line, boolean handlePipes, boolean handleRedirect) { - if (line.charAt(0) == '#') { + line = line.trim(); + if (line.length() == 0 || line.charAt(0) == '#') { return null; } - + ArrayList<String[]> list = new ArrayList<String[]>(); ArrayList<String> args = new ArrayList<String>(); StringBuilder sb = null; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2009-09-07 21:30:53
|
Revision: 590 http://mspsim.svn.sourceforge.net/mspsim/?rev=590&view=rev Author: nifi Date: 2009-09-07 21:30:45 +0000 (Mon, 07 Sep 2009) Log Message: ----------- added handling of call listeners Modified Paths: -------------- mspsim/se/sics/mspsim/util/SimpleProfiler.java Modified: mspsim/se/sics/mspsim/util/SimpleProfiler.java =================================================================== --- mspsim/se/sics/mspsim/util/SimpleProfiler.java 2009-09-07 19:39:40 UTC (rev 589) +++ mspsim/se/sics/mspsim/util/SimpleProfiler.java 2009-09-07 21:30:45 UTC (rev 590) @@ -71,7 +71,9 @@ private MSP430Core cpu; private PrintStream logger; private boolean hideIRQ = false; - + + private CallListener[] callListeners; + /* statistics for interrupts */ private long[] lastInterruptTime = new long[16]; private long[] interruptTime = new long[16]; @@ -135,6 +137,13 @@ ce.exclusiveCycles = cycles; ce.hide = hide; newIRQ = false; + + CallListener[] listeners = callListeners; + if (listeners != null) { + for (int i = 0, n = listeners.length; i < n; i++) { + listeners[i].functionCall(this, entry); + } + } } public void profileReturn(long cycles) { @@ -179,6 +188,13 @@ logger.println("return from " + ce.function.getInfo() + " elapsed: " + elapsed); } } + + CallListener[] listeners = callListeners; + if (listeners != null) { + for (int i = 0, n = listeners.length; i < n; i++) { + listeners[i].functionReturn(this, fkn); + } + } } newIRQ = false; } @@ -451,11 +467,13 @@ } } - public void addCallListener(CallListener listener) { - // TODO + public synchronized void addCallListener(CallListener listener) { + callListeners = (CallListener[]) + ArrayUtils.add(CallListener.class, callListeners, listener); } public void removeCallListener(CallListener listener) { - // TODO + callListeners = (CallListener[]) + ArrayUtils.remove(callListeners, listener); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2009-09-07 19:39:49
|
Revision: 589 http://mspsim.svn.sourceforge.net/mspsim/?rev=589&view=rev Author: joxe Date: 2009-09-07 19:39:40 +0000 (Mon, 07 Sep 2009) Log Message: ----------- added sysinfo command that lists some information about the running MSPSim system Modified Paths: -------------- mspsim/se/sics/mspsim/cli/MiscCommands.java mspsim/se/sics/mspsim/core/USART.java mspsim/se/sics/mspsim/platform/GenericNode.java mspsim/se/sics/mspsim/util/ComponentRegistry.java Modified: mspsim/se/sics/mspsim/cli/MiscCommands.java =================================================================== --- mspsim/se/sics/mspsim/cli/MiscCommands.java 2009-09-07 15:10:32 UTC (rev 588) +++ mspsim/se/sics/mspsim/cli/MiscCommands.java 2009-09-07 19:39:40 UTC (rev 589) @@ -53,8 +53,10 @@ import se.sics.mspsim.chip.RFSource; import se.sics.mspsim.core.Chip; import se.sics.mspsim.core.MSP430; +import se.sics.mspsim.core.MSP430Constants; import se.sics.mspsim.core.TimeEvent; import se.sics.mspsim.util.ActiveComponent; +import se.sics.mspsim.util.ArgumentManager; import se.sics.mspsim.util.ComponentRegistry; import se.sics.mspsim.util.Utils; @@ -365,6 +367,20 @@ } } }); + + handler.registerCommand("sysinfo", new BasicCommand("show info about the MSPSim system", "") { + public int executeCommand(CommandContext context) { + ArgumentManager config = (ArgumentManager) registry.getComponent("config"); + context.out.println("--------- System info ----------\n"); + context.out.println("MSPSim version: " + MSP430Constants.VERSION); + context.out.println("Firmware : " + config.getProperty("firmwareFile")); + context.out.println("AutoloadScript: " + config.getProperty("autoloadScript")); + context.out.println(); + context.out.println("--------- Registry info --------\n"); + registry.printRegistry(context.out); + return 0; + } + }); } } Modified: mspsim/se/sics/mspsim/core/USART.java =================================================================== --- mspsim/se/sics/mspsim/core/USART.java 2009-09-07 15:10:32 UTC (rev 588) +++ mspsim/se/sics/mspsim/core/USART.java 2009-09-07 19:39:40 UTC (rev 589) @@ -299,7 +299,7 @@ // When byte is read - the interruptflag is cleared! // and error status should also be cleared later... if (MSP430Constants.DEBUGGING_LEVEL > 0) { - System.out.println(getName() + " clearing rx interrupt flag " + cpu.getPC()); + System.out.println(getName() + " clearing rx interrupt flag " + cpu.getPC() + " byte: " + tmp); } clrBitIFG(urxifg); if (listener != null) { Modified: mspsim/se/sics/mspsim/platform/GenericNode.java =================================================================== --- mspsim/se/sics/mspsim/platform/GenericNode.java 2009-09-07 15:10:32 UTC (rev 588) +++ mspsim/se/sics/mspsim/platform/GenericNode.java 2009-09-07 19:39:40 UTC (rev 589) @@ -166,11 +166,13 @@ CommandHandler ch = (CommandHandler) registry.getComponent("commandHandler"); script = script.replace('\\', '/'); System.out.println("Autoloading script: " + script); + config.setProperty("autoloadScript", script); if (ch != null) { ch.lineRead("source \"" + script + '"'); } } } + config.setProperty("firmwareFile", firmwareFile); System.out.println("-----------------------------------------------"); System.out.println("MSPSim " + MSP430Constants.VERSION + " starting firmware: " + firmwareFile); System.out.println("-----------------------------------------------"); Modified: mspsim/se/sics/mspsim/util/ComponentRegistry.java =================================================================== --- mspsim/se/sics/mspsim/util/ComponentRegistry.java 2009-09-07 15:10:32 UTC (rev 588) +++ mspsim/se/sics/mspsim/util/ComponentRegistry.java 2009-09-07 19:39:40 UTC (rev 589) @@ -1,4 +1,5 @@ package se.sics.mspsim.util; +import java.io.PrintStream; import java.util.ArrayList; public class ComponentRegistry { @@ -82,4 +83,13 @@ this.component = component; } } + + public void printRegistry(PrintStream out) { + ComponentEntry[] plugs = components.toArray(new ComponentEntry[components.size()]); + out.printf("%-22s %s\n", "Component Name", "Component Class"); + out.println("----------------------------------------------"); + for (int i = 0; i < plugs.length; i++) { + out.printf("%-22s %s\n", plugs[i].name, plugs[i].component.getClass().getName()); + } + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2009-09-07 15:10:43
|
Revision: 588 http://mspsim.svn.sourceforge.net/mspsim/?rev=588&view=rev Author: joxe Date: 2009-09-07 15:10:32 +0000 (Mon, 07 Sep 2009) Log Message: ----------- removed @Override on some interfaces Modified Paths: -------------- mspsim/se/sics/mspsim/util/SimpleProfiler.java Modified: mspsim/se/sics/mspsim/util/SimpleProfiler.java =================================================================== --- mspsim/se/sics/mspsim/util/SimpleProfiler.java 2009-09-07 15:05:58 UTC (rev 587) +++ mspsim/se/sics/mspsim/util/SimpleProfiler.java 2009-09-07 15:10:32 UTC (rev 588) @@ -284,7 +284,6 @@ HashMap<MapEntry,Integer> callers = callEntry.callers; List<Entry<MapEntry, Integer>> list = new LinkedList<Entry<MapEntry, Integer>>(callers.entrySet()); Collections.sort(list, new Comparator<Entry<MapEntry, Integer>>() { - @Override public int compare(Entry<MapEntry, Integer> o1, Entry<MapEntry, Integer> o2) { return o2.getValue().compareTo(o1.getValue()); } @@ -452,12 +451,10 @@ } } - @Override public void addCallListener(CallListener listener) { // TODO } - @Override public void removeCallListener(CallListener listener) { // TODO } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |