mirror of https://github.com/contiki-ng/mspsim
fixed configuration of ext flash
git-svn-id: https://mspsim.svn.sourceforge.net/svnroot/mspsim/mspsim@108 23d1a52b-0c3c-0410-b72d-8f29ab48fe35
This commit is contained in:
parent
f484042b44
commit
e247570afe
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -86,15 +86,18 @@ public class M25P80 extends Chip implements USARTListener, PortListener {
|
|||
|
||||
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) {
|
||||
|
|
|
|||
|
|
@ -91,6 +91,7 @@ public class SkyNode extends Chip implements PortListener, USARTListener {
|
|||
|
||||
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 @@ public class SkyNode extends Chip implements PortListener, USARTListener {
|
|||
* 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 @@ public class SkyNode extends Chip implements PortListener, USARTListener {
|
|||
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 @@ public class SkyNode extends Chip implements PortListener, USARTListener {
|
|||
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();
|
||||
|
|
|
|||
Loading…
Reference in New Issue