fixed an issue in the intel-hex import, closes #1451

This commit is contained in:
hneemann 2025-08-14 16:33:56 +02:00
parent d828d71eef
commit 535812dacb
2 changed files with 14 additions and 4 deletions

View File

@ -2,6 +2,8 @@ Release Notes
HEAD, planned as v0.32
- Fixed some bugs in the creation of circuits.
- Fixed an Intel Hex import error that occurred when
files contained more than 64 kBytes of data.
v0.31, released on 3. September 2024
- Added a run command to the cli to run circuit headless

View File

@ -40,18 +40,26 @@ public class IntelHexReader implements ByteArrayReader {
case 0:
readData(payload, byteArray);
break;
case 2:
readDataSegment(payload);
case 1:
// eof
break;
case 2:
readDataSegment(payload, 4);
break;
case 4:
readDataSegment(payload, 16);
break;
default:
throw new IOException("Intel-Hex Record Type " + data[3] + " not supported");
}
}
}
}
private void readDataSegment(int len) throws IOException {
private void readDataSegment(int len, int shift) throws IOException {
if (len != 2)
throw new IOException("invalid segment address");
segment = ((data[4] << 8) + data[5]) << 4;
segment = ((data[4] << 8) + data[5]) << shift;
}
private void readData(int len, ByteArray byteArray) {