Special attention is needed if absolute variables are involved in the linker's link process.
If an absolute object is not referenced by the application, it is always linked using the ELF/DWARF format. To force linking, switch off smart linking in the Linker, or using the ENTRIES command in the linker parameter file.
The example in the following listing shows how the linker handles different absolute variables.
char i; /* zero out */ char j = 1; /* zero out, copy-down */ const char k = 2; /* download */ char I@0x10; /* no zero out! */ char J@0x11 = 1;/* copy down */ const char K@0x12 = 2;/* ELF: download! */ static char L@0x13; /* no zero out! */ static char M@0x14 = 3; /* copy down */ static const char N@0x15 = 4; /* ELF: download */ void interrupt 2 MyISRfct(void) {} /* download, always linked! */ /* vector number two is downloaded with &MyISRfct */ void foo(char *p) {} /* download */ void main(void) { /* download */ foo(&i); foo(&j); foo(&k); foo(&I); foo(&J); foo(&K); foo(&L); foo(&M); foo(&N); }
Zero out means that the default startup code initializes the variables during startup. Copy down means that the variable is initialized during the default startup. To download means that the memory is initialized while downloading the application.