From eb4bae278bb4d9eb162660a0a4b0e1fbc86c61ae Mon Sep 17 00:00:00 2001 From: d00f <8052722+DrDoof@users.noreply.github.com> Date: Mon, 14 Sep 2026 02:07:57 +0200 Subject: [PATCH] Makefile: let the linker check external RAM against 0xBFFF The 8051 in the RTL837x has 48 kB of XDATA, 0x0000 to 0xBFFF. Writing a byte and reading it back from the same address works all the way up to 0xBFFF on a SWTGW218AS, while at 0xC000 the byte comes back as 0x00. Without --xram-size the linker assumes 16 MB, so running past the end would still build cleanly and only show up at run time. The value is 49151 rather than 49152. The linker check adds up the sizes of the XDATA areas, and XDATA allocation starts at 0x0001, so a limit of 49152 would still let the last byte land on 0xC000. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 4b0190d2..cb94ca16 100644 --- a/Makefile +++ b/Makefile @@ -134,7 +134,7 @@ $(BUILDDIR)/%.rel: %.asm | create_build_dir # mv -f $(addprefix $(basename $^), .lst .rel .sym) . $(BUILDDIR)/rtlplayground.ihx: $(OBJS) $(BUILDDIR)/crtbank.rel $(BUILDDIR)/crc16.rel - $(CC) $(CC_FLAGS) -Wl-bHOME=0x00000 -Wl-bBANK1=0x14000 -Wl-bBANK2=0x24000 -Wl-bBANK3=0x34000 -Wl-r -o $@ $^ + $(CC) $(CC_FLAGS) --xram-size 49151 -Wl-bHOME=0x00000 -Wl-bBANK1=0x14000 -Wl-bBANK2=0x24000 -Wl-bBANK3=0x34000 -Wl-r -o $@ $^ $(BUILDDIR)/rtlplayground.img: $(BUILDDIR)/rtlplayground.ihx objcopy --input-target=ihex -O binary $< $@