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

how to store a variable in a particular memory location

we are designing DATA loggers for Railways. For that we are using 2468 ARM processor. while designing the system we have an issue that

all local variables should be stored in INTERNAL RAM (64k) & all GLOBAL VARIABLES
should be stored in EXTERNAL SDRAM.

is this feature available in KEIL ARM if so how to configure it.

Another one is how to STORE a variable in a particular memory location (global or local variable) in Keil compiler..

can any one help me.........

Parents
  • "all local variables should be stored in INTERNAL RAM (64k) & all GLOBAL VARIABLES
    should be stored in EXTERNAL SDRAM."

    Normally, local variables would be stored on the stack, and global variables elsewhere.

    So you could locate the stack in internal RAM and ensure other variables are stored elsewhere.

Reply
  • "all local variables should be stored in INTERNAL RAM (64k) & all GLOBAL VARIABLES
    should be stored in EXTERNAL SDRAM."

    Normally, local variables would be stored on the stack, and global variables elsewhere.

    So you could locate the stack in internal RAM and ensure other variables are stored elsewhere.

Children
  • Is it possible to know the address of the variable whose location is choosen by the keil compiler???( is keil support any predefined instructions??).....

    one way to choose the particular address

    int var __attribute__((at(0xA0001000))); var=0x28;

    but everytime it is difficult to choose the diff address for diff varible.( some times same address may be mistakenly allotted to other variables where keil compiler will not generate any error).

    if we allow the compiler it will takes the burden. but now if the compiler allots the memory we don't know where the location is...?
    is it possible to get the address of the variable with any type of instructions..??? is keil support this feature..???

  • This information is provided in the Linker listing or "Map" file - again, see the Manuals for details!

  • but everytime it is difficult to choose the diff address for diff varible.

    Which brings us right back to the original issue: Why do you believe you have to muck with that in the first place? The compiler and linker are quite perfectly capable of getting variable location right entirely without your "help". So why interfere with it?

  • The compiler and linker are quite perfectly capable of getting variable location right entirely without your "help".

    Yes. I always trusted the tools. Until they decided to put things in places that wasn't right for my hardware configuration.

    Truth is: the tools know about 'typical' hardware configurations. If you have something non-typical, then you can give the tools a little hint (or maybe, sometimes, a big kick).

    But before you do, you need to understand the details of what the tools do, what could be manipulated and how.