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.

CCS/66AK2G12: Reserving memory in DDR and use it in software

Part Number: 66AK2G12
Other Parts Discussed in Thread: SYSBIOS

Tool/software: Code Composer Studio

Hi,

I want to reserve memory in DDR and after that need to declare a variable in that reserved memory. So that i can access the same in software.

I tried the below method,

Added following lines in .cfg file


Program.sectMap[".reserve0"] = new Program.SectionSpec();
Program.sectMap[".reserve0"].loadAddress = 0xa0000000;

Added below line in source code

int passlist_data[32768] __attribute__ ((aligned (64))) __attribute__ ((section ("reserve0")));//32K words

After compiling the code , i observed a line  .reserve0 : AT (0xa0000000) {*(.reserve0)} in linker.cmd file 

But during execution of the software i found the address of passlist_data is something else other than 0xa0000000.

 

So i need few clarification

Whether am i following the correct procedure for reserving the memory in DDR?

If it is correct, Why the variable passlist_data is not created in reserved memory region?

How should i mention amount of memory that to be reserved in .cfg file?

  • Is there any reason what you are not using #pragma CODE_SECTION and #pragma DATA_SECTION for implementing this in your application. If you are not familar with the usage refer : http://www.ti.com/lit/ug/sprui04b/sprui04b.pdf

    Example in code use the following:

    #pragma DATA_SECTION(bufferB, "my_sect")
    
    char bufferA[512];
    
    char bufferB[512];

    Add a linker command file and place that where you wish to put the section where you want to load it. 

    Another example is provided in discussion here:

    https://e2e.ti.com/support/tools/ccs/f/81/t/366831

  • Thanks Rahul, I will check and update you

  • HI Rahul,

    Can you please help us in creating linker command file and adding our custom section into it?

  • Can you share the current .map file or linker command file that the RTSC build auto generates so I can see what sections are currently defined. You should be able to find them in the Debug or Release folder associated with SYSBIOS project.

    Regards,

    Rahul

  • Hi Rahul,

    PFA of zip which contains map file and linker cmd filemap_cmd_file.zip

  • Your attribute specification has an incorrect name, it should be

    int passlist_data[32768] __attribute__ ((aligned (64))) __attribute__ ((section (".reserve0")));

  • when i use .reserve, i'm facing following error

    c:/ti/ccs920/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld.exe: error: no memory region specified for loadable section `.reserve0'

     

  • It should be .reserve0 not .reserve.
    When you use .reserve0 in your .cfg file and in the attribute directive, do you still have

    .reserve0 : AT (0xa0000000) {*(.reserve0)}

    in your linker command file?

  • Hi,

    I am not able to use .reserve0 in attribute directive. when i use .reserve0 in attribute directive, im seeing below errors during compilation

    c:/ti/ccs920/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld.exe: error: no memory region specified for loadable section `.reserve0'

    Below are my changes as per your suggestion, 

    in cfg file:


    Program.sectMap[".reserve0"] = new Program.SectionSpec();
    Program.sectMap[".reserve0"].loadAddress = 0xa0000000;

    in source file:

    int passlist_data[32768] __attribute__ ((aligned (64))) __attribute__ ((section (".reserve0")));//32K words

  • Can you post your linker command line and the linker command file? The error message is coming from the linker because it doesn't know where to allocate the section ".reserve0".

  • I have already attached my linker command file in this thread.

    What is linker command line?

    I have not made any changes in linker command file. I made changes in cfg file but after compiled my code,  there is a section reserve0 in linker command file.  You can check the linker command file which I shared to rahul in this thread earlier.  

    By the way, can I directly assign the address 0xa0000000 to a pointer and use it?

    Also I'm not sure how much memory was reserved after making the changes in cfg file.  Because we are not mentioning any size of the reserved memory.

  • I am asking for the linker command file because I don't know if your code is the same as it was when the original linker command file was generated. If the linker command file hasn't changed since you posted it the first time, no need to post it again.

    The linker command line is the last command displayed in the console before the error. You can post the whole console output if that's easier. The purpose of looking at the command line is to see if the file linker.cmd is being used. That file allocates the section ".reserve0" to 0xa0000000, but the linker is displaying an error as if it's not seeing that linker command file at all.

  • Hi,

    Thanks for your quick response. I have attached the linker command file and all the logs. Pleas check itto_ti.zip

  • I am not seeing anything obviously wrong in that linker command line. I have a similar build with the same type of allocation and I am not getting any errors.

    We can try experimenting with different solutions and see if we can get something else to work. Try creating a file res.lds in your project directory, and have the following as the only content of that file:

    SECTIONS {
        .reserve0 : AT (0xa0000000) {*(.reserve0)}
    }

    Then, comment out the statements from your config script that add .reserve0 to the section map.

    If that doesn't work, try to vary the syntax for example:

    SECTIONS {
        .reserve0 0xa0000000 : {*(.reserve0)}
    }

    This syntax specifies the run address instead of the load address. It shouldn't make any difference, but who knows.

  • Hi ,

    I got the same error for

    SECTIONS {
        .reserve0 : AT (0xa0000000) {*(.reserve0)}
    }

    And there is no compile time error when i try the below one

    SECTIONS {
        .reserve0 0xa0000000 : {*(.reserve0)}
    }

    But below errors are there during JTAG loading,

    CortexA15: GEL Output: Starting K2G GP EVM Initialization .. 
    CortexA15: GEL Output: Reading Device Speed from BOOTCFG_EFUSE_BOOTROM
    CortexA15: GEL Output: DEVICE SPEED[23:16] ---> 1000 MHz
    CortexA15: GEL Output: ARM SPEED[9:0] ---> 1000 MHz
    CortexA15: GEL Output: PLL has been configured (24.0 MHz * 250 / 3 / 2 = 1000.0 MHz)
    CortexA15: GEL Output: ARM PLL has been configured with ref clock 24MHz, -sysclkp_period 41.6666 (24.0 MHz * 250 / 3 / 2 = 1000.0 MHz)
    CortexA15: GEL Output: Power on all PSC modules and DSP domains... 
    CortexA15: GEL Output: Power on PCIE PSC modules and DSP domains... Done.
    CortexA15: GEL Output: UART PLL has been configured (24.0 MHz * 128 / 1 / 8 = 384.0 MHz)
    CortexA15: GEL Output: NSS PLL has been configured (24.0 MHz * 250 / 3 / 2 = 1000.0 MHz)
    CortexA15: GEL Output: ICSS PLL has been configured (24.0 MHz * 250 / 3 / 10 = 200.0 MHz)
    CortexA15: GEL Output: DSS PLL has been configured (24.0 MHz * 198 / 12 / 16 = 24.75 MHz)
    CortexA15: GEL Output: XMC setup complete.
    CortexA15: GEL Output: DDR3 PLL Setup ... 
    CortexA15: GEL Output: DDR3 PLL Setup complete, DDR3A clock now running at 533MHz.
    CortexA15: GEL Output: DDR3A initialization complete 
    CortexA15: GEL Output: Entering A15 non secure mode .. 
    CortexA15: GEL Output: Enabling non-secure access to cp10 and cp11
    CortexA15: GEL Output: Enabled non-secure access to cp10 and cp11
    CortexA15: GEL Output: Making all GIC interrupts Group1 
    CortexA15: GEL Output: Changed interrupt group 
    CortexA15: GEL Output: Set secure mode PMR to non-zero value 
    CortexA15: GEL Output: Entering NonSecure Mode
    CortexA15: GEL Output: Entered NonSecure Mode
    CortexA15: GEL Output: A15 non secure mode entered 
    CortexA15: GEL Output: K2G GP EVM Initialization Complete. 
    CortexA15: File Loader: Verification failed: Values at address 0xA0000000 do not match Please verify target memory and memory map.
    CortexA15: GEL: File: C:\Users\sudhanthiradasan.r\workspace_v9_2\27_5_20\BB2\Debug\BB2.out: a data verification error occurred, file load failed.
    CortexA15: Unable to terminate memory download: NULL buffer pointer at 0x3aa4 (Emulation package 8.3.0.00003)

  • I am guessing that your memory map will show that the section .reserve0 is at the location where you want it to be. However, I don't know enough about Cortex-A15 to tell you if there is anything at that address that would prevent you from loading 128 Kbytes starting from 0xa0000000. I think that's how large your array is.

    I forgot to answer above your question about section sizes. You don't specify a section size in the cfg script or a linker command file. The size will adjust to the size of the objects you allocate to that section. So, as I said above your .reserve0 section requires 128kbytes. You may want to experiment with the size of your array to figure out if the loading succeeds with smaller arrays. I'll try to find someone who knows more about Cortex-A15 memory map.