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

adding more xdata

Have a Cygnal F120 part with keil compiler and Bl51 linker. It has 8k xdata. The guy doing the hardware said he added 4k more for a total of 12k xdata. But I'm not sure how to access the other 4k. When I declare variables like normal and during linking the BL51 says xdata is greater than 8k, my program goes haywire. So I think there might be a special way to do this?

Parents
  • External SRAM is located at 0x2000 and is 4k in depth which means it is contiguous with the internal 8k to give me a total of 12k.

    I have tested it using:

    pAddress = (U8 xdata *) 0x2000;
    for(uiN=0;uiN<(4*1024);uiN++)
    {
    *pAddress = (U8) uiN;
    pAddress++;
    }

    I can look at the data and see using the xdata window in the Cygnal IDE and it looks right. I also ran another loop that read back the data as so and it seemed to work fine:

    pAddress = (U8 xdata *) 0x2000;
    for(uiN=0;uiN<(4*1024);uiN++)
    {
    if(*pAddress != (U8) uiN)
    {
    //printf("\nSRAM fail at %bu", SRAM+uiN);
    }

    pAddress++;
    }

    The compiler output after compiling and linking shows the following:

    Program Size: data=114.3 xdata=12156 code=95112

    But the M51 (map) file shows that some of my variables are located at 4000H+ as follows:

    X:400AH PUBLIC g_ulSyncTime
    X:4009H PUBLIC g_byBrickId

    When I look at the xdata window in the Cygnal IDE I see a bunch of FF's at the locations of the variables above, which tells me there is no memory there. There are many more variables than the ones above that are located at 4000H+.

    These variable locations seem wrong. What is going on?

Reply
  • External SRAM is located at 0x2000 and is 4k in depth which means it is contiguous with the internal 8k to give me a total of 12k.

    I have tested it using:

    pAddress = (U8 xdata *) 0x2000;
    for(uiN=0;uiN<(4*1024);uiN++)
    {
    *pAddress = (U8) uiN;
    pAddress++;
    }

    I can look at the data and see using the xdata window in the Cygnal IDE and it looks right. I also ran another loop that read back the data as so and it seemed to work fine:

    pAddress = (U8 xdata *) 0x2000;
    for(uiN=0;uiN<(4*1024);uiN++)
    {
    if(*pAddress != (U8) uiN)
    {
    //printf("\nSRAM fail at %bu", SRAM+uiN);
    }

    pAddress++;
    }

    The compiler output after compiling and linking shows the following:

    Program Size: data=114.3 xdata=12156 code=95112

    But the M51 (map) file shows that some of my variables are located at 4000H+ as follows:

    X:400AH PUBLIC g_ulSyncTime
    X:4009H PUBLIC g_byBrickId

    When I look at the xdata window in the Cygnal IDE I see a bunch of FF's at the locations of the variables above, which tells me there is no memory there. There are many more variables than the ones above that are located at 4000H+.

    These variable locations seem wrong. What is going on?

Children
No data