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

8052 data memory 128bytes or 256 byte?

Hello,
i am using 8052 in my project and according to datasheet the data memory is 256 bytes but in my code if i exceed 128 bytes the code is not compiled

do i need to use it as x data memory?

please help

Parents Reply Children
  • If the compiler automatically allocated variables to idata and data, the first feature demanded would be a way to control which variable went into which memory space. I can see the post now -- "Why doesn't Keil add some keywords so I can force a variable into a particular memory space?"

    The two memory spaces have distinctly different access methods, with different overhead in both code space and time. If variables moved back and forth at the whim of the compiler, your program would constantly be changing size and timing for no apparent reason. Certainly, a good program wouldn't depend on that sort of behavior. On the other hand, it would be one of those hassles you don't need while staying up late trying to work out a bug.

    Data space is a precious commodity that often needs to be carefully allocated. A really smart compiler might be able to work out all the tradeoffs between frequency of access, speed of access, code size, and so on. But that involves understand very high level semantics of the program. As a programmer, I'd certaily want a way to override any such judgements when I disagree with the way the optimizer optimizes.

    It might be a nice luxury to have a "don't care" memory address space assignment keyword, so the compiler could put it in data, idata, or xdata at its whim.

    U8 data oftenAccessed;
    U8 any whoCares;

  • Perhaps a 4th Memory Model that defaults everything to IDATA?

    (Neither Raisonance nor Tasking seems to offer such a model, but IAR does).