This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Place static variable in RAM?

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

Parents
  • 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'?

Reply
  • 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'?

Children
  • 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(". .....