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?

  • That part has 8k of on-chip xdata. It also sports a fairly complex set of configuration options for the on/off-chip memory. High ports, low ports, multiplexed, non-multiplexed, split-mode... The chip resets to using only the 8k of on-chip xdata.

    Have you studied the data sheet (see section 18, "External Data Memory") and configured it properly for your hardware? You'll need to include a copy of the STARTUP.A51 file in your project, and modify it to configure the memory control registers.

    Also check with your hardware guy to be sure of the address at which he placed the extra 4k of memory. (Hopefully it is contiguous with the internal 8k.)

  • "The guy doing the hardware said he added 4k..."

    So, as Drew said, you need to ask him how he did it so that you can work out how to access it!

    How did he test it?
    Does he have some code that you could at least use as the basis for yours?

  • 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?

  • You might also ask why he added 4K and not 32K or 64K !