This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Using linker to place buffers in specific areas of DDR

I would like to use the linker to partition the DDR, and assign memory blocks to these partitions. For example, I would like to assign buffers A, B, and C to a 1MB area that starts at address 0x80000000, and buffers D and E to a 1MB area that starts at address 0xa0000000.

My current application is based on the example found in C:\ti\pdk_C6678_1_1_2_6\packages\ti\drv\pcie\example\sample. I added the following lines to the linker config file (C:\ti\pdk_C6678_1_1_2_6\packages\ti\drv\pcie\example\sample\pcie_sample.cfg):

---------------------------------------------------------------------------------------------------------

Program.sectMap[".ac3PoolSec"] = "DDR3";
---------------------------------------------------------------------------------------------------------

In my "C" code, to place a buffer in the ".ac3PoolSec" section, I use the following:

---------------------------------------------------------------------------------------------------------
#pragma DATA_SECTION(fileBuf, ".ac3PoolSec")
#pragma DATA_ALIGN(buf, 256)
unsigned char buf[0x1000];
---------------------------------------------------------------------------------------------------------

But, this places all buffers at the low address area of the DDR (address 0x80000000). I would like to partition the DDR, and place buffers in any partition. How do I break up the DDR into partitions, and place buffers into those partitions?

  • Hi,

    Use the below code for create data sections for specific memory location.

    ".cfg" file code:

    /* Create data sections for specific memory locations */
    Program.sectMap[".bss:Data1"] = new Program.SectionSpec();
    Program.sectMap[".bss:Data1"].loadAddress=0x80000000;
    
    Program.sectMap[".bss:Data2"] = new Program.SectionSpec();
    Program.sectMap[".bss:Data2"].loadAddress=0xA0000000;

    "C" code:

    #pragma DATA_SECTION (dataBuffer1, ".bss:Data1");
    #pragma DATA_ALIGN (dataBuffer1, SIZE);
    ....
    
    #pragma DATA_SECTION (dataBuffer2, ".bss:Data2");
    #pragma DATA_ALIGN (dataBuffer2, SIZE);
    ....

    Thanks,