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

about absolute address variable using"_at_"

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?

Parents
  • #ifdef GLOBAL_VAR
    #define EXT_VR
    #else
    #define EXT_VR extern
    

    I suggest you do yourself a favour and get rid of this supposed "trick". It may seem like a major advantage to only have to write declarations once, but

    1) it only works for a subset of globals --- if you have an explicit initializer, you have to write the definition and declaration separately again.

    2) it puts stuff into the interface (header) that shouldn't be there: the initializers.

    3) it shoves all globals of the entire program into one translation unit (which has to include all header files, too). That can make it needlessly hard for the linker to fit all those variable into memory, especially if memory space is fragmented.

Reply
  • #ifdef GLOBAL_VAR
    #define EXT_VR
    #else
    #define EXT_VR extern
    

    I suggest you do yourself a favour and get rid of this supposed "trick". It may seem like a major advantage to only have to write declarations once, but

    1) it only works for a subset of globals --- if you have an explicit initializer, you have to write the definition and declaration separately again.

    2) it puts stuff into the interface (header) that shouldn't be there: the initializers.

    3) it shoves all globals of the entire program into one translation unit (which has to include all header files, too). That can make it needlessly hard for the linker to fit all those variable into memory, especially if memory space is fragmented.

Children
No data