From b6dcb75130a2aa828a4786f716c3b21c825215b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20van=20Dorst?= Date: Sun, 30 Aug 2026 20:15:34 +0200 Subject: [PATCH] Disable all __sfr32 due to bug SDCC 4070 and add workarounds. Generate wrong address for `a4` location. Both on read from and write to a __sfr32 variable. Workaround: Use two __sfr16 instead of one __sfr32. We still get some optimalizations / better code gen. --- rtl837x_sfr.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/rtl837x_sfr.h b/rtl837x_sfr.h index f3e4a72..45c117a 100644 --- a/rtl837x_sfr.h +++ b/rtl837x_sfr.h @@ -5,8 +5,13 @@ __sfr16 __at(0xa2a3) SFR_REG_ADDR_U16; __sfr __at(0xa2) SFR_REG_ADDRH; __sfr __at(0xa3) SFR_REG_ADDRL; __sfr16 __at(0xa6a7) SFR_DATA_U16; -__sfr32 __at(0xa4a5a6a7) SFR_DATA_U32; -__sfr32 __at(0xa7a6a5a4) SFR_DATA_U32LE; +// Disabling until the SDCC bug #4070 is fixed. +// Generate wrong address for `a4` location. +// Both read from and write to `SFR_DATA_U32`. +// __sfr32 __at(0xa4a5a6a7) SFR_DATA_U32; +// __sfr32 __at(0xa7a6a5a4) SFR_DATA_U32LE; +// This is the upper part of the U32 as a workaround for SDCC bug #4070. +__sfr16 __at(0xa4a5) SFR_DATA_U16_UPPER; __sfr __at(0xa4) SFR_DATA_24; __sfr __at(0xa5) SFR_DATA_16; __sfr __at(0xa6) SFR_DATA_8;