Implement basic START_SEG
This commit is contained in:
parent
cd96e01d32
commit
08c7e002b2
|
@ -1,4 +1,3 @@
|
|||
application.args=SIEZA_FW.X.production.hex SIEZA_FW.X.production.bin
|
||||
compile.on.save=true
|
||||
do.depend=false
|
||||
do.jar=true
|
||||
|
|
|
@ -178,7 +178,15 @@ public class IntelHexParser {
|
|||
}
|
||||
break;
|
||||
case START_SEG:
|
||||
throw new Exception("Record at line #" + recordIdx + " not implemented " + record);
|
||||
if (record.length == 4) {
|
||||
startAddress = 0;
|
||||
for (byte c: record.data) {
|
||||
startAddress = startAddress << 8;
|
||||
startAddress |= (c & 0xFF);
|
||||
}
|
||||
} else {
|
||||
throw new Exception("Invalid START_SEG record at line #" + recordIdx + " " + record);
|
||||
}
|
||||
case UNKNOWN:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -53,6 +53,7 @@ public class IntelHexParserDemo implements IntelHexDataListener {
|
|||
String fileOut = "Application.bin";
|
||||
String dataFrom = "0x1D000000";
|
||||
String dataTo = "0x1D07FFEF";
|
||||
|
||||
if (args.length >= 1) {
|
||||
fileIn = args[0];
|
||||
}
|
||||
|
@ -69,10 +70,13 @@ public class IntelHexParserDemo implements IntelHexDataListener {
|
|||
dataTo = args[3];
|
||||
}
|
||||
|
||||
Long dataFromInt = Long.parseLong(dataFrom.substring(2), 16);
|
||||
Long dataToInt = Long.parseLong(dataTo.substring(2), 16);
|
||||
|
||||
InputStream is = new FileInputStream(fileIn);
|
||||
OutputStream os = new FileOutputStream(fileOut);
|
||||
IntelHexParser ihp = new IntelHexParser(is);
|
||||
IntelHexParserDemo ihpd = new IntelHexParserDemo(0x1D000000, 0x1D07FFEF, os);
|
||||
IntelHexParserDemo ihpd = new IntelHexParserDemo(dataFromInt, dataToInt, os);
|
||||
ihp.setDataListener(ihpd);
|
||||
ihp.parse();
|
||||
|
||||
|
|
Loading…
Reference in New Issue