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

C51S and movx/xdata

Since Keil (as opposed to some other compilers) do not supply the library in source, I have a question:
I am tasked with debugging some glitches in a very strange design: External memory is used and ALE is disabled. To access external RAM one must latch the low address in an external latch by toggling a p1 pin before executing external RAM access (movx). My question thus is: do the routines in C51S EVER execute movx.
I have no possibility of replacing thousands of hardware units, and already have the next version concept so I need the above question answered.

Thanks in advance

Erik

Parents
  • do the routines in C51S EVER execute movx.

    The answer is YES. However, the small library routines do not locate any of their variables in XDATA and they do not access XDATA arbitrarily. They only access XDATA if you pass a pointer to an XDATA object.

    Since the library routines perform operations on objects that you point to (for example strcpy), if you pass a pointer to an object in XDATA, then the library routine is OBLIGATED to access XDATA.

    As long as you do not instruct any routines in the small library to access objects stored in XDATA, the library will not access XDATA.

    Now, of course, the library routines must include the code necessary to access XDATA (in case your program does that). So, if you disassemble your program, you'll see MOVX instructions in the disassembly.

    If you find cases where the small library routines access XDATA, it is because of a pointer to XDATA that you passed to the routine.

    Jon

Reply
  • do the routines in C51S EVER execute movx.

    The answer is YES. However, the small library routines do not locate any of their variables in XDATA and they do not access XDATA arbitrarily. They only access XDATA if you pass a pointer to an XDATA object.

    Since the library routines perform operations on objects that you point to (for example strcpy), if you pass a pointer to an object in XDATA, then the library routine is OBLIGATED to access XDATA.

    As long as you do not instruct any routines in the small library to access objects stored in XDATA, the library will not access XDATA.

    Now, of course, the library routines must include the code necessary to access XDATA (in case your program does that). So, if you disassemble your program, you'll see MOVX instructions in the disassembly.

    If you find cases where the small library routines access XDATA, it is because of a pointer to XDATA that you passed to the routine.

    Jon

Children
No data