// D1 regression for the crt0Gno BSS-clear heartbeat bug: a large zero-init // BSS array pushes __bss_end past the old ~0xB100 corruption threshold. // crt0Gno no longer clears BSS (the loader fills the embedded zeros), so // the program must run to the end AND read the array back as all-zero. #include // ~5.75 KB. With the current GNO libc the runtime BSS base already sits at // ~0xD000 (well above the old ~0xB100 heartbeat threshold), so this array's job // is to keep __bss_end large (near the bank-0 top) while still fitting bank 0. static volatile uint8_t bigBss[0x1700]; int main(void) { *(volatile uint16_t *)0x025010UL = 0xBEEF; uint16_t zeroed = 1; unsigned i; for (i = 0; i < 0x1700; i++) { if (bigBss[i] != 0) { zeroed = 0; break; } } *(volatile uint16_t *)0x025012UL = zeroed ? 0x0001 : 0xDEAD; bigBss[0] = 1; // retain bigBss[0x16FF] = 2; *(volatile uint16_t *)0x025000UL = 0xC0DE; for (volatile unsigned long j = 0; j < 600000UL; j++) { } return 0; }