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 All
If I declare a variable (or a data struct) static, the data is placed in the IRAM. I guess the static data is moved to the IRAM before the "main" in called and probally also before the SDRAM is up running.
But is it possible to locate any static declared data to RAM instead of IRAM?
Thomas
Could you explain how?
First you need to explain what this 'RAM' is and why you are having difficulties locating variables there.
Hi
RAM is SDRAM on my CPU.
If I declare a structure non-static, the data is located according to my scatter file for that module.
RW_RAM2 0xA0025800 0x00FDA800 { module.o (+ZI) }
If I put the 'static' keyword in front of it and move it to the header file, I get a link error that it exceeds the maximum space in the IRAM.
So, the linker allocated in the IRAM space when I have static in front of it. Need the linker to allocate it in the SDRAM instead
This might help:
http://www.keil.com/support/man/docs/armlink/armlink_BABHIIEF.htm
You probably don't want to declare a static global variable in a header file. If you do you will get a separate copy of the variable in every compilation that #includes that header (unless the compiler/linker can discard some of them).
What are you trying to accomplish by making the variable 'static'?
I have my doubts, not aboot locating the variable, but the initialization thereof.
I is my impression that initialization of variables take place before the external memories are enabled.
If I'm right, then, of course you can, yourself, initialize the external memories after enableing them.
Erik
PS just a footnote: if there are a lot of variables to go in external RAM, I would locate them in a sparate module and use "options for file" to avoid a bunch of __attribute__((section(". .....