From 7535c0d9b7e8dbdf4f16b3a40756951f266ca1c1 Mon Sep 17 00:00:00 2001 From: d00f <8052722+DrDoof@users.noreply.github.com> Date: Sun, 25 Oct 2026 22:44:51 +0100 Subject: [PATCH] installer: build with the toolchain from the tree The installer Makefile called whatever sdcc was on the PATH, so an installer built by hand came out of the system compiler, without the fixes in sdcc/. Use the same toolchain/sdcc- as the main Makefile, built on demand by sdcc/build.sh if a bare installer build gets there first, and keep CC= on the command line as the way to pick another compiler. The README example shows the new command lines. --- README.md | 6 +++--- installer/Makefile | 16 +++++++++++++--- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 25c0a02d..6abf52c0 100644 --- a/README.md +++ b/README.md @@ -170,9 +170,9 @@ example of compilation console output RTLPlayground/installer$ make mkdir -p output gcc updatebuilder.c -o output/updatebuilder -sdas8051 -plosgff -o output/crtstart.rel crtstart.asm -sdcc -mmcs51 --code-loc 0x1000 -o output/installer.rel -c installer.c -sdcc -mmcs51 -Wl-bHOME=0x1100 -Wl-r -o output/rtlinstaller.ihx output/crtstart.rel output/installer.rel +../toolchain/sdcc-3390765201/bin/sdas8051 -plosgff -o output/crtstart.rel crtstart.asm +../toolchain/sdcc-3390765201/bin/sdcc -mmcs51 --code-loc 0x1000 -o output/installer.rel -c installer.c +../toolchain/sdcc-3390765201/bin/sdcc -mmcs51 -Wl-bHOME=0x1100 -Wl-r -o output/rtlinstaller.ihx output/crtstart.rel output/installer.rel ./output/updatebuilder -i output/rtlinstaller.ihx -o output/rtlplayground_oem_upgrade.bin ../output/rtlplayground.bin Input file size: 524288 Bytes read: 524288 diff --git a/installer/Makefile b/installer/Makefile index c451f499..1aeef985 100644 --- a/installer/Makefile +++ b/installer/Makefile @@ -1,9 +1,14 @@ CODE_LOCATION=0x1000 INSTALLER_ADDRESS=0x1100 -CC = sdcc +SDCC_PREFIX = ../toolchain/sdcc-$(shell cat ../sdcc/* | cksum | cut -d' ' -f1) +ifeq ($(origin CC),default) +SDCC = $(SDCC_PREFIX)/bin/sdcc +CC = $(SDCC) +ASM = $(SDCC_PREFIX)/bin/sdas8051 +endif CC_FLAGS = -mmcs51 -ASM = sdas8051 +ASM ?= sdas8051 AFLAGS= -plosgff BUILDDIR = output @@ -13,9 +18,14 @@ OBJS = ${SRCS:%.c=$(BUILDDIR)/%.rel} all: create_build_dir $(BUILDDIR)/updatebuilder $(BUILDDIR)/rtlplayground_oem_upgrade.bin -create_build_dir: +create_build_dir: $(SDCC) mkdir -p $(BUILDDIR) +ifneq ($(SDCC),) +$(SDCC): + sh ../sdcc/build.sh $(abspath $(SDCC_PREFIX)) +endif + $(BUILDDIR)/updatebuilder: updatebuilder.c gcc $^ -o $@