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

Global xdata variables

Hi!

I have a problem with global xdata variables. In main.c I have the following code to make two global arrays.

unsigned int xdata fordonsnummer[100] _at_ 0x000;
unsigned int xdata tomvikt[100] _at_ 0x0c8;  

Then in some heather files I have functions that uses the global variable. there for I have the following code:
extern unsigned int xdata fordonsnummer[];
extern unsigned int xdata tomvikt[];  
One function writes a value to a position in the array but when another reads the same value something goes wrong. The written value is for example 12345 and the read value is 257. What is wrong with my code. I have marked the "Use the onchip XRAM" in Options for target.

Regard Jonas Finell

Parents
  • "... in some heather files ..."

    Are they the lucky ones...? ;-)

    "I have marked the "Use the onchip XRAM" in Options for target."

    That option simply provides information to the tools; it's just a shortcut way of telling the linker how much XDATA memory you have, and at what address range.

    What it does not do is to set up any configuration registers, etc, that may be required on your target hardware to enable the physical memory.
    You will need to read the manual(s) and/or datasheet(s) for your particular hardware for further details.

Reply
  • "... in some heather files ..."

    Are they the lucky ones...? ;-)

    "I have marked the "Use the onchip XRAM" in Options for target."

    That option simply provides information to the tools; it's just a shortcut way of telling the linker how much XDATA memory you have, and at what address range.

    What it does not do is to set up any configuration registers, etc, that may be required on your target hardware to enable the physical memory.
    You will need to read the manual(s) and/or datasheet(s) for your particular hardware for further details.

Children
No data