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.

How to replace some code in DDR3 memory

Hello!

I use evmc6657, MCSDK_2_01_01_04, compiler v7.4.8.
My application is too huge to fit in internal memory (L2 or MSMCSRAM). So, I place some piece of code in DDR3 memory, but the application hangs when achives DDR3 piece of code during running. Also, I use DDR3 for some data (arrays). I use cmd file to manage memory sections (do not use SYS/BIOS):

MEMORY
{
...
DDR3 (RWX) : org = 0x80000000, len = 0x10000000
...
}

SECTIONS

{

...

.ddr3_data > DDR3

.ddr3_code > DDR3

...

}


I use macros #pragma SET_CODE_SECTION(".ddr3_code") for beginning DDR3 piece of code and #pragma SET_CODE_SECTION() in the end of the DDR3 piece.
What is the problem? Why does the program hang?

  • What example are you trying ?
    Is that your own code or TI provided ?

    Are you getting any warning while building code on CCS (overlap) ?

    Able to boot successfully from MSMCSRAM ?
    If yes, you can just remove the MSMCRAM declaration and put a entry for DDR3 (0x80000000).

    Could you attach the complete .cmd file.


    but the application hangs when achives DDR3 piece of code during running.

    Able to stop at "main()" (hw default break point) for DDR3 boot or hang after some time (execution) ?
  • Hi,

    I think your CMD file Memory and Sections fields are correct.
    Have you tried to use the #pragma SET_CODE_SECTION(function_name ".ddr3_code") on your test code?
    Example:
    #pragma CODE_SECTION(funcA,"codeA")
    int funcA(int a)

    {
    int i;
    return (i = a);
    }

    Thanks,
  • Thank you for your reply, Titusrathinaraj.

    I try my own project.

    Project builds without any warnings or errors.

    Yes, I able to boot from MSMCSRAM.

    Application hangs after some time when it reaches executing of DDR3 function.
    My application consists with two projects. The first project is a library. And the second is a main program. Only main program has CMD file.

    In my application, L1D cache is disabled.

    My CMD file is:
    ----------------------------------------------------------------------------------------------------------------
    -c -heap 0x41000 -stack 0xa000

    /* Memory map */
    MEMORY
    {
        L1PSRAM (RWX) : org = 0x0E00000, len = 0x7FFF
        L1DSRAM (RWX) : org = 0x0F00000, len = 0x7FFF
        L2SRAM (RWX) : org = 0x0800000, len = 0x080000
        MSMCSRAM (RWX) : org = 0xC000000, len = 0x100000
        DDR3 (RWX) : org = 0x80000000, len = 0x10000000
        L2SRAMB (RWX) : org = 0x11800000, len = 0x080000
    }
    SECTIONS
    {
        .csl_vect > MSMCSRAM
        .text > MSMCSRAM
        GROUP (NEAR_DP) > MSMCSRAM
        {
            .neardata
            .rodata
            .bss    
       }
        .stack > MSMCSRAM
        .cinit > MSMCSRAM  
        .cio > MSMCSRAM
        .const > MSMCSRAM
        .switch > MSMCSRAM
        .sysmem > MSMCSRAM
        .far > MSMCSRAM    
        .ddr3_data > DDR3
        .ddr3_code > DDR3
        .fardata > MSMCSRAM
        platform_lib > MSMCSRAM
        .myblock > L1DSRAM
        .l2sram_ > L2SRAM
        .l2sramB > L2SRAMB
    }


  • Hi, Ganapathi.

    I will try to use the #pragma SET_CODE_SECTION(function_name ".ddr3_code") .
  • Hi Elnur,

    have you configured DDR3 correctly? Can you read DDR3 using CCS memory window?

    Kind regards,
    one and zero
  • Hi one and zero.


    I have understood the reason why code in ddr3 does not work. In my program, I call platform_init function from platform_lib_evmc6657l project. This function reinit ddr3 memory. So code is corrupted in ddr3 by platform_init. But I do not understand how to do this correctly? In which moment I must configure ddr3 memory?

    Thanks.

  • Hi Elnur,

    you need to configure the DDR3 peripheral before you try to use it, e.g. put code or data in it.

    Kind regards,
    one and zeo
  • Hi one and zero.

    Yes, I have solved this issue.

    Thanks.