when I define a variable like next: uchar idata M_TVar _at_ 0x80; I got a warning: *** WARNING L4: DATA SPACE MEMORY OVERLAP FROM: 0000H TO: 0001H
the next is in .M51 file:
* * * * * * * D A T A M E M O R Y * * * * * * * IDATA 0000H 0001H ABSOLUTE * OVERLAP * IDATA 0000H 0001H ABSOLUTE * OVERLAP * REG 0000H 0008H ABSOLUTE "REG BANK 0" DATA 0008H 0040H UNIT ?DT?MAIN
how i fix it?
Do you understand what the word "Overlap" means?
You are forcing your variable to be located in IDATA at address 0x80 - what else might already be at that location...?
Hint: take a look at page 3 in Chapter 1 of the so-called "bible" for the 8051:
Chapter 1 - 80C51 Family Architecture: www.nxp.com/.../80C51_FAM_ARCH_1.pdf
Chapter 2 - 80C51 Family Programmer's Guide and Instruction Set: www.nxp.com/.../80C51_FAM_PROG_GUIDE_1.pdf
Chapter 3 - 80C51 Family Hardware Description: www.nxp.com/.../80C51_FAM_HARDWARE_1.pdf
As you know. I want to store some of such variables into EEPORM, So, when I use absolute address, the R/W routine will be very simple. And my question is that, the address i used is 0x80, but the warning say it at 0000H. Why??
"As you know. I want to store some of such variables into EEPORM"
How is anyone supposed to know that? You didn't mention it!
"And my question is that, the address i used is 0x80"
So it is - I'm sorry, I misread that initially!
"but the warning say it at 0000H"
The warning says that the overlap is at 0000H - so there must be something else.
Are you sure you don't have any other absolutely-located items - whether using _at_ or Linker controls or whatever...
I can see someone at Keil coding 0x80 as IDATA 0 (sometimes I think of it that way), who knows.
Ask Keil support
Erik
I have resolved that problem
the error is in the define of variable in my head file: the old: #ifdef GLOBAL_VAR #define EXT_VR #else #define EXT_VR extern EXT_VR uchar idata M_TVar _at_ 0x80;
And I use the file in two files: fileA.c and fileB.c
and the newest file writen as: #ifdef GLOBAL_VAR #define EXT_VR EXT_VR uchar idata M_TVar _at_ 0x80; #else #define EXT_VR extern EXT_VR uchar idata M_TVar;// _at_ 0x80; So it works good. but I don't know why. may be Keil just do it in that way;
thanks for every body!!
by the way, must define GLOBAL_VAR once before include headfile in one of C files.
"but I don't know why"
The _at_ is only meaningful on a definition - not in a declaration
ie, _at_ doesn't make sense with extern!
You need something like
#ifdef DEFINE_GLOBAL // Make a definition #define EXT_ABS(name,loc) uchar idata name _at_ loc #else // Make an extern declaration #define EXT_ABS(name,loc) extern uchar idata name #else EXT_ABS( M_TVar, 0x80 );
View all questions in Keil forum