We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi, everybogy
I created a simple example project consist of only one source code file main.c, within Keil MDK 3.24 Eval as below.
//*****************************************************
#include <lpc23xx.h>
unsigned int variable0 __attribute__((section("sec_data"), used)) = 0x55AA55AA;
int main (void) { unsigned int i;
while (1) { i++; } }
// End of File
And when I compiled and linked the example using a scatter loading descrption file, one warning feedback produced by the linker read like this.
"Prj1.sct(14): warning: L6329W: Pattern *.o(sec_data) only matches removed unused sections."
The warning message above showed that the section sec_data had been removed by linker for the reason of no refered by the source code explicitly.
The scatter description file causing the warning read as below
LR_IROM1 0x00000000 0x00080000 {
ER_IROM1 0x00000000 0x00080000
{
*.o (RESET, +First)
*(InRoot$$Sections)
.ANY (+RO)
}
TABLE 0x40000000 0x20
*.o(sec_data)
RW_IRAM1 0x40001000 0x00001000
.ANY (+RW +ZI)
How can I restain the unrefered variable variable0 in the last image? Please give your hand!
> Note that there is a --keep option
Sure. But then there'd be three places to properly set up the variable (code, scatter, cmd line). If a scatter file is used anyway, I'd prefer putting the information there.
Regards Marcus http://www.doulos.com/
Would it not be simpler to just provide a reference to it?
Or, can you put it in a section with other stuff that is referenced?
Which brings us back to the question: why is it there if it's not referenced?
Ah - so now we're training the trainers...?!
;-)
Oops; sorry - thought that was the OP.
I can thoroughly recommend Doulos as competent trainers!