I'm working Renesas at this time and can't test myself. someone asked me a Keil ''51 question I can't nswer: "can you use xdata for local variables.
I guess the answer is no, (the call tree) if someone has the answer, please let me know
Erik
did you actually use the variable, or just see if the compiler/linker would 'take it' the situation is without anu complaints from compiler or linker, that a given function works 'strange' if a local variable is in xdata. changing the local variable to 'automatic' (data) everything is fine, moving the xdata variable outside the function, everything is fine.
There should be absolutely no problem with locating a local variable to xdata. When you use the memory model 'large', the local variables will be located there anyway. Even variable overlaying is implemented for local xdata variables. If your application does not work as expected, please check if the local variable is located at a valid/existing xdata address.
that a given function works 'strange' if a local variable is in xdata.
Once they come up with a more useful description than 'strange', odds are the actual mistake will be revealed as something almost entirely unrelated to this.
Off the cuff, my first two guesses would be: another xdata variable in the vicinity has a buffer over-/underrun, or less than ideal coding practices (function pointers on a '51, calling functions from interrupts, ...) managed to break the automatic data overlaying mechanism. Time to break out the debugger and see whether all writes to that variable (or set of overlayed variables) come from where they should be.