From eea9016174757ec445751cb4998c669b8030fef7 Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Thu, 1 Oct 2026 10:46:50 +1300 Subject: [PATCH] tools: allow XISEG to end exactly at the end of XRAM check_xiseg() adds the start and length of XISEG, which gives the address just past its last byte, and flagged an overflow when that equals the XRAM size. XISEG ending at 0x1000 on a 4096 byte board uses the last byte, 0x0fff, and still fits: the linker, which is given the same size with --xram-size, accepts it, and the stack lives in internal RAM, not above XISEG. The check then printed "0 bytes available" and failed the build. Only fail when XISEG ends past the end of XRAM. --- Firmware/tools/check_code.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/tools/check_code.py b/Firmware/tools/check_code.py index 9ed3e40f..a0737d0b 100755 --- a/Firmware/tools/check_code.py +++ b/Firmware/tools/check_code.py @@ -71,7 +71,7 @@ def check_xiseg(): ofs2 = int(m.group(2),16) print(os.popen("tail -n5 %s.mem"%board).read()) print('XISEG %s - %u bytes available' % (map, xram_size-(ofs1+ofs2))) - if ofs1 + ofs2 >= xram_size: + if ofs1 + ofs2 > xram_size: print('ERROR: XISEG overflow %u in %s' % (ofs1+ofs2, map)) error_count += 1