Jeff Lasslett <jeff.lasslett@xxxxxxxxxxxxxxxx> writes: > The old diab compiler that I am in the process of replacing with GCC supports > the following ... > > // preserve variables across wakeup > #pragma section DATA ".dataW" ".bssW" far-absolute > #pragma section SDATA ".sdataW" ".sbssW" far-absolute > > ... which causes the compiler to put stuff normally destined for .data, .bss, > .sdata and .sbss into different input sections (.dataW, .sdataW, .bassW, > .sbssW). > > We do this because our hardware can start cold, or warm, or 'wake from sleep' > and we don't always want to initialise variables. > > Could someone please advise me as to how I can get GCC to do the same thing? gcc does not provide a mechanism for changing the default for all variables in a compilation. You can use __attribute__ ((section (NAME))) for specific variables. See the gcc documentation for details. You can use a linker script to move variable sections around on an object file by object file basis. See the linker documentation for details. Ian