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

xdata and compact memory model

If I'm using the compact memory model, which implicitly sticks variables in xdata, but also declare a variable (in this case a char[]) to go in xdata, it appears to use the wrong pointer type. Thus, I get the lower 8 bits if the address, NOT the data.

Not explicitly declaring the variable as xdata yields the correct result.

Is it me or the compiler?

Parents
  • Do Not use Compact Model. Always try to use Small and then explicitly place structs/arrays and seldom used vars in xdata. pdata saves little code by using the movx A,@Rn but depends on P2 address lines ALWAYS being the correct value. Keil sets P2 to the PDATA area assigned in startup but never updates later. If you mess with P2 you can screw up pdata area big time.

Reply
  • Do Not use Compact Model. Always try to use Small and then explicitly place structs/arrays and seldom used vars in xdata. pdata saves little code by using the movx A,@Rn but depends on P2 address lines ALWAYS being the correct value. Keil sets P2 to the PDATA area assigned in startup but never updates later. If you mess with P2 you can screw up pdata area big time.

Children