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 memory has to be explicitly enabled before it can be accessed or if the watchdog needs to be disabled, this is the place to do it. The startup code clears all internal data memory, 256 bytes by default, but from 0 to n-1 if --iram-sizen is used. (recommended for Chipcon CC1010).

See also the compiler option --no-xinit-opt and section 4.1 about MCS51-variants.


next up previous contents index
Next: 3.11.2 HC08 Startup Code Up: 3.11 Startup Code Previous: 3.11 Startup Code   Contents   Index
Erik Petrich 2006-07-28