When a function unsigned char __sdcc_external_startup(void) is present, it is executed before both the initialization of static and global variables, as well as main. This allows to implement functionality that needs to be done early. For example: disabling a hardware watchdog that would otherwise bite during the time it takes to initialize global variables; setup or calibration of system/peripheral clocks; or, a memory check that needs to be done before any memory (other than the return address for __sdcc_external_startup itself) is in use.
If this routine returns a non-zero value, the static and global variable initialization will be skipped and the function main will be invoked. Otherwise static and global variables will be initialized before the function main is invoked.
For mos6502, z80, z80n, z180, sm83, ez80_z80, tlcs90, r2k, r2ka, r3ka, when using a custom crt0, support depends on the custom crt0.