next up previous contents index
Next: 3.11.2 HC08 Startup Code Up: 3.11 Startup Code Previous: 3.11 Startup Code   Contents   Index

3.11.1 MCS51/DS390 Startup Code

The compiler inserts a call to the C routine _sdcc_external_startup() at the start of the CODE area. This routine is in the runtime library. By default this routine returns 0, if this routine returns a non-zero value, the static & global variable initialization will be skipped and the function main will be invoked. Otherwise static & global variables will be initialized before the function main is invoked. You could add a _sdcc_external_startup() routine to your program to override the default if you need to setup hardware or perform some other critical operation prior to static & global variable initialization. On some mcs51 variants xdata has to be explicitly enabled before it can be accessed, this is the place to do it. See also the compiler option --no-xinit-opt and section 4.1 about MCS51-variants.



Bernhard Held 2004-02-21