mirror of
https://git.k-space.ee/arti/vt1200.git
synced 2026-10-31 12:05:05 +02:00
build-lance.sh: fail the build if .text overlaps the marker block
The text panel grew .text past MARK and the payload overwrote its own code with cell() writes (illegal opcode on the unit). The build now parses build/lance.map and aborts if the end of .text reaches MARK, printing the remaining gap.
This commit is contained in:
1 parent
c0ae3ecd27
commit
895e059383
1 file changed
+18
@@ -87,6 +87,24 @@ done
|
||||
OUTNAME=${LANCE_OUT:-lance.coff}
|
||||
cp "$WORK/LANCE.OUT" "$OUT/$OUTNAME"
|
||||
sed 's/\r$//' "$WORK/LANCE.MAP" > "$OUT/lance.map"
|
||||
# Guard: the marker block (MARK in the source) must sit clear of .text, or the
|
||||
# payload overwrites its own code with cell() writes (an illegal-opcode crash).
|
||||
python3 - "$SRC" "$OUT/lance.map" <<'PYCHK'
|
||||
import re, sys
|
||||
src, mp = sys.argv[1], sys.argv[2]
|
||||
m = re.search(r'#define\s+MARK\s+(0x[0-9A-Fa-f]+)', open(src).read())
|
||||
if m:
|
||||
mark = int(m.group(1), 16)
|
||||
for ln in open(mp):
|
||||
f = ln.split()
|
||||
if len(f) >= 4 and f[0] == '.text':
|
||||
start, size = int(f[2], 16), int(f[3], 16)
|
||||
end = start + size
|
||||
if end > mark:
|
||||
sys.stderr.write("build: ERROR .text ends at 0x%X, past MARK 0x%X\n" % (end, mark))
|
||||
sys.exit(1)
|
||||
print("build: .text ends 0x%X, MARK 0x%X (%d bytes clear)" % (end, mark, (mark - end) // 8))
|
||||
PYCHK
|
||||
sed 's/\r$//' "$WORK/LANCE.LST" > "$OUT/lance.lst"
|
||||
sed 's/\r$//' "$WORK/ENTRY.LST" > "$OUT/entry.lst"
|
||||
echo "build.sh: $OUT/$OUTNAME ($(wc -c < "$OUT/lance.coff") bytes)"
|
||||
|
||||
Reference in new issue
Block a user