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

Address space overflow - am I really using 1k internal RAM ?

I am working with a DS89c450 and uVision3.

My simple C code project consists of just the ds89c450, no other devices. I have the
memory Model set to small (variables in DATA) Code ROM size set to 64K, and the option boxes
for "Use on chip ROM (0x0-0xFFFF)" and "Use on chip XRAM (0x0-0x3FF) bot checked.

I'm compiling what I think is relatively small program that doesn't use a tremendous amount
of RAM, but I am still getting the Address Space Overflow error L107 - referring to the
DATA space.

It is not clear to me whether or not I am really using the 1K internal RAM. I can remove
a single 1 byte variable and compile fine. I then look in the M51 listing file and the
DATA amounts only total about 120 bytes.

How I be sure the compiler is really using the internal 1K RAM ... and have it place whatever
variables can't fit elsewhere there ?

Thanks

  • Ok ... so I set the IDATALEN to 100h, and used idata in declaring an array and all is well,
    except I was still wondering how I can use the other 700++ bytes of my 1K internal RAM.

    Apparently I must use XDATA instead. I had thought that referred to memory that is literally
    off-chip.

  • My 8051 knowledge is awfully rusty, but as I recall only the first 256 bytes of memory are directly addressable, and a large portion of that is shadowed by the SFR, ie where a lot of the "zero page" stuff is actually registers. The rest of the larger memory arena is then accessed indirectly via XDATA, paging, or whatever, including space that might be masked by internal registers from the direct view.

    The documentation for your specific part may spread some light on the implementation details.

  • I was still wondering how I can use the other 700++ bytes of my 1K internal RAM.
    Odds are you're not actually using any of those yet, so there's no "the other 700++ bytes", there's "the entire 1024 bytes" you're yet to use.

    Apparently I must use XDATA instead. I had thought that referred to memory that is literally off-chip
    That thought is incorrect for the device you have. XDATA is an address space, not a memory interface technique: it's the data accessed by MOVX instructions. Back in the 70s, when the original '51s were still used outside academic backwaters, if you wanted XDATA, you had to actually connect a separate RAM chip to the CPU. Those times are mostly gone (and good riddance, too). Your chip has on-chip XDATA, so use it.

    You'll have to make sure it's enabled first, though. On '51 derivates striving to be compatible to the original, all "modern" features, including on-chip XDATA, are usually disabled in the reset default state of the controller, and thus have to be enabled explicitly before use.

  • All my concerns are resolved. It was the use of the XDATA qualifier in declaring a
    variable.

    And, yes, it does require a bit being set. I believe the compiler does that for you
    in the startup code if you run the ide. Otherwise, I believe the bit is in the PMR
    register (DME1 or DME0) and you must add it to your start up module.

    It has to be set prior to jumping into C main( ) as the start up code may need to
    initialize data, etc.