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...> - 2008-02-06 13:40:05
|
Revision: 111 http://mspsim.svn.sourceforge.net/mspsim/?rev=111&view=rev Author: joxe Date: 2008-02-06 05:40:01 -0800 (Wed, 06 Feb 2008) Log Message: ----------- added symbolic names to assembly level debugger. Modified Paths: -------------- mspsim/se/sics/mspsim/core/DisAsm.java Modified: mspsim/se/sics/mspsim/core/DisAsm.java =================================================================== --- mspsim/se/sics/mspsim/core/DisAsm.java 2008-02-06 12:54:58 UTC (rev 110) +++ mspsim/se/sics/mspsim/core/DisAsm.java 2008-02-06 13:40:01 UTC (rev 111) @@ -43,6 +43,7 @@ import java.io.BufferedReader; import java.io.InputStreamReader; +import se.sics.mspsim.util.MapEntry; import se.sics.mspsim.util.MapTable; import se.sics.mspsim.util.Utils; @@ -148,7 +149,13 @@ case AM_IND_AUTOINC: if (register == 0) { // Can this be PC and be incremented only one byte? - adr = "#" + Utils.hex16(memory[pc] + (memory[pc + 1] << 8)); + int tmp = memory[pc] + (memory[pc + 1] << 8); + MapEntry me; + if (map != null && (me = map.getEntry(tmp)) != null) { + adr = me.getName(); // + " = $" + Utils.hex16(tmp); + } else { + adr = "#$" + Utils.hex16(tmp); + } size += 2; } else { adr = "@(R" + register + "+)"; @@ -227,7 +234,7 @@ Utils.binary16(instruction)); } output += dumpMem(startPC, size, memory); - output += opstr + " " + Integer.toString(jmpOffset, 16); + output += opstr + " $" + Utils.hex16(jmpOffset); regs = "\tSR=" + dumpSR(reg[SR]); break; default: @@ -263,13 +270,20 @@ // Indexed if reg != PC & CG1/CG2 - will PC be incremented? if (srcRegister == CG1) { srcAddress = memory[pc] + (memory[pc + 1] << 8); - srcadr = "&" + Utils.hex16(srcAddress); + + MapEntry me; + if (map != null && (me = map.getEntry(srcAddress)) != null) { + srcadr = "&" + me.getName(); // + " = $" + Utils.hex16(srcAddress); + } else { + srcadr = "&$" + Utils.hex16(srcAddress); + } size += 2; } else if (srcRegister == CG2) { srcadr = "#1"; } else { srcAddress = reg[srcRegister] + memory[pc] + (memory[pc + 1] << 8); - srcadr = "(R" + srcRegister + ")"; + srcadr = "$" + Utils.hex16(memory[pc] + (memory[pc + 1] << 8)) + "(R" + srcRegister + ")"; + size += 2; } break; // Indirect register @@ -288,11 +302,11 @@ } else if (srcRegister == CG1) { srcadr = "#8"; } else if (srcRegister == PC) { - srcadr = "#" + Utils.hex16(memory[pc] + (memory[pc + 1] << 8)); + srcadr = "#$" + Utils.hex16(memory[pc] + (memory[pc + 1] << 8)); pc += 2; size += 2; } else if (srcRegister == CG2) { - srcadr = "#ffff"; + srcadr = "#$ffff"; } else { srcadr = "@" + getRegName(srcRegister) + "+"; srcAddress = reg[srcRegister]; @@ -304,10 +318,19 @@ dstadr = getRegName(dstRegister); } else { dstAddress = memory[pc] + (memory[pc + 1] << 8); + MapEntry me = map != null ? map.getEntry(dstAddress) : null; if (dstRegister == 2) { - dstadr = "&" + Utils.hex16(dstAddress); + if (me != null) { + dstadr = "&" + me.getName(); // + " = $" + Utils.hex16(srcAddress); + } else { + dstadr = "&$" + Utils.hex16(dstAddress); + } } else { - dstadr = Utils.hex16(dstAddress) + "(R" + dstRegister + ")"; + if (me != null) { + dstadr = me.getName() + "(R" + dstRegister + ")"; + } else { + dstadr = "$" + Utils.hex16(dstAddress) + "(R" + dstRegister + ")"; + } } pc += 2; size += 2; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2008-02-06 12:55:13
|
Revision: 110 http://mspsim.svn.sourceforge.net/mspsim/?rev=110&view=rev Author: joxe Date: 2008-02-06 04:54:58 -0800 (Wed, 06 Feb 2008) Log Message: ----------- Fixed timer bug - causing timer overflow interrupts to never happen. Modified Paths: -------------- mspsim/se/sics/mspsim/core/Timer.java Modified: mspsim/se/sics/mspsim/core/Timer.java =================================================================== --- mspsim/se/sics/mspsim/core/Timer.java 2008-02-05 15:13:28 UTC (rev 109) +++ mspsim/se/sics/mspsim/core/Timer.java 2008-02-06 12:54:58 UTC (rev 110) @@ -133,7 +133,11 @@ private long lastCycles = 0; private long counterStart = 0; + private long nextTimerTrigger = 0; + // valid for timer A + private int timerOverflow = 0x0a; + // Input map for timer A public static final int[] TIMER_Ax149 = new int[] { SRC_PORT + 0x10, SRC_ACLK, SRC_SMCLK, SRC_PORT + 0x21, // Timer @@ -164,7 +168,7 @@ // If clocked by anything other than the SubMainClock at full // speed this needs to be calculated for correct handling. // Should be something like inputDivider * SMCLK_SPEED / CLK_SRC_SPEED; - private int cyclesMultiplicator = 1; + private double cyclesMultiplicator = 1; private int clockSource; private int mode; @@ -173,6 +177,7 @@ private int countDirection = 1; // The IO registers + private int tctl; private int[] tcctl = new int[7]; private int[] tccr = new int[7]; @@ -212,8 +217,10 @@ } if (srcMap == TIMER_Ax149) { type = TIMER_A; + timerOverflow = 0x0a; } else { type = TIMER_B; + timerOverflow = 0x0e; } reset(); } @@ -242,19 +249,27 @@ resetTIV(); } - if (address != 0x166) { - if (DEBUG && false) { - System.out.println("Read: " + Utils.hex16(address) + " => " + - Utils.hex16(memory[address] + - (memory[address + 1] << 8)) + " (" + - (memory[address] + (memory[address + 1] << 8)) + ")"); - } - } - int index = address - offset; switch(index) { case TR: - return updateCounter(cycles); + val = updateCounter(cycles); + break; + case TCTL: + val = tctl; + if (interruptPending) { + val |= 1; + } else { + val &= 0xfffe; + } + System.out.println(getName() + " Read: Timer_" + name[type] + + " CTL: inDiv:" + inputDivider + + " src: " + getSourceName(clockSource) + + " IEn:" + interruptEnable + " IFG: " + + interruptPending + " mode: " + mode); + + + + break; case TCCTL0: case TCCTL1: case TCCTL2: @@ -263,7 +278,8 @@ case TCCTL5: case TCCTL6: int i = (index - TCCTL0) / 2; - return tcctl[i]; + val = tcctl[i]; + break; case TCCR0: case TCCR1: case TCCR2: @@ -272,14 +288,28 @@ case TCCR5: case TCCR6: i = (index - TCCR0) / 2; - return tccr[i]; + val = tccr[i]; + break; } + + if (DEBUG) { + System.out.println(getName() + ": Read " + getName(address) + "(" + Utils.hex16(address) + ") => " + + Utils.hex16(val) + " (" + val + ")"); + } // It reads the interrupt flag for capture... - return val; + return val & 0xffff; } private void resetTIV() { + if (lastTIV == timerOverflow) { + interruptPending = false; + lastTIV = 0; + if (DEBUG) { + System.out.println(getName() + " Clearing TIV - overflow "); + } + triggerInterrupts(); + } if (lastTIV / 2 < noCompare) { if (DEBUG) { System.out.println(getName() + " Clearing TIV/Comparex2: " + lastTIV); @@ -308,7 +338,7 @@ break; case TCTL: if (DEBUG) { - System.out.println(getName() + " wrote to TCTL: " + data); + System.out.println(getName() + " wrote to TCTL: " + Utils.hex16(data)); } inputDivider = 1 << ((data >> 6) & 3); clockSource = srcMap[(data >> 8) & 3]; @@ -318,38 +348,45 @@ cyclesMultiplicator = (cyclesMultiplicator * core.smclkFrq) / core.aclkFrq; if (DEBUG) { - System.out.println(getName() + " setting multiplicator to: " + - cyclesMultiplicator); + System.out.println(getName() + " setting multiplicator to: " + cyclesMultiplicator); } } - mode = (data >> 4) & 3; - + if ((data & TCLR) != 0) { counter = 0; counterStart = cycles; // inputDivider = 1; ???? countDirection = 1; - // Clear this bit... - memory[address] &= ~4; } - interruptEnable = (data & 1) > 0; + int newMode = (data >> 4) & 3; + if (mode == STOP && newMode != STOP) { + updateCounter(cycles); + // Wait until full wrap before setting the IRQ flag! + nextTimerTrigger = (long) (cycles + cyclesMultiplicator * ((0xffff - counter) & 0xffff)); + } + mode = newMode; + + interruptEnable = (data & 0x02) > 0; if (DEBUG) { System.out.println(getName() + " Write: Timer_" + name[type] + " CTL: inDiv:" + inputDivider + " src: " + getSourceName(clockSource) + - " IE:" + interruptEnable + " IP: " + + " IEn:" + interruptEnable + " IFG: " + interruptPending + " mode: " + mode + ((data & TCLR) != 0 ? " CLR" : "")); } - // Write back the interrupt pending info... - if (interruptPending) { - memory[address] |= 1; - } else { - memory[address] &= 0xfe; + // Write to the tctl. + tctl = data; + // Clear clear bit + tctl &= ~0x04; + + // Clear interrupt pending if so requested... + if ((data & 0x01) == 0) { + interruptPending = false; } updateCaptures(-1, cycles); @@ -396,18 +433,19 @@ index = (iAddress - TCCR0) / 2; tccr[index] = data; updateCounter(cycles); + + int diff = data - counter; + if (diff < 0) { + // Ok we need to wrap! + diff += 0x10000; + } if (DEBUG) { System.out.println(getName() + " Write: Setting compare " + index + " to " + Utils.hex16(data) + " TR: " + - Utils.hex16(counter)); + Utils.hex16(counter) + " diff: " + Utils.hex16(diff)); } - int diff = data - counter; - if (diff < 0) { - // Ok we need to wrap! - diff += 0x10000; - } - expCaptureTime[index] = cycles + cyclesMultiplicator * diff; + expCaptureTime[index] = cycles + (long)(cyclesMultiplicator * diff); if (DEBUG) { System.out.println(getName() + " Cycles: " + cycles + " expCap[" + index + "]: " + expCaptureTime[index] + " ctr:" + counter + " data: " + data + " ~" + @@ -415,7 +453,7 @@ } } } - + private void setCounter(int newCtr, long cycles) { counter = newCtr; counterStart = cycles; @@ -458,7 +496,7 @@ expCompare[i] = (counter + expCapInterval[i]) & 0xffff; // This could be formulated in something other than cycles... // ...??? should be multiplied with clockspeed diff also? - expCaptureTime[i] = cycles + expCapInterval[i] * cyclesMultiplicator; + expCaptureTime[i] = cycles + (long)(expCapInterval[i] * cyclesMultiplicator); if (DEBUG) { System.out.println(getName() + " Expected compare " + i + @@ -495,14 +533,22 @@ counter = 2 * tccr[0] - counter; } } -// System.out.println(getName() + "Updating counter cycctr: " + cycctr + " divider: " + divider + " mode:" + mode + " => " + counter); + if (DEBUG) { + System.out.println(getName() + ": Updating counter cycctr: " + cycctr + " divider: " + divider + " mode:" + mode + " => " + counter); + } return counter; } // Simplest possible - just a call each 1000 cycles (which is wrong...) public long ioTick(long cycles) { + if (cycles > nextTimerTrigger) { + interruptPending = true; + // This should be updated whenever clockspeed changes... + nextTimerTrigger = (long) (nextTimerTrigger + 0x10000 * cyclesMultiplicator); + } + // This will not work very good... // But the timer does not need to be updated this often... // Do we need to update the counter here??? @@ -536,7 +582,7 @@ // Update expected compare time for this compare/cap reg. // 0x10000 cycles... e.g. a full 16 bits wrap of the timer expCaptureTime[i] = expCaptureTime[i] + - 0x10000 * cyclesMultiplicator; + (long) (0x10000 * cyclesMultiplicator); if (DEBUG) { System.out.println(getName() + " setting expCaptureTime to full wrap: " + @@ -563,6 +609,7 @@ public void triggerInterrupts() { // First check if any capture register is generating an interrupt... boolean trigger = false; + int tIndex = 0; for (int i = 0, n = noCompare; i < n; i++) { boolean newTrigger = (tcctl[i] & CC_TRIGGER_INT) == CC_TRIGGER_INT; @@ -570,34 +617,42 @@ // This only triggers interrupts - reading TIV clears!??! if (i == 0) { - // Execute the interrupt vector... the high-pri one... - core.flagInterrupt(type == TIMER_A ? TACCR0_VECTOR : TBCCR0_VECTOR, - this, trigger); - // Trigger this! - // This is handled by its own vector!!! - if (trigger) { - lastTIV = memory[type == TIMER_A ? TAIV : TBIV] = 0; - trigger = false; - } + // Execute the interrupt vector... the high-pri one... + core.flagInterrupt(type == TIMER_A ? TACCR0_VECTOR : TBCCR0_VECTOR, + this, trigger); + // Trigger this! + // This is handled by its own vector!!! + if (trigger) { + lastTIV = memory[type == TIMER_A ? TAIV : TBIV] = 0; + return; + } } else { - // Which would have the highest pri? Will/should this trigger more - // than one interrupt at a time?!!?!?! - // If so, which TIV would be the correct one? - if (newTrigger) { - if (DEBUG) { - System.out.println(getName() + " triggering interrupt TIV: " + - (i * 2)); - } - tIndex = i; - } + // Which would have the highest pri? Will/should this trigger more + // than one interrupt at a time?!!?!?! + // If so, which TIV would be the correct one? + if (newTrigger) { + if (DEBUG) { + System.out.println(getName() + " triggering interrupt TIV: " + + (i * 2)); + } + tIndex = i; + } } + if (trigger) { + // Or if other CCR execute the normal one with correct TAIV + lastTIV = memory[type == TIMER_A ? TAIV : TBIV] = tIndex * 2; + } } + + if (!trigger) { + if (interruptEnable && interruptPending) { + trigger = true; + lastTIV = memory[type == TIMER_A ? TAIV : TBIV] = timerOverflow; + } + } + core.flagInterrupt(type == TIMER_A ? TACCR1_VECTOR : TBCCR1_VECTOR, this, trigger); - if (trigger) { - // Or if other CCR execute the normal one with correct TAIV - lastTIV = memory[type == TIMER_A ? TAIV : TBIV] = tIndex * 2; - } } public String getSourceName(int source) { @@ -635,4 +690,14 @@ public int getModeMax() { return 0; } + + public String getName(int address) { + int reg = address - offset; + if (reg == 0) return "TCTL"; + if (reg < 0x10) return "TCTL" + (reg - 2) / 2; + if (reg == 0x10) return "TR"; + if (reg < 0x20) return "TCCR" + (reg - 0x12) / 2; + return " UNDEF(" + Utils.hex16(address) + ")"; + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2008-02-05 15:13:41
|
Revision: 109 http://mspsim.svn.sourceforge.net/mspsim/?rev=109&view=rev Author: nifi Date: 2008-02-05 07:13:28 -0800 (Tue, 05 Feb 2008) Log Message: ----------- fixed bug in ext flash for Sky plattform Modified Paths: -------------- mspsim/se/sics/mspsim/chip/M25P80.java Modified: mspsim/se/sics/mspsim/chip/M25P80.java =================================================================== --- mspsim/se/sics/mspsim/chip/M25P80.java 2008-02-05 14:38:32 UTC (rev 108) +++ mspsim/se/sics/mspsim/chip/M25P80.java 2008-02-05 15:13:28 UTC (rev 109) @@ -79,7 +79,7 @@ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }; private int readAddress; - private int loadedAddress; + private int loadedAddress = -1; private int blockWriteAddress; private byte[] readMemory = new byte[256]; private byte[] buffer = new byte[256]; @@ -234,7 +234,8 @@ } private void ensureLoaded(int address) { - if (!((loadedAddress & 0xfff00) == (address & 0xfff00))) { + if (loadedAddress < 0 + || ((loadedAddress & 0xfff00) != (address & 0xfff00))) { try { if (DEBUG) System.out.println("M25P80: Loading memory: " + (address & 0xfff00)); @@ -274,6 +275,7 @@ private void sectorErase(int address) { int sectorAddress = address & 0xf0000; + loadedAddress = -1; for (int i = 0; i < buffer.length; i++) { buffer[i] = (byte)0xff; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2008-02-05 14:38:39
|
Revision: 108 http://mspsim.svn.sourceforge.net/mspsim/?rev=108&view=rev Author: joxe Date: 2008-02-05 06:38:32 -0800 (Tue, 05 Feb 2008) Log Message: ----------- fixed configuration of ext flash Modified Paths: -------------- mspsim/CHANGE_LOG.txt mspsim/se/sics/mspsim/chip/M25P80.java mspsim/se/sics/mspsim/platform/sky/SkyNode.java Modified: mspsim/CHANGE_LOG.txt =================================================================== --- mspsim/CHANGE_LOG.txt 2008-02-05 14:31:14 UTC (rev 107) +++ mspsim/CHANGE_LOG.txt 2008-02-05 14:38:32 UTC (rev 108) @@ -1,3 +1,7 @@ +0.83 +Changes: +- added support for external flash on Sky node (M25P80) + 0.82 - JFreechart, operation mode statistics (2008-02-03) Changes: - added jfreechart diagrams for stack and operation mode statistics Modified: mspsim/se/sics/mspsim/chip/M25P80.java =================================================================== --- mspsim/se/sics/mspsim/chip/M25P80.java 2008-02-05 14:31:14 UTC (rev 107) +++ mspsim/se/sics/mspsim/chip/M25P80.java 2008-02-05 14:38:32 UTC (rev 108) @@ -86,15 +86,18 @@ private RandomAccessFile file; - public M25P80(USART usart) { + public M25P80(USART usart, String filename) { this.usart = usart; + if (filename == null) + filename = "flash.bin"; + // Open flash file for R/W try { - file = new RandomAccessFile("flash.bin", "rw"); + file = new RandomAccessFile(filename, "rw"); } catch (FileNotFoundException e) { e.printStackTrace(); return; } - + // Set size of flash try { file.setLength(1024 * 1024); } catch (IOException e) { Modified: mspsim/se/sics/mspsim/platform/sky/SkyNode.java =================================================================== --- mspsim/se/sics/mspsim/platform/sky/SkyNode.java 2008-02-05 14:31:14 UTC (rev 107) +++ mspsim/se/sics/mspsim/platform/sky/SkyNode.java 2008-02-05 14:38:32 UTC (rev 108) @@ -91,6 +91,7 @@ private CC2420 radio; private M25P80 flash; + private String flashFile; public static final int BLUE_LED = 0x40; public static final int GREEN_LED = 0x20; @@ -108,8 +109,9 @@ * Creates a new <code>SkyNode</code> instance. * */ - public SkyNode(MSP430 cpu) { + public SkyNode(MSP430 cpu, String flashFile) { this.cpu = cpu; + this.flashFile = flashFile; IOUnit unit = cpu.getIOUnit("Port 5"); if (unit instanceof IOPort) { port5 = (IOPort) unit; @@ -132,7 +134,7 @@ radio.setCCAPort(port1, CC2420_CCA); radio.setFIFOPPort(port1, CC2420_FIFOP); radio.setFIFOPort(port1, CC2420_FIFO); - flash = new M25P80((USART)usart0); + flash = new M25P80((USART)usart0, flashFile); ((USART) usart0).setUSARTListener(this); port4 = (IOPort) cpu.getIOUnit("Port 4"); if (port4 != null && port4 instanceof IOPort) { @@ -222,9 +224,19 @@ cpu.getDisAsm().setMap(map); cpu.setMap(map); } - + + // create a filename for the flash file + // This should be possible to take from a config file later! + String fileName = args[0]; + int ix = fileName.lastIndexOf('.'); + if (ix > 0) { + fileName = fileName.substring(0, ix); + } + fileName = fileName + ".flash"; + System.out.println("Using flash file: " + fileName); + cpu.reset(); - SkyNode node = new SkyNode(cpu); + SkyNode node = new SkyNode(cpu, fileName); node.gui = new SkyGui(node); ControlUI control = new ControlUI(cpu, elf); HighlightSourceViewer sourceViewer = new HighlightSourceViewer(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2008-02-05 14:31:16
|
Revision: 107 http://mspsim.svn.sourceforge.net/mspsim/?rev=107&view=rev Author: joxe Date: 2008-02-05 06:31:14 -0800 (Tue, 05 Feb 2008) Log Message: ----------- First working version of external flash for the Sky platform Modified Paths: -------------- mspsim/se/sics/mspsim/chip/CC2420.java mspsim/se/sics/mspsim/chip/M25P80.java mspsim/se/sics/mspsim/core/MSP430Constants.java mspsim/se/sics/mspsim/platform/sky/SkyNode.java Modified: mspsim/se/sics/mspsim/chip/CC2420.java =================================================================== --- mspsim/se/sics/mspsim/chip/CC2420.java 2008-02-05 00:26:31 UTC (rev 106) +++ mspsim/se/sics/mspsim/chip/CC2420.java 2008-02-05 14:31:14 UTC (rev 107) @@ -45,7 +45,7 @@ public class CC2420 extends Chip implements USARTListener { - public static final boolean DEBUG = true; + public static final boolean DEBUG = false; public static final int REG_SNOP = 0x00; public static final int REG_SXOSCON = 0x01; @@ -195,7 +195,7 @@ if (address == REG_RXFIFO) { // check read/write??? - System.out.println("CC2420: Reading RXFIFO!!!"); +// System.out.println("CC2420: Reading RXFIFO!!!"); state = READ_RXFIFO; } else if (address == REG_TXFIFO) { state = WRITE_TXFIFO; @@ -233,8 +233,8 @@ } break; case READ_RXFIFO: - System.out.println("CC2420: RXFIFO READ => " + - memory[RAM_RXFIFO + rxCursor]); +// System.out.println("CC2420: RXFIFO READ => " + +// memory[RAM_RXFIFO + rxCursor]); source.byteReceived(memory[RAM_RXFIFO + rxCursor++]); // What if wrap cursor??? if (rxCursor >= 128) rxCursor = 0; @@ -276,19 +276,19 @@ switch (data) { case REG_SRXON: - System.out.println("CC2420: Strobe RX-ON!!!"); +// System.out.println("CC2420: Strobe RX-ON!!!"); setMode(MODE_RX_ON); break; case REG_SRFOFF: - System.out.println("CC2420: Strobe RXTX-OFF!!!"); +// System.out.println("CC2420: Strobe RXTX-OFF!!!"); setMode(MODE_TXRX_OFF); break; case REG_STXON: - System.out.println("CC2420: Strobe TXON!"); +// System.out.println("CC2420: Strobe TXON!"); setMode(MODE_TXRX_ON); break; case REG_STXONCCA: - System.out.println("CC2420: Strobe TXONCCA!"); +// System.out.println("CC2420: Strobe TXONCCA!"); setMode(MODE_TXRX_ON); break; case REG_SFLUSHRX: @@ -307,7 +307,7 @@ chipSelect = select; if (!chipSelect) state = WAITING; - System.out.println("CC2420: chipSelect: " + chipSelect); +// System.out.println("CC2420: chipSelect: " + chipSelect); } public void setCCAPort(IOPort port, int pin) { Modified: mspsim/se/sics/mspsim/chip/M25P80.java =================================================================== --- mspsim/se/sics/mspsim/chip/M25P80.java 2008-02-05 00:26:31 UTC (rev 106) +++ mspsim/se/sics/mspsim/chip/M25P80.java 2008-02-05 14:31:14 UTC (rev 107) @@ -48,6 +48,8 @@ public class M25P80 extends Chip implements USARTListener, PortListener { + public static final boolean DEBUG = false; + public static final int WRITE_STATUS = 0x01; public static final int PAGE_PROGRAM = 0x02; public static final int READ_DATA = 0x03; @@ -78,6 +80,7 @@ }; private int readAddress; private int loadedAddress; + private int blockWriteAddress; private byte[] readMemory = new byte[256]; private byte[] buffer = new byte[256]; @@ -101,7 +104,9 @@ public void dataReceived(USART source, int data) { if (chipSelect) { - System.out.println("M25P80: byte received: " + data); + if (DEBUG) { + System.out.println("M25P80: byte received: " + data); + } switch(state) { case READ_IDENT: source.byteReceived(identity[pos]); @@ -118,7 +123,7 @@ readAddress = (readAddress << 8) + data; source.byteReceived(0); pos++; - if (pos == 3) + if (DEBUG && pos == 3) System.out.println("M25P80: reading from " + Integer.toHexString(readAddress)); } else { source.byteReceived(readMemory(readAddress++)); @@ -127,11 +132,31 @@ } } return; + case SECTOR_ERASE: + if (pos < 3) { + readAddress = (readAddress << 8) + data; + source.byteReceived(0); + pos++; + if (pos == 3) { + // Clear buffer + sectorErase(readAddress); + } + } + return; case PAGE_PROGRAM: if (pos < 3) { readAddress = (readAddress << 8) + data; source.byteReceived(0); pos++; + if (pos == 3) { + // Clear buffer + for (int i = 0; i < buffer.length; i++) { + buffer[i] = (byte) 0xff; + } + blockWriteAddress = readAddress & 0xfff00; + if (DEBUG) + System.out.println("M25P80: programming at " + Integer.toHexString(readAddress)); + } } else { // Do the programming!!! source.byteReceived(0); @@ -139,43 +164,52 @@ } return; } - + if (DEBUG) + System.out.println("M25P80: new command: " + data); switch (data) { case WRITE_ENABLE: - System.out.println("M2580: Write Enable"); + if (DEBUG) + System.out.println("M25P80: Write Enable"); writeEnable = true; break; case WRITE_DISABLE: - System.out.println("M2580: Write Disable"); + if (DEBUG) + System.out.println("M25P80: Write Disable"); writeEnable = false; break; case READ_IDENT: - System.out.println("M2580: Read ident."); + if (DEBUG) + System.out.println("M25P80: Read ident."); state = READ_IDENT; pos = 0; source.byteReceived(identity[pos++]); return; case READ_STATUS: - System.out.println("M2580: Read status."); - status = status & (0xff - 1 - 2) | (writeEnable ? 0x02 : 0x00); + status = (status & (0xff - 1 - 2)) | (writeEnable ? 0x02 : 0x00); source.byteReceived(status); + if (DEBUG) + System.out.println("M25P80: Read status => " + status); return; case WRITE_STATUS: - System.out.println("M2580: Write status"); + if (DEBUG) + System.out.println("M25P80: Write status"); state = WRITE_STATUS; break; case READ_DATA: - System.out.println("M2580: Read Data"); + if (DEBUG) + System.out.println("M25P80: Read Data"); state = READ_DATA; pos = readAddress = 0; break; case PAGE_PROGRAM: - System.out.println("M2580: Page Program"); + if (DEBUG) + System.out.println("M25P80: Page Program"); state = PAGE_PROGRAM; pos = readAddress = 0; break; case SECTOR_ERASE: - System.out.println("M2580: Sector Erase"); + if (DEBUG) + System.out.println("M25P80: Sector Erase"); state = SECTOR_ERASE; pos = 0; break; @@ -186,7 +220,8 @@ // Should return correct data! private int readMemory(int address) { - System.out.println("M2580: Reading memory address: " + Integer.toHexString(address)); + if (DEBUG) + System.out.println("M25P80: Reading memory address: " + Integer.toHexString(address)); ensureLoaded(address); return readMemory[address & 0xff]; } @@ -198,7 +233,8 @@ private void ensureLoaded(int address) { if (!((loadedAddress & 0xfff00) == (address & 0xfff00))) { try { - System.out.println("M2580: Loading memory: " + (address & 0xfff00)); + if (DEBUG) + System.out.println("M25P80: Loading memory: " + (address & 0xfff00)); file.seek(address & 0xfff00); file.readFully(readMemory); } catch (IOException e) { @@ -207,16 +243,59 @@ loadedAddress = address & 0xfff00; } } - + public void portWrite(IOPort source, int data) { // Chip select = active low... + if (chipSelect && (data & CHIP_SELECT) != 0) { + // Chip select will go "off" + switch(state) { + case PAGE_PROGRAM: + programPage(); + break; + } + } chipSelect = (data & CHIP_SELECT) == 0; - System.out.println("M25P80: write to Port4: " + - Integer.toString(data, 16) - + " CS:" + chipSelect); +// System.out.println("M25P80: write to Port4: " + +// Integer.toString(data, 16) +// + " CS:" + chipSelect); state = 0; } + private void programPage() { + ensureLoaded(blockWriteAddress); + for (int i = 0; i < readMemory.length; i++) { + readMemory[i] &= buffer[i]; + } + writeBack(blockWriteAddress, readMemory); + } + + private void sectorErase(int address) { + int sectorAddress = address & 0xf0000; + for (int i = 0; i < buffer.length; i++) { + buffer[i] = (byte)0xff; + } + // Erase a complete sector + blockWriteAddress = sectorAddress; + for (int i = 0; i < 0x100; i++) { + if (DEBUG) + System.out.println("M25P80: erasing at " + Integer.toHexString(blockWriteAddress)); + writeBack(blockWriteAddress, buffer); + blockWriteAddress += 0x100; + } + } + + + private void writeBack(int address, byte[] data) { + try { + if (DEBUG) + System.out.println("M25P80: Writing data to disk at " + Integer.toHexString(address)); + file.seek(address & 0xfff00); + file.write(data); + } catch (IOException e) { + e.printStackTrace(); + } + } + public int getModeMax() { return 0; } Modified: mspsim/se/sics/mspsim/core/MSP430Constants.java =================================================================== --- mspsim/se/sics/mspsim/core/MSP430Constants.java 2008-02-05 00:26:31 UTC (rev 106) +++ mspsim/se/sics/mspsim/core/MSP430Constants.java 2008-02-05 14:31:14 UTC (rev 107) @@ -138,5 +138,5 @@ public static final int CLKCAPTURE_BOTH = 3; - public static final int DEBUGGING_LEVEL = 1; + public static final int DEBUGGING_LEVEL = 0; } Modified: mspsim/se/sics/mspsim/platform/sky/SkyNode.java =================================================================== --- mspsim/se/sics/mspsim/platform/sky/SkyNode.java 2008-02-05 00:26:31 UTC (rev 106) +++ mspsim/se/sics/mspsim/platform/sky/SkyNode.java 2008-02-05 14:31:14 UTC (rev 107) @@ -40,6 +40,7 @@ */ package se.sics.mspsim.platform.sky; +import java.io.File; import java.io.IOException; import se.sics.mspsim.chip.CC2420; @@ -227,6 +228,7 @@ node.gui = new SkyGui(node); ControlUI control = new ControlUI(cpu, elf); HighlightSourceViewer sourceViewer = new HighlightSourceViewer(); + sourceViewer.addSearchPath(new File("../../contiki-2.x/examples/energest-demo/")); control.setSourceViewer(sourceViewer); if (args.length > 1) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2008-02-05 00:26:34
|
Revision: 106 http://mspsim.svn.sourceforge.net/mspsim/?rev=106&view=rev Author: joxe Date: 2008-02-04 16:26:31 -0800 (Mon, 04 Feb 2008) Log Message: ----------- added more debug to xtflash Modified Paths: -------------- mspsim/se/sics/mspsim/chip/M25P80.java Modified: mspsim/se/sics/mspsim/chip/M25P80.java =================================================================== --- mspsim/se/sics/mspsim/chip/M25P80.java 2008-02-05 00:15:39 UTC (rev 105) +++ mspsim/se/sics/mspsim/chip/M25P80.java 2008-02-05 00:26:31 UTC (rev 106) @@ -117,6 +117,9 @@ if (pos < 3) { readAddress = (readAddress << 8) + data; source.byteReceived(0); + pos++; + if (pos == 3) + System.out.println("M25P80: reading from " + Integer.toHexString(readAddress)); } else { source.byteReceived(readMemory(readAddress++)); if (readAddress > 0xfffff) { @@ -128,6 +131,7 @@ if (pos < 3) { readAddress = (readAddress << 8) + data; source.byteReceived(0); + pos++; } else { // Do the programming!!! source.byteReceived(0); @@ -163,12 +167,12 @@ case READ_DATA: System.out.println("M2580: Read Data"); state = READ_DATA; - pos = 0; + pos = readAddress = 0; break; case PAGE_PROGRAM: System.out.println("M2580: Page Program"); state = PAGE_PROGRAM; - pos = 0; + pos = readAddress = 0; break; case SECTOR_ERASE: System.out.println("M2580: Sector Erase"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2008-02-05 00:15:40
|
Revision: 105 http://mspsim.svn.sourceforge.net/mspsim/?rev=105&view=rev Author: joxe Date: 2008-02-04 16:15:39 -0800 (Mon, 04 Feb 2008) Log Message: ----------- added initial emulation of Sky external flash (not complete) Modified Paths: -------------- mspsim/se/sics/mspsim/platform/sky/SkyNode.java Added Paths: ----------- mspsim/se/sics/mspsim/chip/M25P80.java Removed Paths: ------------- mspsim/se/sics/mspsim/platform/sky/ExtFlash.java Added: mspsim/se/sics/mspsim/chip/M25P80.java =================================================================== --- mspsim/se/sics/mspsim/chip/M25P80.java (rev 0) +++ mspsim/se/sics/mspsim/chip/M25P80.java 2008-02-05 00:15:39 UTC (rev 105) @@ -0,0 +1,225 @@ +/** + * Copyright (c) 2007, 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. + * + * This file is part of MSPSim. + * + * $Id: ExtFlash.java,v 1.3 2007/10/21 21:17:34 nfi Exp $ + * + * ----------------------------------------------------------------- + * + * ExtFlash + * + * Author : Joakim Eriksson + * Created : Sun Oct 21 22:00:00 2007 + * Updated : $Date: 2007/10/21 21:17:34 $ + * $Revision: 1.3 $ + */ + +package se.sics.mspsim.chip; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.RandomAccessFile; + +import se.sics.mspsim.core.*; + +public class M25P80 extends Chip implements USARTListener, PortListener { + + public static final int WRITE_STATUS = 0x01; + public static final int PAGE_PROGRAM = 0x02; + public static final int READ_DATA = 0x03; + public static final int WRITE_DISABLE = 0x04; + public static final int READ_STATUS = 0x05; + public static final int WRITE_ENABLE = 0x06; + public static final int READ_DATA_FAST = 0x0b; + public static final int READ_IDENT = 0x9f; + public static final int SECTOR_ERASE = 0xd8; + public static final int BULK_ERASE = 0xc7; + public static final int DEEP_POWER_DOWN = 0xb9; + public static final int WAKE_UP = 0xab; + + private int state = 0; + public static final int CHIP_SELECT = 0x10; + private boolean chipSelect; + + private USART usart; + private int pos; + private int status = 0; + + private boolean writeEnable = false; + + private int[] identity = new int[] { + 0x20,0x20,0x14,0x10, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + }; + private int readAddress; + private int loadedAddress; + private byte[] readMemory = new byte[256]; + private byte[] buffer = new byte[256]; + + private RandomAccessFile file; + + public M25P80(USART usart) { + this.usart = usart; + try { + file = new RandomAccessFile("flash.bin", "rw"); + } catch (FileNotFoundException e) { + e.printStackTrace(); + return; + } + + try { + file.setLength(1024 * 1024); + } catch (IOException e) { + e.printStackTrace(); + } + } + + public void dataReceived(USART source, int data) { + if (chipSelect) { + System.out.println("M25P80: byte received: " + data); + switch(state) { + case READ_IDENT: + source.byteReceived(identity[pos]); + pos++; + if (pos >= identity.length) + pos = 0; + return; + case WRITE_STATUS: + status = data; + source.byteReceived(0); + return; + case READ_DATA: + if (pos < 3) { + readAddress = (readAddress << 8) + data; + source.byteReceived(0); + } else { + source.byteReceived(readMemory(readAddress++)); + if (readAddress > 0xfffff) { + readAddress = 0; + } + } + return; + case PAGE_PROGRAM: + if (pos < 3) { + readAddress = (readAddress << 8) + data; + source.byteReceived(0); + } else { + // Do the programming!!! + source.byteReceived(0); + writeBuffer((readAddress++) & 0xff, data); + } + return; + } + + switch (data) { + case WRITE_ENABLE: + System.out.println("M2580: Write Enable"); + writeEnable = true; + break; + case WRITE_DISABLE: + System.out.println("M2580: Write Disable"); + writeEnable = false; + break; + case READ_IDENT: + System.out.println("M2580: Read ident."); + state = READ_IDENT; + pos = 0; + source.byteReceived(identity[pos++]); + return; + case READ_STATUS: + System.out.println("M2580: Read status."); + status = status & (0xff - 1 - 2) | (writeEnable ? 0x02 : 0x00); + source.byteReceived(status); + return; + case WRITE_STATUS: + System.out.println("M2580: Write status"); + state = WRITE_STATUS; + break; + case READ_DATA: + System.out.println("M2580: Read Data"); + state = READ_DATA; + pos = 0; + break; + case PAGE_PROGRAM: + System.out.println("M2580: Page Program"); + state = PAGE_PROGRAM; + pos = 0; + break; + case SECTOR_ERASE: + System.out.println("M2580: Sector Erase"); + state = SECTOR_ERASE; + pos = 0; + break; + } + source.byteReceived(0); + } + } + + // Should return correct data! + private int readMemory(int address) { + System.out.println("M2580: Reading memory address: " + Integer.toHexString(address)); + ensureLoaded(address); + return readMemory[address & 0xff]; + } + + private void writeBuffer(int address, int data) { + buffer[address] = (byte) data; + } + + private void ensureLoaded(int address) { + if (!((loadedAddress & 0xfff00) == (address & 0xfff00))) { + try { + System.out.println("M2580: Loading memory: " + (address & 0xfff00)); + file.seek(address & 0xfff00); + file.readFully(readMemory); + } catch (IOException e) { + e.printStackTrace(); + } + loadedAddress = address & 0xfff00; + } + } + + public void portWrite(IOPort source, int data) { + // Chip select = active low... + chipSelect = (data & CHIP_SELECT) == 0; + System.out.println("M25P80: write to Port4: " + + Integer.toString(data, 16) + + " CS:" + chipSelect); + state = 0; + } + + public int getModeMax() { + return 0; + } + + public String getName() { + return "M25P80: external flash"; + } + + +} // ExtFlash Deleted: mspsim/se/sics/mspsim/platform/sky/ExtFlash.java =================================================================== --- mspsim/se/sics/mspsim/platform/sky/ExtFlash.java 2008-02-04 21:10:47 UTC (rev 104) +++ mspsim/se/sics/mspsim/platform/sky/ExtFlash.java 2008-02-05 00:15:39 UTC (rev 105) @@ -1,73 +0,0 @@ -/** - * Copyright (c) 2007, 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. - * - * This file is part of MSPSim. - * - * $Id: ExtFlash.java,v 1.3 2007/10/21 21:17:34 nfi Exp $ - * - * ----------------------------------------------------------------- - * - * ExtFlash - * - * Author : Joakim Eriksson - * Created : Sun Oct 21 22:00:00 2007 - * Updated : $Date: 2007/10/21 21:17:34 $ - * $Revision: 1.3 $ - */ - -package se.sics.mspsim.platform.sky; -import se.sics.mspsim.core.*; - -public class ExtFlash implements USARTListener, PortListener { - - private int state = 0; - public static final int CHIP_SELECT = 0x10; - private boolean chipSelect; - - private USART usart; - - public ExtFlash(USART usart) { - this.usart = usart; - } - - public void dataReceived(USART source, int data) { - if (chipSelect) { - System.out.println("ExtFlash: byte received: " + data); - source.byteReceived(42); - } - } - - public void portWrite(IOPort source, int data) { - // Chip select = active low... - chipSelect = (data & CHIP_SELECT) == 0; - System.out.println("ExtFlash: write to Port4: " + - Integer.toString(data, 16) - + " CS:" + chipSelect); - } - - -} // ExtFlash Modified: mspsim/se/sics/mspsim/platform/sky/SkyNode.java =================================================================== --- mspsim/se/sics/mspsim/platform/sky/SkyNode.java 2008-02-04 21:10:47 UTC (rev 104) +++ mspsim/se/sics/mspsim/platform/sky/SkyNode.java 2008-02-05 00:15:39 UTC (rev 105) @@ -43,6 +43,7 @@ import java.io.IOException; import se.sics.mspsim.chip.CC2420; +import se.sics.mspsim.chip.M25P80; import se.sics.mspsim.core.Chip; import se.sics.mspsim.core.IOPort; import se.sics.mspsim.core.IOUnit; @@ -88,7 +89,7 @@ private IOPort port5; private CC2420 radio; - private ExtFlash flash; + private M25P80 flash; public static final int BLUE_LED = 0x40; public static final int GREEN_LED = 0x20; @@ -130,7 +131,7 @@ radio.setCCAPort(port1, CC2420_CCA); radio.setFIFOPPort(port1, CC2420_FIFOP); radio.setFIFOPort(port1, CC2420_FIFO); - flash = new ExtFlash((USART)usart0); + flash = new M25P80((USART)usart0); ((USART) usart0).setUSARTListener(this); port4 = (IOPort) cpu.getIOUnit("Port 4"); if (port4 != null && port4 instanceof IOPort) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2008-02-04 21:11:03
|
Revision: 104 http://mspsim.svn.sourceforge.net/mspsim/?rev=104&view=rev Author: joxe Date: 2008-02-04 13:10:47 -0800 (Mon, 04 Feb 2008) Log Message: ----------- updated changesfile Modified Paths: -------------- mspsim/CHANGE_LOG.txt Modified: mspsim/CHANGE_LOG.txt =================================================================== --- mspsim/CHANGE_LOG.txt 2008-02-03 20:53:40 UTC (rev 103) +++ mspsim/CHANGE_LOG.txt 2008-02-04 21:10:47 UTC (rev 104) @@ -1,3 +1,10 @@ +0.82 - JFreechart, operation mode statistics (2008-02-03) +Changes: +- added jfreechart diagrams for stack and operation mode statistics +- added profiling of operation modes (e.g. chip modes such as on/off/lpm) +- fixed bug in Timer causing division by zero when main clock is slower than ACLK. +- added possibility to print a stack trace when CPU is stopped +- more symbol information available after loading ELF files 0.81 - ELF Stabs, source debugging (2007-12-07) Changes: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2008-02-03 20:53:43
|
Revision: 103 http://mspsim.svn.sourceforge.net/mspsim/?rev=103&view=rev Author: joxe Date: 2008-02-03 12:53:40 -0800 (Sun, 03 Feb 2008) Log Message: ----------- added version string. Modified Paths: -------------- mspsim/se/sics/mspsim/core/MSP430Constants.java Modified: mspsim/se/sics/mspsim/core/MSP430Constants.java =================================================================== --- mspsim/se/sics/mspsim/core/MSP430Constants.java 2008-02-03 18:45:08 UTC (rev 102) +++ mspsim/se/sics/mspsim/core/MSP430Constants.java 2008-02-03 20:53:40 UTC (rev 103) @@ -43,6 +43,8 @@ public interface MSP430Constants { + public static final String VERSION = "0.82"; + public static final int CLK_ACLK = 1; public static final int CLK_SMCLK = 2; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2008-02-03 20:03:56
|
Revision: 102 http://mspsim.svn.sourceforge.net/mspsim/?rev=102&view=rev Author: joxe Date: 2008-02-03 10:45:08 -0800 (Sun, 03 Feb 2008) Log Message: ----------- Fixed Makefile (source) and added event classes as start on reimplementing IO emulation to be event driven. Modified Paths: -------------- mspsim/Makefile Added Paths: ----------- mspsim/se/sics/mspsim/core/AD12.java mspsim/se/sics/mspsim/core/EventQueue.java mspsim/se/sics/mspsim/core/TimeEvent.java Modified: mspsim/Makefile =================================================================== --- mspsim/Makefile 2008-02-02 12:25:41 UTC (rev 101) +++ mspsim/Makefile 2008-02-03 18:45:08 UTC (rev 102) @@ -126,7 +126,7 @@ ############################################################### source: - zip -9 mspsim-source-`date '+%F'`.zip Makefile $(BINARY) *.java $(addsuffix /*.java,$(PACKAGES)) tests/Makefile tests/*.c tests/*.h + zip -9 mspsim-source-`date '+%F'`.zip Makefile $(BINARY) *.java $(addsuffix /*.java,$(PACKAGES)) tests/Makefile tests/*.c tests/*.h lib/*.* ############################################################### Added: mspsim/se/sics/mspsim/core/AD12.java =================================================================== --- mspsim/se/sics/mspsim/core/AD12.java (rev 0) +++ mspsim/se/sics/mspsim/core/AD12.java 2008-02-03 18:45:08 UTC (rev 102) @@ -0,0 +1,74 @@ +/** + * Copyright (c) 2007, 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. + * + * This file is part of MSPSim. + * + * $Id: IOUnit.java,v 1.3 2007/10/21 21:17:34 nfi Exp $ + * + * ----------------------------------------------------------------- + * + * AD12 + * + * Author : Joakim Eriksson + * Created : Sun Oct 21 22:00:00 2007 + * Updated : $Date: 2007/10/21 21:17:34 $ + * $Revision: 1.3 $ + */ + +package se.sics.mspsim.core; + +public class AD12 extends IOUnit { + + public AD12() { + super(null, 0); + } + + // write a value to the IO unit + public void write(int address, int value, boolean word, + long cycles) { + } + + // read a value from the IO unit + public int read(int address, boolean word, long cycles) { + return 0; + } + + public String getName() { + return "AD12"; + } + + public void interruptServiced() { + } + + public long ioTick(long cycles) { + return cycles + 1000000; + } + + public int getModeMax() { + return 0; + } +} Added: mspsim/se/sics/mspsim/core/EventQueue.java =================================================================== --- mspsim/se/sics/mspsim/core/EventQueue.java (rev 0) +++ mspsim/se/sics/mspsim/core/EventQueue.java 2008-02-03 18:45:08 UTC (rev 102) @@ -0,0 +1,149 @@ +/** + * Copyright (c) 2007, 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. + * + * This file is part of MSPSim. + * + * $Id: $ + * + * ----------------------------------------------------------------- + * + * EventQueue + * + * Author : Joakim Eriksson + * Created : Sun Oct 21 22:00:00 2007 + * Updated : $Date: 2007/10/21 21:17:34 $ + * $Revision: 1.3 $ + */ + +package se.sics.mspsim.core; + +public class EventQueue { + + private TimeEvent first; + public long nextTime; + + public EventQueue() { + } + + public void addEvent(TimeEvent event, long time) { + event.time = time; + addEvent(event); + } + + public void addEvent(TimeEvent event) { + if (event.scheduled) { + removeEvent(event); + } + if (first == null) { + first = event; + } else { + TimeEvent pos = first; + TimeEvent lastPos = first; + while (pos != null && pos.time < event.time) { + lastPos = pos; + pos = pos.nextEvent; + } + // Here pos will be the first TE after event + // and lastPos the first before + if (pos == first) { + // Before all other + event.nextEvent = pos; + first = event; + } else { + event.nextEvent = pos; + lastPos.nextEvent = event; + } + } + if (first != null) { + nextTime = first.time; + } else { + nextTime = 0; + } + event.scheduled = true; + } + + // Not yet impl. + public boolean removeEvent(TimeEvent event) { + TimeEvent pos = first; + TimeEvent lastPos = first; +// System.out.println("Removing: " + event.getShort() + " Before remove: "); +// print(); + while (pos != null && pos != event) { + lastPos = pos; + pos = pos.nextEvent; + } + if (pos == null) return false; + // pos == event! + if (pos == first) { + // remove it from first pos. + first = pos.nextEvent; + } else { + // else link prev to next... + lastPos.nextEvent = pos.nextEvent; + } + // unlink + pos.nextEvent = null; + + if (first != null) { + nextTime = first.time; + } else { + nextTime = 0; + } +// System.out.println("Removed =>"); +// print(); + event.scheduled = false; + return true; + } + + public TimeEvent popFirst() { + TimeEvent tmp = first; + if (tmp != null) { + first = tmp.nextEvent; + // Unlink. + tmp.nextEvent = null; + } + + if (first != null) { + nextTime = first.time; + } else { + nextTime = 0; + } + tmp.scheduled = false; + return tmp; + } + + public void print() { + TimeEvent t = first; + System.out.print("nxt: " + nextTime + " ["); + while(t != null) { + System.out.print(t.getShort()); + t = t.nextEvent; + if (t != null) System.out.print(", "); + } + System.out.println("]"); + } +} // LLEventQueue Added: mspsim/se/sics/mspsim/core/TimeEvent.java =================================================================== --- mspsim/se/sics/mspsim/core/TimeEvent.java (rev 0) +++ mspsim/se/sics/mspsim/core/TimeEvent.java 2008-02-03 18:45:08 UTC (rev 102) @@ -0,0 +1,72 @@ +/** + * Copyright (c) 2007, 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. + * + * This file is part of MSPSim. + * + * $Id: BasicClockModule.java,v 1.3 2007/10/21 21:17:34 nfi Exp $ + * + * ----------------------------------------------------------------- + * + * TimeEvent + * + * Author : Joakim Eriksson + * Created : Sun Oct 21 22:00:00 2007 + * Updated : $Date: 2007/10/21 21:17:34 $ + * $Revision: 1.3 $ + */ + +package se.sics.mspsim.core; + +public abstract class TimeEvent { + // For linking events... + TimeEvent nextEvent; + TimeEvent prevEvent; + boolean scheduled = false; + String name; + + protected long time; + + public TimeEvent(long time) { + this.time = time; + } + + public TimeEvent(long time, String name) { + this.time = time; + this.name = name; + } + + public final long getTime() { + return time; + } + + public abstract void execute(long t); + + public String getShort() { + return "" + time + (name != null ? ": " + name : ""); + } + +} // TimeEvent This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2008-02-02 12:25:44
|
Revision: 101 http://mspsim.svn.sourceforge.net/mspsim/?rev=101&view=rev Author: joxe Date: 2008-02-02 04:25:41 -0800 (Sat, 02 Feb 2008) Log Message: ----------- minor fixes, including makeing it possible for ACLK to be faster than SMCLK in Timer. Modified Paths: -------------- mspsim/se/sics/mspsim/core/BasicClockModule.java mspsim/se/sics/mspsim/core/MSP430Core.java mspsim/se/sics/mspsim/core/Timer.java mspsim/se/sics/mspsim/extutil/jfreechart/DataSourceSampler.java Modified: mspsim/se/sics/mspsim/core/BasicClockModule.java =================================================================== --- mspsim/se/sics/mspsim/core/BasicClockModule.java 2008-02-01 13:15:53 UTC (rev 100) +++ mspsim/se/sics/mspsim/core/BasicClockModule.java 2008-02-02 12:25:41 UTC (rev 101) @@ -58,7 +58,8 @@ // Based on the scatterweb code it looks like less than // 5Mhz is more correct... public static final int MAX_DCO_FRQ = 4915200; - public static final int DCO_FACTOR = MAX_DCO_FRQ / 2048; + public static final int MIN_DCO_FRQ = 0; + public static final int DCO_FACTOR = (MAX_DCO_FRQ - MIN_DCO_FRQ) / 2048; private MSP430Core core; Modified: mspsim/se/sics/mspsim/core/MSP430Core.java =================================================================== --- mspsim/se/sics/mspsim/core/MSP430Core.java 2008-02-01 13:15:53 UTC (rev 100) +++ mspsim/se/sics/mspsim/core/MSP430Core.java 2008-02-02 12:25:41 UTC (rev 101) @@ -99,16 +99,16 @@ private int interruptMax = -1; // Op/instruction represents the last executed OP / instruction - int op; + private int op; int instruction; int servicedInterrupt = -1; IOUnit servicedInterruptUnit = null; - boolean interruptsEnabled = false; - boolean cpuOff = false; + private boolean interruptsEnabled = false; + private boolean cpuOff = false; // Not private since they are needed (for fast access...) - int dcoFrq = 2500000; + private int dcoFrq = 2500000; int aclkFrq = 32768; int smclkFrq = dcoFrq; Modified: mspsim/se/sics/mspsim/core/Timer.java =================================================================== --- mspsim/se/sics/mspsim/core/Timer.java 2008-02-01 13:15:53 UTC (rev 100) +++ mspsim/se/sics/mspsim/core/Timer.java 2008-02-02 12:25:41 UTC (rev 101) @@ -472,10 +472,12 @@ } private int updateCounter(long cycles) { - int divider = 1; + // Needs to be non-integer since smclk Frq can be lower + // than aclk + double divider = 1; if (clockSource == SRC_ACLK) { - // Is this correct? Should possibly be divided with DCO clock? - divider = core.smclkFrq / core.aclkFrq; + // Should later be divided with DCO clock? + divider = 1.0 * core.smclkFrq / core.aclkFrq; } divider = divider * inputDivider; long cycctr = cycles - counterStart; Modified: mspsim/se/sics/mspsim/extutil/jfreechart/DataSourceSampler.java =================================================================== --- mspsim/se/sics/mspsim/extutil/jfreechart/DataSourceSampler.java 2008-02-01 13:15:53 UTC (rev 100) +++ mspsim/se/sics/mspsim/extutil/jfreechart/DataSourceSampler.java 2008-02-02 12:25:41 UTC (rev 101) @@ -121,11 +121,10 @@ public void update() { long time = cpu.cycles / 2; if (time > lastUpdate) { - System.out.println("adding time " + time); lastUpdate = time; timeSeries.add(new Millisecond(new Date(time)), dataSource.getValue()); } else { - System.out.println("IGNORING TIME " + time); +// System.out.println("IGNORING TIME " + time); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2008-02-01 13:16:07
|
Revision: 100 http://mspsim.svn.sourceforge.net/mspsim/?rev=100&view=rev Author: nifi Date: 2008-02-01 05:15:53 -0800 (Fri, 01 Feb 2008) Log Message: ----------- JFreeChart library (http://www.jfree.org/jfreechart/) Added Paths: ----------- mspsim/lib/ mspsim/lib/jcommon-1.0.12.jar mspsim/lib/jfreechart-1.0.9.jar mspsim/lib/jfreechart-licence-LGPL.txt Added: mspsim/lib/jcommon-1.0.12.jar =================================================================== (Binary files differ) Property changes on: mspsim/lib/jcommon-1.0.12.jar ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: mspsim/lib/jfreechart-1.0.9.jar =================================================================== (Binary files differ) Property changes on: mspsim/lib/jfreechart-1.0.9.jar ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: mspsim/lib/jfreechart-licence-LGPL.txt =================================================================== --- mspsim/lib/jfreechart-licence-LGPL.txt (rev 0) +++ mspsim/lib/jfreechart-licence-LGPL.txt 2008-02-01 13:15:53 UTC (rev 100) @@ -0,0 +1,504 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + <one line to give the library's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + <signature of Ty Coon>, 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2008-01-28 13:27:49
|
Revision: 99 http://mspsim.svn.sourceforge.net/mspsim/?rev=99&view=rev Author: nifi Date: 2008-01-28 05:27:48 -0800 (Mon, 28 Jan 2008) Log Message: ----------- added jfreechart ext util Modified Paths: -------------- mspsim/Makefile Modified: mspsim/Makefile =================================================================== --- mspsim/Makefile 2008-01-28 13:22:13 UTC (rev 98) +++ mspsim/Makefile 2008-01-28 13:27:48 UTC (rev 99) @@ -68,7 +68,7 @@ BINARY := README.txt license.txt CHANGE_LOG.txt images/*.jpg firmware/*/*.firmware -PACKAGES := ${addprefix se/sics/mspsim/,core platform/esb platform/sky ui util chip extutil/highlight} +PACKAGES := ${addprefix se/sics/mspsim/,core platform/esb platform/sky ui util chip extutil/highlight extutil/jfreechart} SOURCES := ${wildcard *.java $(addsuffix /*.java,$(PACKAGES))} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2008-01-28 13:22:16
|
Revision: 98 http://mspsim.svn.sourceforge.net/mspsim/?rev=98&view=rev Author: nifi Date: 2008-01-28 05:22:13 -0800 (Mon, 28 Jan 2008) Log Message: ----------- use cpu time Modified Paths: -------------- mspsim/se/sics/mspsim/platform/sky/SkyNode.java Modified: mspsim/se/sics/mspsim/platform/sky/SkyNode.java =================================================================== --- mspsim/se/sics/mspsim/platform/sky/SkyNode.java 2008-01-28 13:21:39 UTC (rev 97) +++ mspsim/se/sics/mspsim/platform/sky/SkyNode.java 2008-01-28 13:22:13 UTC (rev 98) @@ -236,7 +236,7 @@ // A HACK!!! DataChart dataChart = new DataChart("Duty Cycle", "Duty Cycle"); - dataChart.setupChipFrame(node.stats); + dataChart.setupChipFrame(node.stats, cpu); cpu.cpuloop(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2008-01-28 13:21:44
|
Revision: 97 http://mspsim.svn.sourceforge.net/mspsim/?rev=97&view=rev Author: nifi Date: 2008-01-28 05:21:39 -0800 (Mon, 28 Jan 2008) Log Message: ----------- use cpu time Modified Paths: -------------- mspsim/se/sics/mspsim/extutil/jfreechart/DataChart.java mspsim/se/sics/mspsim/extutil/jfreechart/DataSourceSampler.java Modified: mspsim/se/sics/mspsim/extutil/jfreechart/DataChart.java =================================================================== --- mspsim/se/sics/mspsim/extutil/jfreechart/DataChart.java 2008-01-28 12:56:57 UTC (rev 96) +++ mspsim/se/sics/mspsim/extutil/jfreechart/DataChart.java 2008-01-28 13:21:39 UTC (rev 97) @@ -82,7 +82,7 @@ public void setupStackFrame(MSP430 cpu) { JFrame jw = openFrame("Stack Monitor"); StackMonitor sm = new StackMonitor(cpu); - DataSourceSampler dss = new DataSourceSampler(); + DataSourceSampler dss = new DataSourceSampler(cpu); TimeSeries ts = new TimeSeries("Max Stack", Millisecond.class); ts.setMaximumItemCount(200); addTimeSeries(ts); @@ -94,9 +94,9 @@ jw.setVisible(true); } - public void setupChipFrame(OperatingModeStatistics oms) { + public void setupChipFrame(OperatingModeStatistics oms, MSP430 cpu) { JFrame jw = openFrame("Duty-Cycle Monitor"); - DataSourceSampler dss = new DataSourceSampler(); + DataSourceSampler dss = new DataSourceSampler(cpu); dss.setInterval(50); TimeSeries ts = new TimeSeries("LEDS", Millisecond.class); ts.setMaximumItemCount(200); Modified: mspsim/se/sics/mspsim/extutil/jfreechart/DataSourceSampler.java =================================================================== --- mspsim/se/sics/mspsim/extutil/jfreechart/DataSourceSampler.java 2008-01-28 12:56:57 UTC (rev 96) +++ mspsim/se/sics/mspsim/extutil/jfreechart/DataSourceSampler.java 2008-01-28 13:21:39 UTC (rev 97) @@ -1,30 +1,21 @@ package se.sics.mspsim.extutil.jfreechart; -import java.awt.BasicStroke; -import java.awt.Color; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; +import java.util.Date; -import javax.swing.JFrame; -import javax.swing.JWindow; import javax.swing.Timer; -import org.jfree.chart.ChartPanel; -import org.jfree.chart.JFreeChart; -import org.jfree.chart.axis.DateAxis; -import org.jfree.chart.axis.NumberAxis; -import org.jfree.chart.plot.XYPlot; -import org.jfree.chart.renderer.xy.DefaultXYItemRenderer; -import org.jfree.chart.renderer.xy.XYItemRenderer; import org.jfree.data.time.Millisecond; import org.jfree.data.time.TimeSeries; -import org.jfree.data.time.TimeSeriesCollection; +import se.sics.mspsim.core.MSP430Core; import se.sics.mspsim.util.DataSource; public class DataSourceSampler implements ActionListener { + private MSP430Core cpu; private int interval = 100; private Timer timer; private ArrayList<TimeSource> sources = new ArrayList<TimeSource>(); @@ -33,7 +24,8 @@ // private TimeSeries test2; // private TimeSeriesCollection dataset; - public DataSourceSampler() { + public DataSourceSampler(MSP430Core cpu) { + this.cpu = cpu; timer = new Timer(interval, this); // test = new TimeSeries("Data", Millisecond.class); // test.setMaximumItemAge(30000); @@ -47,7 +39,7 @@ } public TimeSource addDataSource(DataSource source, TimeSeries ts) { - TimeSource times = new TimeSource(source, ts); + TimeSource times = new TimeSource(cpu, source, ts); sources.add(times); return times; } @@ -113,18 +105,28 @@ // // } - class TimeSource { + private static class TimeSource { + private MSP430Core cpu; private DataSource dataSource; private TimeSeries timeSeries; + private long lastUpdate; - TimeSource(DataSource ds, TimeSeries ts) { + TimeSource(MSP430Core cpu, DataSource ds, TimeSeries ts) { + this.cpu = cpu; dataSource = ds; timeSeries = ts; } public void update() { - timeSeries.add(new Millisecond(), dataSource.getValue()); + long time = cpu.cycles / 2; + if (time > lastUpdate) { + System.out.println("adding time " + time); + lastUpdate = time; + timeSeries.add(new Millisecond(new Date(time)), dataSource.getValue()); + } else { + System.out.println("IGNORING TIME " + time); + } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2008-01-28 12:57:10
|
Revision: 96 http://mspsim.svn.sourceforge.net/mspsim/?rev=96&view=rev Author: nifi Date: 2008-01-28 04:56:57 -0800 (Mon, 28 Jan 2008) Log Message: ----------- removed ESB from label Modified Paths: -------------- mspsim/se/sics/mspsim/ui/SerialMon.java Modified: mspsim/se/sics/mspsim/ui/SerialMon.java =================================================================== --- mspsim/se/sics/mspsim/ui/SerialMon.java 2008-01-28 12:56:27 UTC (rev 95) +++ mspsim/se/sics/mspsim/ui/SerialMon.java 2008-01-28 12:56:57 UTC (rev 96) @@ -61,7 +61,7 @@ private USART usart; private JTextArea textArea; private JLabel statusLabel; - private String text = "*** Serial mon for ESB/MSPsim ***\n"; + private String text = "*** Serial mon for MSPsim ***\n"; private int lines = 1; private boolean isUpdatePending = false; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2008-01-28 12:56:38
|
Revision: 95 http://mspsim.svn.sourceforge.net/mspsim/?rev=95&view=rev Author: nifi Date: 2008-01-28 04:56:27 -0800 (Mon, 28 Jan 2008) Log Message: ----------- bar and double diagrams Added Paths: ----------- mspsim/se/sics/mspsim/ui/BarChart.java mspsim/se/sics/mspsim/ui/DoubleBarChart.java mspsim/se/sics/mspsim/ui/DoubleSerieChart.java Added: mspsim/se/sics/mspsim/ui/BarChart.java =================================================================== --- mspsim/se/sics/mspsim/ui/BarChart.java (rev 0) +++ mspsim/se/sics/mspsim/ui/BarChart.java 2008-01-28 12:56:27 UTC (rev 95) @@ -0,0 +1,70 @@ +/** + * Copyright (c) 2007, 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. + * + * This file is part of MSPSim. + * + * $Id: 1.4 2007/10/21 22:19:07 nfi Exp $ + * + * ----------------------------------------------------------------- + * + * BarChart + * + * Authors : Adam Dunkels, Joakim Eriksson, Niclas Finne + * Created : April 26 2007 + * Updated : $Date: 2007/10/21 22:19:07 $ + * $Revision: 1.4 $ + */ + +package se.sics.mspsim.ui; +import java.awt.Graphics2D; + +/** + * + */ +public class BarChart extends IntSerieChart { + + public BarChart() { + // Do nothing + } + + public BarChart(String name) { + setName(name); + } + + public void drawChart(Graphics2D g, double xfac, double yfac, int width, int height) { + int[] data = this.data; + if (data != null) { + int minWidth = 1; + if (xfac > 1) minWidth = (int) (xfac + 0.9); + for (int i = 0, n = data.length; i < n; i++) { + int y = (int) (yfac * data[i]); + g.fillRect((int) (xfac * i), height - y, minWidth + 1, y + 1); + } + } + } + +} Added: mspsim/se/sics/mspsim/ui/DoubleBarChart.java =================================================================== --- mspsim/se/sics/mspsim/ui/DoubleBarChart.java (rev 0) +++ mspsim/se/sics/mspsim/ui/DoubleBarChart.java 2008-01-28 12:56:27 UTC (rev 95) @@ -0,0 +1,74 @@ +/** + * Copyright (c) 2007, 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. + * + * This file is part of MSPSim. + * + * $Id: 1.4 2007/10/21 22:19:07 nfi Exp $ + * + * ----------------------------------------------------------------- + * + * DoubleBarChart + * + * Authors : Adam Dunkels, Joakim Eriksson, Niclas Finne + * Created : April 26 2007 + * Updated : $Date: 2007/10/21 22:19:07 $ + * $Revision: 1.4 $ + */ + +package se.sics.mspsim.ui; +import java.awt.Graphics2D; + +/** + * + */ +public class DoubleBarChart extends DoubleSerieChart { + + public DoubleBarChart() { + // Do nothing + } + + public DoubleBarChart(String name) { + setName(name); + } + + public void drawChart(Graphics2D g, double xfac, double yfac, + int width, int height) + { + double[] data = this.data; + if (data != null) { + int minWidth = 1; + if (xfac > 1) { + minWidth = (int) (xfac + 0.9); + } + for (int i = 0, n = data.length; i < n; i++) { + int y = (int) (yfac * data[i]); + g.fillRect((int) (xfac * i), height - y, minWidth + 1, y + 1); + } + } + } + +} Added: mspsim/se/sics/mspsim/ui/DoubleSerieChart.java =================================================================== --- mspsim/se/sics/mspsim/ui/DoubleSerieChart.java (rev 0) +++ mspsim/se/sics/mspsim/ui/DoubleSerieChart.java 2008-01-28 12:56:27 UTC (rev 95) @@ -0,0 +1,74 @@ +/** + * Copyright (c) 2007, 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. + * + * This file is part of MSPSim. + * + * $Id: 1.4 2007/10/21 22:19:07 nfi Exp $ + * + * ----------------------------------------------------------------- + * + * DoubleSerieChart + * + * Authors : Adam Dunkels, Joakim Eriksson, Niclas Finne + * Created : April 26 2007 + * Updated : $Date: 2007/10/21 22:19:07 $ + * $Revision: 1.4 $ + */ + +package se.sics.mspsim.ui; + +/** + * + */ +public abstract class DoubleSerieChart extends AbstractChart { + + protected double[] data; + + public void setData(double[] data) { + this.data = data; + updateMinMax(); + } + + protected void updateMinMax() { + this.minx = 0; + this.maxx = data == null ? 0 : data.length; + + if (!autoscale) { + // Do not update miny, maxy + } else if (data == null || data.length == 0) { + miny = maxy = 0.0; + } else { + miny = maxy = data[0]; + for (int i = 1, n = data.length; i < n; i++) { + double v = data[i]; + if (v < miny) miny = v; + if (v > maxy) maxy = v; + } + } + } + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2008-01-28 12:55:49
|
Revision: 94 http://mspsim.svn.sourceforge.net/mspsim/?rev=94&view=rev Author: nifi Date: 2008-01-28 04:55:32 -0800 (Mon, 28 Jan 2008) Log Message: ----------- added classpath to java command Modified Paths: -------------- mspsim/Makefile Modified: mspsim/Makefile =================================================================== --- mspsim/Makefile 2008-01-28 12:54:51 UTC (rev 93) +++ mspsim/Makefile 2008-01-28 12:55:32 UTC (rev 94) @@ -12,6 +12,7 @@ # Settings ############################################################### CC=javac +JAVA=java JAVACC=javacc JAR=jar RM=rm -f @@ -48,7 +49,9 @@ CLASSPATH=.$(SEPARATOR)lib/jfreechart-1.0.9.jar$(SEPARATOR)lib/jcommon-1.0.12.jar CCARGS=-deprecation -classpath "${CLASSPATH}" +JAVAARGS=-classpath "${CLASSPATH}" + ############################################################### # SERVER OBJECTS ############################################################### @@ -97,25 +100,25 @@ @echo "Usage: make [all,compile,clean,run,runsky,runesb]" run: compile - java se.sics.mspsim.util.IHexReader $(FIRMWAREFILE) $(MAPFILE) + $(JAVA) $(JAVAARGS) se.sics.mspsim.util.IHexReader $(FIRMWAREFILE) $(MAPFILE) runesb: compile - java se.sics.mspsim.platform.esb.ESBNode $(ESBFIRMWARE) $(MAPFILE) + $(JAVA) $(JAVAARGS) se.sics.mspsim.platform.esb.ESBNode $(ESBFIRMWARE) $(MAPFILE) runsky: compile - java se.sics.mspsim.platform.sky.SkyNode $(SKYFIRMWARE) $(MAPFILE) + $(JAVA) $(JAVAARGS) se.sics.mspsim.platform.sky.SkyNode $(SKYFIRMWARE) $(MAPFILE) test: cputest cputest: $(CPUTEST) - java se.sics.mspsim.util.Test $(CPUTEST) + $(JAVA) $(JAVAARGS) se.sics.mspsim.util.Test $(CPUTEST) $(CPUTEST): (cd tests && $(MAKE)) mtest: compile $(CPUTEST) @-$(RM) mini-test_cpu.txt - java se.sics.util.Test -debug $(CPUTEST) >mini-test_cpu.txt + $(JAVA) $(JAVAARGS) se.sics.util.Test -debug $(CPUTEST) >mini-test_cpu.txt ############################################################### This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2008-01-28 12:55:01
|
Revision: 93 http://mspsim.svn.sourceforge.net/mspsim/?rev=93&view=rev Author: nifi Date: 2008-01-28 04:54:51 -0800 (Mon, 28 Jan 2008) Log Message: ----------- removed not used imports Modified Paths: -------------- mspsim/se/sics/mspsim/util/OperatingModeStatistics.java Modified: mspsim/se/sics/mspsim/util/OperatingModeStatistics.java =================================================================== --- mspsim/se/sics/mspsim/util/OperatingModeStatistics.java 2008-01-28 11:16:10 UTC (rev 92) +++ mspsim/se/sics/mspsim/util/OperatingModeStatistics.java 2008-01-28 12:54:51 UTC (rev 93) @@ -43,9 +43,6 @@ import java.util.HashMap; import java.util.Iterator; -import org.jfree.chart.renderer.category.StatisticalBarRenderer; -import org.jfree.data.statistics.Statistics; - import se.sics.mspsim.core.Chip; import se.sics.mspsim.core.MSP430Core; import se.sics.mspsim.core.OperatingModeListener; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2008-01-28 11:16:13
|
Revision: 92 http://mspsim.svn.sourceforge.net/mspsim/?rev=92&view=rev Author: nifi Date: 2008-01-28 03:16:10 -0800 (Mon, 28 Jan 2008) Log Message: ----------- turned off old stack ui Modified Paths: -------------- mspsim/se/sics/mspsim/ui/ControlUI.java Modified: mspsim/se/sics/mspsim/ui/ControlUI.java =================================================================== --- mspsim/se/sics/mspsim/ui/ControlUI.java 2008-01-28 11:09:37 UTC (rev 91) +++ mspsim/se/sics/mspsim/ui/ControlUI.java 2008-01-28 11:16:10 UTC (rev 92) @@ -61,7 +61,7 @@ public class ControlUI extends JPanel implements ActionListener { private static final String TITLE = "MSPSim monitor"; - private static final boolean USE_STACKUI = true; + private static final boolean USE_STACKUI = false; private JFrame window; private MSP430 cpu; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2008-01-28 11:09:40
|
Revision: 91 http://mspsim.svn.sourceforge.net/mspsim/?rev=91&view=rev Author: nifi Date: 2008-01-28 03:09:37 -0800 (Mon, 28 Jan 2008) Log Message: ----------- updated basic graph utils + moved ui classes from utils to ui Modified Paths: -------------- mspsim/se/sics/mspsim/ui/ControlUI.java mspsim/se/sics/mspsim/util/DotDiagram.java Added Paths: ----------- mspsim/se/sics/mspsim/ui/AbstractChart.java mspsim/se/sics/mspsim/ui/Chart.java mspsim/se/sics/mspsim/ui/ChartPanel.java mspsim/se/sics/mspsim/ui/ConstantLineChart.java mspsim/se/sics/mspsim/ui/IntSerieChart.java mspsim/se/sics/mspsim/ui/LineChart.java mspsim/se/sics/mspsim/ui/StackUI.java Removed Paths: ------------- mspsim/se/sics/mspsim/util/StackUI.java Added: mspsim/se/sics/mspsim/ui/AbstractChart.java =================================================================== --- mspsim/se/sics/mspsim/ui/AbstractChart.java (rev 0) +++ mspsim/se/sics/mspsim/ui/AbstractChart.java 2008-01-28 11:09:37 UTC (rev 91) @@ -0,0 +1,121 @@ +/** + * Copyright (c) 2007, 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. + * + * This file is part of MSPSim. + * + * $Id: 1.4 2007/10/21 22:19:07 nfi Exp $ + * + * ----------------------------------------------------------------- + * + * AbstractChart + * + * Authors : Adam Dunkels, Joakim Eriksson, Niclas Finne + * Created : May 3 2007 + * Updated : $Date: 2007/10/21 22:19:07 $ + * $Revision: 1.4 $ + */ + +package se.sics.mspsim.ui; + +import java.awt.Graphics2D; +import java.util.Hashtable; + +/** + * + */ +public abstract class AbstractChart implements Chart { + + protected String name; + protected double minx, maxx; + protected double miny, maxy; + protected boolean autoscale = true; + private Hashtable<String,Object> config = new Hashtable<String,Object>(); + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public boolean isAutoscaling() { + return autoscale; + } + + public void setAutoscale() { + if (!this.autoscale) { + this.autoscale = true; + updateMinMax(); + } + } + + public void setMinMax(double minVal, double maxVal) { + miny = minVal; + maxy = maxVal; + autoscale = false; + } + + public double getMinX() { + return minx; + } + + public double getMaxX() { + return maxx; + } + + public double getMinY() { + return miny; + } + + public double getMaxY() { + return maxy; + } + + public Object getConfig(String param) { + return getConfig(param, null); + } + + public Object getConfig(String param, Object defVal) { + Object retVal = config.get(param); + return retVal != null ? retVal : defVal; + } + + public void setConfig(String param, Object value) { + if (value != null) { + config.put(param, value); + } else { + config.remove(param); + } + } + + protected abstract void updateMinMax(); + + public abstract void drawChart(Graphics2D g, double xfac, double yfac, + int width, int height); + +} Added: mspsim/se/sics/mspsim/ui/Chart.java =================================================================== --- mspsim/se/sics/mspsim/ui/Chart.java (rev 0) +++ mspsim/se/sics/mspsim/ui/Chart.java 2008-01-28 11:09:37 UTC (rev 91) @@ -0,0 +1,66 @@ +/** + * Copyright (c) 2007, 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. + * + * This file is part of MSPSim. + * + * $Id: 1.4 2007/10/21 22:19:07 nfi Exp $ + * + * ----------------------------------------------------------------- + * + * Chart + * + * Authors : Adam Dunkels, Joakim Eriksson, Niclas Finne + * Created : April 26 2007 + * Updated : $Date: 2007/10/21 22:19:07 $ + * $Revision: 1.4 $ + */ + +package se.sics.mspsim.ui; +import java.awt.Graphics2D; + +/** + * + */ +public interface Chart { + + public String getName(); + + public void setAutoscale(); + public void setMinMax(double minValue, double maxValue); + + public double getMaxY(); + public double getMinY(); + public double getMaxX(); + public double getMinX(); + + public Object getConfig(String param); + public Object getConfig(String param, Object defaultValue); + public void setConfig(String param, Object value); + + public void drawChart(Graphics2D g, double xfac, double yfac, int width, int height); + +} Added: mspsim/se/sics/mspsim/ui/ChartPanel.java =================================================================== --- mspsim/se/sics/mspsim/ui/ChartPanel.java (rev 0) +++ mspsim/se/sics/mspsim/ui/ChartPanel.java 2008-01-28 11:09:37 UTC (rev 91) @@ -0,0 +1,344 @@ +/** + * Copyright (c) 2007, 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. + * + * This file is part of MSPSim. + * + * $Id: 1.4 2007/10/21 22:19:07 nfi Exp $ + * + * ----------------------------------------------------------------- + * + * ChartPanel + * + * Authors : Adam Dunkels, Joakim Eriksson, Niclas Finne + * Created : April 26 2007 + * Updated : $Date: 2007/10/21 22:19:07 $ + * $Revision: 1.4 $ + */ + +package se.sics.mspsim.ui; +import java.awt.Color; +import java.awt.FontMetrics; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Insets; +import java.util.ArrayList; +import java.util.Hashtable; + +import javax.swing.BorderFactory; +import javax.swing.JComponent; +import javax.swing.JFrame; +import javax.swing.border.Border; + +/** + * + */ +public class ChartPanel extends JComponent { + + private static final long serialVersionUID = 7243446493049199594L; + + public static final String COLOR_TICK = "color.tick"; + + private static final Border DEFAULT_BORDER = + BorderFactory.createEmptyBorder(10,10,10,10); + + private static final Color[] DEFAULT_COLOR = { + Color.blue, new Color(0xff008000), Color.red, Color.black + }; + + private static final Color LIGHT_GRAY = new Color(0xff909090); + + private ArrayList<Chart> charts = new ArrayList<Chart>(); + private Hashtable<String,Object> config = new Hashtable<String,Object>(); + private Chart[] chartCache = null; + + private Chart axisChart; + + /** + * + */ + public ChartPanel() { + setForeground(Color.black); + setBackground(Color.white); + setBorder(DEFAULT_BORDER); + setOpaque(true); + } + + public Chart getAxisChart() { + return axisChart; + } + + public void setAxisChart(Chart chart) { + this.axisChart = chart; + } + + public synchronized void addChart(Chart chart) { + charts.add(chart); + chartCache = null; + } + + public synchronized void removeChart(Chart chart) { + charts.remove(chart); + chartCache = null; + } + + public synchronized Chart getChart(String name) { + for (int i = 0, n = charts.size(); i < n; i++) { + if (name.equals(charts.get(i).getName())) { + return charts.get(i); + } + } + return null; + } + + public synchronized Chart[] getCharts() { + if (chartCache == null) { + chartCache = charts.toArray(new Chart[charts.size()]); + } + return chartCache; + } + + public Object getConfig(String param) { + return getConfig(param, null); + } + + public Object getConfig(String param, Object defVal) { + Object retVal = config.get(param); + return retVal != null ? retVal : defVal; + } + + public void setConfig(String param, Object value) { + if (value != null) { + config.put(param, value); + } else { + config.remove(param); + } + } + + private Color getDefaultColor(int index) { + return DEFAULT_COLOR[index % DEFAULT_COLOR.length]; + } + + + // ------------------------------------------------------------------- + // Paint handling + // ------------------------------------------------------------------- + + protected void paintComponent(Graphics g) { + Graphics2D g2d = (Graphics2D) g.create(); + try { + if (isOpaque()) { + g2d.setColor(getBackground()); + g2d.fillRect(0, 0, getWidth(), getHeight()); + } + paintCharts(g2d); + } finally { + g2d.dispose(); + } + } + + protected void paintCharts(Graphics2D g) { + Chart axisChart = this.axisChart; + Color foreground = getForeground(); + Color tickColor = (Color) getConfig(COLOR_TICK, LIGHT_GRAY); + FontMetrics fm = getFontMetrics(g.getFont()); + int fmHeight = fm.getAscent(); + Insets insets = getInsets(); + int height = getHeight(); + int width = getWidth(); + int leftInset = 40; + height -= insets.top + insets.bottom + fmHeight + 2; + width -= leftInset + insets.left + insets.right + 2; + g.translate(leftInset + insets.left + 1, insets.top + 1); + + g.setColor(foreground); + g.drawRect(-1, -1, width + 2, height + 2); + + Chart[] chs = getCharts(); + if (chs.length > 0) { + double totMaxY = Double.MIN_VALUE, totMinY = Double.MAX_VALUE; + double totMaxX = Double.MIN_VALUE, totMinX = Double.MAX_VALUE; + + for (int i = 0, n = chs.length; i < n; i++) { + Chart chart = chs[i]; + double maxY = chart.getMaxY(); + double minY = chart.getMinY(); + double minX = chart.getMinX(); + double maxX = chart.getMaxX(); + if (maxY >= minY && maxX > minX) { + if (maxY > totMaxY) totMaxY = maxY; + if (minY < totMinY) totMinY = minY; + + if (maxX > totMaxX) totMaxX = maxX; + if (minX < totMinX) totMinX = minX; + } + } + if (totMaxY >= totMinY && totMaxX > totMinX) { + double yfac = (1.0 * height) / (totMaxY - totMinY); + double xfac = (1.0 * width) / (totMaxX - totMinX); + int zero = height; + if (totMinY < 0) { + zero += (int) (yfac * totMinY); + } + + if (axisChart != null) { +// double maxY = axisChart.getMaxY(); +// double minY = axisChart.getMinY(); +// double minX = axisChart.getMinX(); +// double maxX = axisChart.getMaxX(); + +// if (maxY != minY && maxX != minX) { + // Draw zero line + g.setColor(tickColor); + g.drawLine(0, zero, width, zero); + g.setColor(foreground); + g.drawString("0", -4 - fm.stringWidth("0"), zero + fmHeight / 2); + + double gridValue = getGridValue(totMinY, totMaxY, 10); + for (double d = gridValue; d < totMaxY; d += gridValue) { + int y = (int) (zero - yfac * d); + String text = "" + (int) d; + int tlen = fm.stringWidth(text); + g.setColor(tickColor); + g.drawLine(0, y, width, y); + g.setColor(foreground); + g.drawString(text, -4 - tlen, y + fmHeight / 2); + } + for (double d = gridValue; d < -totMinY; d += gridValue) { + int y = (int) (zero + yfac * d); + String text = "" + (int) -d; + int tlen = fm.stringWidth(text); + g.setColor(tickColor); + g.drawLine(0, y, width, y); + g.setColor(foreground); + g.drawString(text, -4 - tlen, y + fmHeight / 2); + } + + gridValue = getGridValue(totMinX, totMaxX, 10); + for (double d = gridValue; d < totMaxX; d += gridValue) { + int x = (int) (xfac * d); + String text = "" + (int) d; + int tlen = fm.stringWidth(text); + g.setColor(tickColor); + g.drawLine(x, 0, x, height); + g.setColor(foreground); + g.drawString(text, x - tlen / 2, height + fmHeight); + } + } + + for (int i = 0, n = chs.length; i < n; i++) { + Chart chart = chs[i]; + double maxY = chart.getMaxY(); + double minY = chart.getMinY(); + double minX = chart.getMinX(); + double maxX = chart.getMaxX(); + + if (maxY < minY || maxX <= minX) { + // No data in this chart + } else { +// double yfac = (1.0 * height) / (maxY - minY); +// double xfac = (1.0 * width) / (maxX - minX); + + g.setColor((Color) chart.getConfig("color", getDefaultColor(i))); + chart.drawChart(g, xfac, yfac, width, height); + } + } + } + } + } + + private double getGridValue(double totMinX, double totMaxX, int maxCount) { + double diff = totMaxX - totMinX; + if (diff <= 0) { + return 1; + } + double d = Math.log(diff) / Math.log(10); + int z = (int) d; + if ((d - z) > 0.69) { + z++; + } + if (z < 1) { + return 1; + } + d = Math.pow(10, z - 1); + if ((diff / (int) (1 * d)) <= maxCount) { + return (int) (1 * d); + } + if ((diff / (int) (2.5 * d)) <= maxCount) { + return (int) (2.5 * d); + } + return (int) (5 * d); + } + + + //------------------------------------------------------------------- + // Test Main + // ------------------------------------------------------------------- + + public static void main(String[] args) { + JFrame jf = new JFrame("test charts"); + jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + jf.setBounds(100,100,600,400); + jf.setVisible(true); + BarChart bc = new BarChart(); + LineChart lc = new LineChart(); + + int[] data = new int[40]; + for (int i = 0, n = data.length; i < n; i++) { + data[i] = (int) ((Math.random() * 300)); + } + bc.setConfig("color", new Color(0xffb0b0b0)); + bc.setData(data); + lc.setData(data); + + // bc.setMinMax(0, 500); + lc.setMinMax(-4096, 4096); + + ChartPanel chp = new ChartPanel(); + chp.addChart(lc); + chp.addChart(bc); + jf.getContentPane().add(chp); + jf.setVisible(true); + + while(true) { + try { + Thread.sleep(100); + } catch (Exception e) { + // Ignore interrupts + } + + int len = 1024; + data = new int[len]; + for (int i = 0, n = data.length; i < n; i++) { + data[i] = (int) (2500 - (Math.random() * 5000)); + } + lc.setData(data); + chp.repaint(); + } + + } + +} Added: mspsim/se/sics/mspsim/ui/ConstantLineChart.java =================================================================== --- mspsim/se/sics/mspsim/ui/ConstantLineChart.java (rev 0) +++ mspsim/se/sics/mspsim/ui/ConstantLineChart.java 2008-01-28 11:09:37 UTC (rev 91) @@ -0,0 +1,76 @@ +/** + * Copyright (c) 2007, 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. + * + * This file is part of MSPSim. + * + * $Id: 1.4 2007/10/21 22:19:07 nfi Exp $ + * + * ----------------------------------------------------------------- + * + * ConstantLineChart + * + * Authors : Adam Dunkels, Joakim Eriksson, Niclas Finne + * Created : April 26 2007 + * Updated : $Date: 2007/10/21 22:19:07 $ + * $Revision: 1.4 $ + */ + +package se.sics.mspsim.ui; + +import java.awt.Graphics2D; + +public class ConstantLineChart extends AbstractChart { + + private int lineY; + + public ConstantLineChart(int y) { + this.lineY = y; + } + + public ConstantLineChart(String name, int y) { + setName(name); + this.lineY = y; + updateMinMax(); + } + + public void drawChart(Graphics2D g, double xfac, double yfac, int width, int height) { + int zero = height; + if (getMinY() < 0) { + zero += (int) (yfac * getMinY()); + } + int y = (int) (zero - (yfac * lineY)); + g.drawLine(0, y, width, y); + } + + @Override + protected void updateMinMax() { + this.minx = 0; + this.maxx = 1; + this.miny = this.maxy = lineY; + } + +} Modified: mspsim/se/sics/mspsim/ui/ControlUI.java =================================================================== --- mspsim/se/sics/mspsim/ui/ControlUI.java 2008-01-28 11:08:40 UTC (rev 90) +++ mspsim/se/sics/mspsim/ui/ControlUI.java 2008-01-28 11:09:37 UTC (rev 91) @@ -57,11 +57,11 @@ import se.sics.mspsim.extutil.jfreechart.DataChart; import se.sics.mspsim.util.DebugInfo; import se.sics.mspsim.util.ELF; -import se.sics.mspsim.util.StackUI; public class ControlUI extends JPanel implements ActionListener { private static final String TITLE = "MSPSim monitor"; + private static final boolean USE_STACKUI = true; private JFrame window; private MSP430 cpu; @@ -82,16 +82,16 @@ super(new GridLayout(0, 1)); this.cpu = cpu; - this.stackUI = new StackUI(cpu); - DataChart test = new DataChart("Stack Monitor", "Bytes"); test.setupStackFrame(cpu); - - stackWindow = new JFrame("Stack"); - stackWindow.add(this.stackUI); - WindowUtils.restoreWindowBounds("StackUI", stackWindow); - WindowUtils.addSaveOnShutdown("StackUI", stackWindow); - stackWindow.setVisible(true); + 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); + } window = new JFrame(TITLE); // window.setSize(320,240); Added: mspsim/se/sics/mspsim/ui/IntSerieChart.java =================================================================== --- mspsim/se/sics/mspsim/ui/IntSerieChart.java (rev 0) +++ mspsim/se/sics/mspsim/ui/IntSerieChart.java 2008-01-28 11:09:37 UTC (rev 91) @@ -0,0 +1,74 @@ +/** + * Copyright (c) 2007, 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. + * + * This file is part of MSPSim. + * + * $Id: 1.4 2007/10/21 22:19:07 nfi Exp $ + * + * ----------------------------------------------------------------- + * + * IntSerieChart + * + * Authors : Adam Dunkels, Joakim Eriksson, Niclas Finne + * Created : April 26 2007 + * Updated : $Date: 2007/10/21 22:19:07 $ + * $Revision: 1.4 $ + */ + +package se.sics.mspsim.ui; + +/** + * + */ +public abstract class IntSerieChart extends AbstractChart { + + protected int[] data; + + public void setData(int[] data) { + this.data = data; + updateMinMax(); + } + + protected void updateMinMax() { + this.minx = 0; + this.maxx = data == null ? 0 : data.length; + + if (!autoscale) { + // Do not update miny, maxy + } else if (data == null || data.length == 0) { + miny = maxy = 0.0; + } else { + miny = maxy = data[0]; + for (int i = 1, n = data.length; i < n; i++) { + int v = data[i]; + if (v < miny) miny = v; + if (v > maxy) maxy = v; + } + } + } + +} Added: mspsim/se/sics/mspsim/ui/LineChart.java =================================================================== --- mspsim/se/sics/mspsim/ui/LineChart.java (rev 0) +++ mspsim/se/sics/mspsim/ui/LineChart.java 2008-01-28 11:09:37 UTC (rev 91) @@ -0,0 +1,81 @@ +/** + * Copyright (c) 2007, 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. + * + * This file is part of MSPSim. + * + * $Id: 1.4 2007/10/21 22:19:07 nfi Exp $ + * + * ----------------------------------------------------------------- + * + * LineChart + * + * Authors : Adam Dunkels, Joakim Eriksson, Niclas Finne + * Created : April 26 2007 + * Updated : $Date: 2007/10/21 22:19:07 $ + * $Revision: 1.4 $ + */ + +package se.sics.mspsim.ui; +import java.awt.Graphics2D; + +/** + * + */ +public class LineChart extends IntSerieChart { + + public LineChart() { + // Do nothing + } + + public LineChart(String name) { + setName(name); + } + + public void drawChart(Graphics2D g, double xfac, double yfac, int width, int height) { + int[] lastData = this.data; + if (lastData != null) { +// int minWidth = 1; +// if (xfac > 1) minWidth = (int) (xfac + 0.9); + int lastX = -1; + int lastY = -1; + int zero = height; + if (getMinY() < 0) { + zero += (int) (yfac * getMinY()); + } + for (int i = 0, n = lastData.length; i < n; i++) { + int y = (int) (zero - (yfac * lastData[i])); + int x = (int) (xfac * i); + if (lastX != -1) { + g.drawLine(x, y, lastX, lastY); + } + lastX = x; + lastY = y; + } + } + } + +} Copied: mspsim/se/sics/mspsim/ui/StackUI.java (from rev 79, mspsim/se/sics/mspsim/util/StackUI.java) =================================================================== --- mspsim/se/sics/mspsim/ui/StackUI.java (rev 0) +++ mspsim/se/sics/mspsim/ui/StackUI.java 2008-01-28 11:09:37 UTC (rev 91) @@ -0,0 +1,177 @@ +/** + * Copyright (c) 2007, 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. + * + * This file is part of MSPSim. + * + * $Id: StackUI.java,v 1.3 2007/10/21 21:17:35 nfi Exp $ + * + * ----------------------------------------------------------------- + * + * StackUI + * + * Author : Joakim Eriksson + * Created : Sun Oct 21 22:00:00 2007 + * Updated : $Date: 2007/10/21 21:17:35 $ + * $Revision: 1.3 $ + */ + +package se.sics.mspsim.ui; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Graphics; + +import javax.swing.JPanel; + +import se.sics.mspsim.core.CPUMonitor; +import se.sics.mspsim.core.MSP430; +import se.sics.mspsim.util.MapTable; + +public class StackUI extends JPanel implements CPUMonitor { + + private static final long serialVersionUID = 8648239617509299768L; + + private static final int STACK_FRAME = 1024; + private int updateCyclePeriod = 2500; + + private MSP430 cpu; + private int heapStartAddress; + private int stackStartAddress = 0xa00; + private ChartPanel chartPanel; + private LineChart minStackChart; + private LineChart maxStackChart; + +// private DotDiagram diagram; + private int[] minData = new int[STACK_FRAME]; + private int[] maxData = new int[STACK_FRAME]; + private int[] minCache = new int[STACK_FRAME]; + private int[] maxCache = new int[STACK_FRAME]; +// private String[] notes = new String[STACK_FRAME]; + + private long lastCycles = 0; + private int pos = 0; + + private boolean update = false; + + public StackUI(MSP430 cpu) { + this(cpu, 2500); + } + + public StackUI(MSP430 cpu, int updateCyclePeriod) { + super(new BorderLayout()); + this.updateCyclePeriod = updateCyclePeriod; + this.cpu = cpu; + this.cpu.setRegisterWriteMonitor(MSP430.SP, this); + + if (cpu.getDisAsm() != null) { + MapTable mapTable = cpu.getDisAsm().getMap(); + if (mapTable != null) { + this.heapStartAddress = mapTable.heapStartAddress; + this.stackStartAddress = mapTable.stackStartAddress; + } + } + +// diagram = new DotDiagram(2); +// diagram.setDotColor(0, Color.green); +// diagram.setDotColor(1, Color.green); +// diagram.addConstant(Color.red, +// 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); + + minStackChart = new LineChart("Min Stack"); + minStackChart.setConfig("color", Color.green); + chartPanel.addChart(minStackChart); + + 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)); + } + +// public void addNote(String note) { +// notes[pos] = note; +// } + + public void paint(Graphics g) { + if (update) { + update = false; + + int p = pos; + copy(this.minData, this.minCache, p); + copy(this.maxData, this.maxCache, p); + minStackChart.setData(this.minCache); + maxStackChart.setData(this.maxCache); + } + super.paint(g); + } + + + private void copy(int[] data1, int[] data2, int p) { + if (p + 1 < data1.length) { + System.arraycopy(data1, p + 1, data2, 0, data1.length - p - 1); + } + if (p > 0) { + System.arraycopy(data1, 0, data2, data1.length - p, p); + } + } + + // ------------------------------------------------------------------- + // CPUMonitor + // ------------------------------------------------------------------- + + public void cpuAction(int type, int adr, int data) { + int size = ((stackStartAddress - data) + 0xffff) % 0xffff; + if (this.minData[pos] > size) { + this.minData[pos] = size; + } + if (this.maxData[pos] < size) { + this.maxData[pos] = size; + } + if (cpu.cpuCycles - lastCycles > updateCyclePeriod) { + lastCycles = cpu.cpuCycles; +// System.out.println("STACK UPDATE: " + type + "," + adr + "," + data + "," + pos); + pos = (pos + 1) % this.minData.length; + this.minData[pos] = Integer.MAX_VALUE; + this.maxData[pos] = 0; + update = true; + repaint(); +// this.notes[pos] = null; +// diagram.setData(0, this.minData, pos, this.minData.length); +// diagram.setDataWithNotes(1, this.maxData, notes, pos, this.maxData.length); + } + } + +} Modified: mspsim/se/sics/mspsim/util/DotDiagram.java =================================================================== --- mspsim/se/sics/mspsim/util/DotDiagram.java 2008-01-28 11:08:40 UTC (rev 90) +++ mspsim/se/sics/mspsim/util/DotDiagram.java 2008-01-28 11:09:37 UTC (rev 91) @@ -56,6 +56,8 @@ public class DotDiagram extends JComponent { + private static final long serialVersionUID = -2284181166518780931L; + public static final int NORMAL = 0; public static final int ADDITIVE = 1; public static final int FILLED_ADDITIVE = 2; @@ -84,7 +86,6 @@ private int lowerY; private double xspace; private int ySpacing = 0; - private int xSpacing = 0; private boolean rescale = false; private boolean gridVisible = false; @@ -275,14 +276,26 @@ protected void paintComponent(Graphics g0) { Graphics2D g = (Graphics2D) g0; + FontMetrics fm = g.getFontMetrics(); + int fmHeight = fm.getAscent(); Color oldColor = g.getColor(); + Insets insets = getInsets(); int width = getWidth(); int height = getHeight(); + int leftInset = 2; + int topInset = 2; int yLabelSize = 0; if (yLabel != null || xLabel != null) { - FontMetrics fm = g.getFontMetrics(); yLabelSize = fm.stringWidth(yLabel); } + if(gridVisible) { + topInset += fmHeight / 2; + height -= fmHeight / 2; + leftInset += 40; + } + height -= topInset + insets.top + insets.bottom; + width -= leftInset + insets.left + insets.right; + g.translate(leftInset + insets.left + 1, topInset + insets.top + 1); if (isOpaque()) { g.setColor(Color.white); @@ -377,21 +390,54 @@ if (gridVisible) { g.setColor(Color.lightGray); - for (int i = 0, n = 10; i < n; i++) { - g.drawLine(x + (i * sizeX) / 10, y, - x + (i * sizeX) / 10, y + sizeY - 1); + + double yfac = (1.0 * height) / (totMax - totMin); +// if (totMin < 0) { +// zero += (int) (yfac * totMin); +// } + // Draw zero line + g.setColor(Color.lightGray); + g.drawLine(0, zero, width, zero); + g.setColor(Color.black); + g.drawString("0", -4 - fm.stringWidth("0"), zero + fmHeight / 2); + + double div = getDivider(totMin, totMax); + for (double d = div; d < totMax; d += div) { + int dy = (int) (zero - yfac * d); + String text = "" + (int) d; + int tlen = fm.stringWidth(text); + g.setColor(Color.lightGray); + g.drawLine(0, dy, width, dy); + g.setColor(Color.black); + g.drawString(text, -4 - tlen, dy + fmHeight / 2); } - int z0 = zero - y; - int z1 = zero - (y + sizeY); - double tot = (ySpacing * factor) == 0 ? (sizeY / 10.0) - : (factor * ySpacing); - for (double i = 0; i < z0; i += tot) { - g.drawLine(x + 1, (int) (zero - i), x + sizeX, (int) (zero - i)); + for (double d = div; d < -totMin; d += div) { + int dy = (int) (zero + yfac * d); + String text = "" + (int) -d; + int tlen = fm.stringWidth(text); + g.setColor(Color.lightGray); + g.drawLine(0, dy, width, dy); + g.setColor(Color.black); + g.drawString(text, -4 - tlen, dy + fmHeight / 2); } - for (double i = 0; i > z1; i -= tot) { - g.drawLine(x + 1, (int) (zero - i), x + sizeX, (int) (zero - i)); - } + + +// for (int i = 0, n = 10; i < n; i++) { +// g.drawLine(x + (i * sizeX) / 10, y, +// x + (i * sizeX) / 10, y + sizeY - 1); +// } +// int z0 = zero - y; +// int z1 = zero - (y + sizeY); +// double tot = (ySpacing * factor) == 0 ? (sizeY / 10.0) +// : (factor * ySpacing); +// for (double i = 0; i < z0; i += tot) { +// g.drawLine(x + 1, (int) (zero - i), x + sizeX, (int) (zero - i)); +// } +// +// for (double i = 0; i > z1; i -= tot) { +// g.drawLine(x + 1, (int) (zero - i), x + sizeX, (int) (zero - i)); +// } } if (isAdditive) { @@ -488,8 +534,28 @@ g.scale(height/200.0, width/200.0); g.drawString(yLabel, -100 - yLabelSize/2, 10); } + g.setColor(oldColor); } + private double getDivider(double minY, double maxY) { + double diff = Math.abs(maxY - minY); + if (diff >= 1500) { + return 500.0; + } + if (diff >= 400) { + return 100.0; + } + if (diff >= 80) { + return 20.0; + } + if (diff >= 20) { + return 10.0; + } + if (diff >= 10) { + return 5.0; + } + return 1.0; + } // ------------------------------------------------------------------- Deleted: mspsim/se/sics/mspsim/util/StackUI.java =================================================================== --- mspsim/se/sics/mspsim/util/StackUI.java 2008-01-28 11:08:40 UTC (rev 90) +++ mspsim/se/sics/mspsim/util/StackUI.java 2008-01-28 11:09:37 UTC (rev 91) @@ -1,121 +0,0 @@ -/** - * Copyright (c) 2007, 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. - * - * This file is part of MSPSim. - * - * $Id: StackUI.java,v 1.3 2007/10/21 21:17:35 nfi Exp $ - * - * ----------------------------------------------------------------- - * - * StackUI - * - * Author : Joakim Eriksson - * Created : Sun Oct 21 22:00:00 2007 - * Updated : $Date: 2007/10/21 21:17:35 $ - * $Revision: 1.3 $ - */ - -package se.sics.mspsim.util; -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Dimension; -import javax.swing.JPanel; - -import se.sics.mspsim.core.*; - -public class StackUI extends JPanel implements CPUMonitor { - - private static final int STACK_FRAME = 1024; - private int updateCyclePeriod = 2500; - - private MSP430 cpu; - private int heapStartAddress; - private int stackStartAddress = 0xa00; - private DotDiagram diagram; - private int[] minData = new int[STACK_FRAME]; - private int[] maxData = new int[STACK_FRAME]; - private String[] notes = new String[STACK_FRAME]; - - private long lastCycles = 0; - private int pos = 0; - - public StackUI(MSP430 cpu) { - this(cpu, 2500); - } - - public StackUI(MSP430 cpu, int updateCyclePeriod) { - super(new BorderLayout()); - this.updateCyclePeriod = updateCyclePeriod; - this.cpu = cpu; - this.cpu.setRegisterWriteMonitor(MSP430.SP, this); - - if (cpu.getDisAsm() != null) { - MapTable mapTable = cpu.getDisAsm().getMap(); - if (mapTable != null) { - this.heapStartAddress = mapTable.heapStartAddress; - this.stackStartAddress = mapTable.stackStartAddress; - } - } - - diagram = new DotDiagram(2); - diagram.setDotColor(0, Color.green); - diagram.setDotColor(1, Color.green); - diagram.addConstant(Color.red, - this.stackStartAddress - this.heapStartAddress); - add(diagram, BorderLayout.CENTER); - setPreferredSize(new Dimension(320, 200)); - } - - public void addNote(String note) { - notes[pos] = note; - } - - // ------------------------------------------------------------------- - // CPUMonitor - // ------------------------------------------------------------------- - - public void cpuAction(int type, int adr, int data) { - int size = ((stackStartAddress - data) + 0xffff) % 0xffff; - if (this.minData[pos] > size) { - this.minData[pos] = size; - } - if (this.maxData[pos] < size) { - this.maxData[pos] = size; - } - if (cpu.cpuCycles - lastCycles > updateCyclePeriod) { - lastCycles = cpu.cpuCycles; - //System.out.println("STACK UPDATE: " + type + "," + adr + "," + data); - pos = (pos + 1) % this.minData.length; - this.minData[pos] = 0; - this.maxData[pos] = 0; - this.notes[pos] = null; - diagram.setData(0, this.minData, pos, this.minData.length); - diagram.setDataWithNotes(1, this.maxData, notes, pos, this.maxData.length); - } - } - -} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2008-01-28 11:08:43
|
Revision: 90 http://mspsim.svn.sourceforge.net/mspsim/?rev=90&view=rev Author: nifi Date: 2008-01-28 03:08:40 -0800 (Mon, 28 Jan 2008) Log Message: ----------- include jfreechart in classpath Modified Paths: -------------- mspsim/Makefile Modified: mspsim/Makefile =================================================================== --- mspsim/Makefile 2008-01-28 11:08:08 UTC (rev 89) +++ mspsim/Makefile 2008-01-28 11:08:40 UTC (rev 90) @@ -45,7 +45,8 @@ # Arguments ############################################################### -CCARGS=-deprecation -classpath . +CLASSPATH=.$(SEPARATOR)lib/jfreechart-1.0.9.jar$(SEPARATOR)lib/jcommon-1.0.12.jar +CCARGS=-deprecation -classpath "${CLASSPATH}" ############################################################### @@ -82,9 +83,16 @@ compile: $(OBJECTS) -jar: compile - $(JAR) cf $(JARFILE) ${addsuffix /*.class,$(PACKAGES)} images/*.jpg +jar: compile JarManifest.txt + $(JAR) cfm $(JARFILE) JarManifest.txt ${addsuffix /*.class,$(PACKAGES)} images/*.jpg + -$(RM) JarManifest.txt +JarManifest.txt: + @echo >>$@ "Manifest-Version: 1.0" + @echo >>$@ "Sealed: true" + @echo >>$@ "Main-Class: se.sics.mspsim.platform.sky.SkyNode" + @echo >>$@ "Class-path: lib/jfreechart-1.0.9.jar lib/jcommon-1.0.12.jar" + help: @echo "Usage: make [all,compile,clean,run,runsky,runesb]" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2008-01-28 11:08:12
|
Revision: 89 http://mspsim.svn.sourceforge.net/mspsim/?rev=89&view=rev Author: nifi Date: 2008-01-28 03:08:08 -0800 (Mon, 28 Jan 2008) Log Message: ----------- save window positions Modified Paths: -------------- mspsim/se/sics/mspsim/extutil/jfreechart/DataChart.java Modified: mspsim/se/sics/mspsim/extutil/jfreechart/DataChart.java =================================================================== --- mspsim/se/sics/mspsim/extutil/jfreechart/DataChart.java 2008-01-28 11:03:14 UTC (rev 88) +++ mspsim/se/sics/mspsim/extutil/jfreechart/DataChart.java 2008-01-28 11:08:08 UTC (rev 89) @@ -1,8 +1,8 @@ package se.sics.mspsim.extutil.jfreechart; - import java.awt.BasicStroke; import java.awt.BorderLayout; import java.awt.Color; +import java.awt.Dimension; import javax.swing.JFrame; import javax.swing.JPanel; @@ -20,6 +20,7 @@ import se.sics.mspsim.chip.CC2420; import se.sics.mspsim.core.MSP430; +import se.sics.mspsim.ui.WindowUtils; import se.sics.mspsim.util.OperatingModeStatistics; import se.sics.mspsim.util.StackMonitor; @@ -61,6 +62,7 @@ JFreeChart.DEFAULT_TITLE_FONT, xyplot, true); ChartPanel chartPanel = new ChartPanel(chart); setLayout(new BorderLayout()); + setPreferredSize(new Dimension(400, 200)); add(chartPanel, BorderLayout.CENTER); } @@ -68,15 +70,17 @@ dataset.addSeries(ts); } - public void openFrame(String name) { + private JFrame openFrame(String name) { JFrame jw = new JFrame(name); jw.add(this); - jw.setBounds(100, 100, 400, 200); - jw.setVisible(true); + WindowUtils.restoreWindowBounds(name, jw); + WindowUtils.addSaveOnShutdown(name, jw); +// jw.setBounds(100, 100, 400, 200); + return jw; } public void setupStackFrame(MSP430 cpu) { - openFrame("Stack Monitor"); + JFrame jw = openFrame("Stack Monitor"); StackMonitor sm = new StackMonitor(cpu); DataSourceSampler dss = new DataSourceSampler(); TimeSeries ts = new TimeSeries("Max Stack", Millisecond.class); @@ -87,10 +91,11 @@ ts.setMaximumItemCount(200); addTimeSeries(ts); dss.addDataSource(sm.getSource(), ts); + jw.setVisible(true); } public void setupChipFrame(OperatingModeStatistics oms) { - openFrame("Duty-Cycle Monitor"); + JFrame jw = openFrame("Duty-Cycle Monitor"); DataSourceSampler dss = new DataSourceSampler(); dss.setInterval(50); TimeSeries ts = new TimeSeries("LEDS", Millisecond.class); @@ -112,6 +117,6 @@ ts.setMaximumItemCount(200); addTimeSeries(ts); dss.addDataSource(oms.getDataSource("MSP430 Core", MSP430.MODE_ACTIVE), ts); - + jw.setVisible(true); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2008-01-28 11:03:34
|
Revision: 88 http://mspsim.svn.sourceforge.net/mspsim/?rev=88&view=rev Author: nifi Date: 2008-01-28 03:03:14 -0800 (Mon, 28 Jan 2008) Log Message: ----------- added warning if no firmware is specifed as argument Modified Paths: -------------- mspsim/se/sics/mspsim/platform/sky/SkyNode.java Modified: mspsim/se/sics/mspsim/platform/sky/SkyNode.java =================================================================== --- mspsim/se/sics/mspsim/platform/sky/SkyNode.java 2008-01-26 00:27:25 UTC (rev 87) +++ mspsim/se/sics/mspsim/platform/sky/SkyNode.java 2008-01-28 11:03:14 UTC (rev 88) @@ -197,6 +197,11 @@ } public static void main(String[] args) throws IOException { + if (args.length == 0) { + System.out.println("Usage: mspsim.platform.sky.SkyNode <firmware>"); + System.exit(1); + } + final MSP430 cpu = new MSP430(0); // Monitor execution cpu.setMonitorExec(true); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2008-01-26 00:27:36
|
Revision: 87 http://mspsim.svn.sourceforge.net/mspsim/?rev=87&view=rev Author: joxe Date: 2008-01-25 16:27:25 -0800 (Fri, 25 Jan 2008) Log Message: ----------- added energest firmware Added Paths: ----------- mspsim/firmware/sky/energest-demo.firmware Added: mspsim/firmware/sky/energest-demo.firmware =================================================================== (Binary files differ) Property changes on: mspsim/firmware/sky/energest-demo.firmware ___________________________________________________________________ Name: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |