mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-10-29 17:54:14 +08:00
startup: clear MAP_FLASH_PAGE_TO_XDATA before the C runtime initialises xdata
Hardware reset starts the firmware with SFR 0x97 = 1, which maps xdata 0x4000-0xbfff to the flash image: reads return flash bytes, writes are lost. main() cleared it only after __mcs51_genXINIT and the XSEG clear had run, so XISEG (initialised globals) and the part of XSEG above 0x4000 kept stale RAM contents, e.g. session_timeout = 4484 and LLDP blocked on logical ports 0, 3 and 5. Clear it in __sdcc_external_startup(), which SDCC calls before both. Rename SFR_97 to MAP_FLASH_PAGE_TO_XDATA.
This commit is contained in:
4 files changed
+17
-3
No files matched your search
+1
-1
@@ -55,7 +55,7 @@ __sfr __at(0xbb) SFR_BANK_RET;
|
||||
|
||||
__sfr __at(0x8e) CKCON;
|
||||
|
||||
__sfr __at(0x97) SFR_97; // HADDR?
|
||||
__sfr __at(0x97) MAP_FLASH_PAGE_TO_XDATA; // 1 (hardware reset default): xdata 0x4000-0xbfff reads the flash image; 0: RAM
|
||||
__sfr __at(0xb9) SFR_b9;
|
||||
__sfr __at(0xba) SFR_ba;
|
||||
|
||||
|
||||
Reference in new issue
Block a user