SourceForge has been redesigned. Learn more.

#418 Problem with internal RAM access


Hi there,
my goal is to use the Philips 89C51RC2 with 512 Byte
internal RAM. Is there a chance to tell sdcc that there
are 512 Byte of internal memory ?
Additionally there's a problem if I overload the data
memory range with too many too large variables. SDCC
then makes a DIRECT access to the memory address range
above (idata); this results in a wasted content of the
registers, which will be overwritten. Keil for example
automatically transfers the supernumerary data memory
variables into idata memory (with indirect access). Is
there a chance that sdcc gives me a warning if I
overload the memory or that SDCC does the same like Keil?

With best regards



  • Jesus Calvino-Fraga

    Logged In: YES


    The extra memory in the 89C51RC2 is actually builtin external
    memory. From the data sheet:

    "4. The 256/768-bytes expanded RAM (ERAM, 00H
    FFH/2FFH)are indirectly accessed by move external
    instruction, MOVX, and with the EXTRAM bit cleared, see
    Figure 27."

    So just put "xdata" in front of your variables when you declare
    them. Also the latest version of SDCC (2.3.2 as for 04 Dec
    2002) will warn if you run out of memory both in data or
    idata, or if there is an overlap. You can download version
    2.3.2 from:

    You can check the memory usage either from the map or
    mem files generated by the linker.


  • Jesus Calvino-Fraga

    • status: open --> closed

Log in to post a comment.