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

Using the Xdata of AT89C51xD2 MCU

Hello All,

I am trying to use the xdata of the Atmel 89C51RD2 chip but it seems not to be working. I have tried most of all the suggestion I search on this forum but non seems to work. There is definitely something I am not getting write.

Here is all I have done thus far

1. Changing the Start up code as follows

IDATALEN        EQU     100H
XDATASTART      EQU     00H
XDATALEN        EQU     700H    ; 1792 size
PDATASTART      EQU     0H
PDATALEN        EQU     0H


; Standard SFR Symbols
ACC     DATA    0E0H
B       DATA    0F0H
SP      DATA    81H
DPL     DATA    82H
DPH     DATA    83H
AUXR    DATA    8EH               ; add SFR definition for AT89c51xD2


STARTUP1:

; enable on-chip xdata RAM for AT89c51xD2 MCU's
        ANL AUXR,#10H   ;AUXR/Bit 1(clear to 0 to enable on-chip XRAM and set address 1792)

2. On the option for target window, I also checked the "Use On-Chip ROM" , "Use On-Chip XRAM" & "use multiple DPTRs registers".

3. I declead most of my data's with xdata. For example

void MUL (u8 *val_1,u8 *val_2)
{

        u8_X R_val = 0xE1;
        u8 xdata V_val[16];
        u8_X mask_b     = 0x80;
        u16_X i; u8_X j;
        bit chk=0;
        ........
        ........

I intend to declare most of my variable into Xdata, which I did, but I still have a lot of Address space overflow. How can I fix the issue. I am of the thought that there should still be space in Data since I am storing much variables into it, especially large arrays.

I checked the Data memory in the Map file to trace out where the excess might be. I found out that the size of the Xdata and Code in a given function matches the value in the mapfile. But for the data memory, I see some increase in the size, and I can possible find how that increase came about, afterall, I did not declear any variable in the data memory in the function.

*** ERROR L107: ADDRESS SPACE OVERFLOW
    SPACE:   DATA
    SEGMENT: ?DT?_INV_?CIPHER
    LENGTH:  0006H
*** ERROR L107: ADDRESS SPACE OVERFLOW
    SPACE:   DATA
    SEGMENT: ?DT?_MUL_?ENCRYPT
    LENGTH:  0006H


Has anyone experience this before?

Thanks

Parents
  • I am trying to use the xdata of the Atmel 89C51RD2 chip but it seems not to be working.

    How do you imagine you can know that, given that your program doesn't even link?

            ANL AUXR,#10H   ;AUXR/Bit 1(clear to 0 to enable on-chip XRAM and set address 1792)
    

    That comment doesn't match what the code actually does.

    I am of the thought that there should still be space in Data since I am storing much variables into it, especially large arrays.

    That conclusion is incorrect. Just because you moved a lot of stuff out of DATA does not automatically mean there will now be sufficient space for the remaining stuff. A lot is not necessarily enough.

    But for the data memory, I see some increase in the size, and I can possible find how that increase came about, afterall, I did not declear any variable in the data memory in the function.

    It's not exactly easy to understand what you're trying to say there. But it does sound like you have to get back to the documentation and read up on how Keil's compiler and linker for the '51 handle automatic variables. Have you heard about "data overlaying"?

Reply
  • I am trying to use the xdata of the Atmel 89C51RD2 chip but it seems not to be working.

    How do you imagine you can know that, given that your program doesn't even link?

            ANL AUXR,#10H   ;AUXR/Bit 1(clear to 0 to enable on-chip XRAM and set address 1792)
    

    That comment doesn't match what the code actually does.

    I am of the thought that there should still be space in Data since I am storing much variables into it, especially large arrays.

    That conclusion is incorrect. Just because you moved a lot of stuff out of DATA does not automatically mean there will now be sufficient space for the remaining stuff. A lot is not necessarily enough.

    But for the data memory, I see some increase in the size, and I can possible find how that increase came about, afterall, I did not declear any variable in the data memory in the function.

    It's not exactly easy to understand what you're trying to say there. But it does sound like you have to get back to the documentation and read up on how Keil's compiler and linker for the '51 handle automatic variables. Have you heard about "data overlaying"?

Children
No data