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

Local variables (even if designated as xdata) are in code space

Example:
void kfunc(unsigned char * m)
{ unsigned char xdata * k;

REG = *k;
}

If I hover over k, UVision says k = C:0x0000. If I define k as a global no such issues.

Am I missing something here?

Parents
  • I verified that the code I posted reproduces the issue. It's not the code from my program, as I can't post that code here. Reposting with the proper formatting...

    #define BASE 0x1000
    
    void blah (unsigned char Offset)
    {
            unsigned char xdata *Address;
            Address = (BASE + Offset);
            SPXB_MSTR_DATA1 = *(Address+3);
            SPXB_MSTR_DATA2 = *(Address+2);
            SPXB_MSTR_DATA3 = *(Address+1);
    }
    

Reply
  • I verified that the code I posted reproduces the issue. It's not the code from my program, as I can't post that code here. Reposting with the proper formatting...

    #define BASE 0x1000
    
    void blah (unsigned char Offset)
    {
            unsigned char xdata *Address;
            Address = (BASE + Offset);
            SPXB_MSTR_DATA1 = *(Address+3);
            SPXB_MSTR_DATA2 = *(Address+2);
            SPXB_MSTR_DATA3 = *(Address+1);
    }
    

Children