Skip to content

Commit

Permalink
minor fixes to flashsend, resetFpga seems needed between plugin the b…
Browse files Browse the repository at this point in the history
…oard & using the flash
  • Loading branch information
rdolbeau committed Oct 14, 2023
1 parent b7d43ee commit bd8d1da
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions flashsend/FlashSend.java
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ else if ( args[i].equals("-h") ) {
System.out.println("Primary Flash enabled: " + ztex.flashEnabled());
System.out.println("Primary Flash sector size: " + ztex.toHumanStr(ztex.flashSectorSize())+" Bytes");
System.out.println("Primary Flash size: " + ztex.toHumanStr(ztex.flashSize())+" Bytes");
System.out.println("Primary Flash first free sector: " + ztex.flashFirstFreeSector());
} else {
throw new ParameterException("Currently write only to Primary Flash, which is not available.");
}
Expand All @@ -237,11 +238,16 @@ else if ( args[i].equals("-h") ) {
if (sector < 0) {
throw new ParameterException("Sector to start must be specified as a positive integer, it is recommened to be higher than the reserved area.");
}
if (doWrite & (sector < ztex.flashFirstFreeSector())) {
throw new ParameterException("Sector to start writing at should be higher than the reserved area, probably (" + ztex.flashFirstFreeSector() + ")");
}

if (filename == null) {
throw new ParameterException("Non-existent filename: " + (filename == null ? "(null)": "filename" ));
}

ztex.resetFpga();

if (doWrite) {
File f = new File(filename);
if (!f.exists() || !f.isFile() || !f.canRead() || f.length() == 0) {
Expand Down

0 comments on commit bd8d1da

Please sign in to comment.