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.

System heap in DDR

Other Parts Discussed in Thread: TMS320C6670, SYSBIOS

Hello.

I'm using my own board with TMS320C6670 (and EVMc6670 for evaluation), CCs.v.5.5, SYS/BIOS 6.35.4.50, MCSDK 2.1.2.6, and NDK 2.24.1.18 (for ETHERNET)

And there is a problem with System Heap.

I have to make a great System Heap (NDK library requires a lot of it). And good idea is to place it to DDR.

I try create SysHeap in DDR3 staticaly. Via XDC configuration:

var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
var heapMemParams = new HeapMem.Params();
heapMemParams.size = 0x300000;
heapMemParams.sectionName = "systemHeap";
Program.sectMap["systemHeap"] = "DDR3";
Program.global.heap0 = HeapMem.create(heapMemParams);
Memory.defaultHeapInstance = Program.global.heap0;

But then I get error while loading and running my project. Because DDR3 are not initialized yet.

DDR3 init procedure is performes in my project later than SysHeap init procedure.

And I can't organize System Heap dinamicaly after DDR3 Init procedure via SYS/BIOS functions because there is no SYS/BIOS function 

which is equivalent to XDC command:

Memory.defaultHeapInstance = Program.global.heap0;

And how can I solve this problem?

Whether there is an opportunity to create System Heap dinamicaly after DDR3 init?

Or can I assign my own Heap (not System) for NDK library?

 

Thanks. With regards. Alexander.

 

 

  • Do you have "EVM_init" function in your code which will run while loading the code.

    /*
    ** Register an EVM Init handler with BIOS. This will initialize the hardware. BIOS calls before it starts.
    **
    ** If yuo are debugging with CCS, then this function will execute as CCS loads it if the option in your
    ** Target Configuraiton file (.ccxml) has the option set to execute all code before Main. That is the
    ** default.
    */
    Startup.lastFxns.$add('&EVM_init');

    I think, you can use this code to initialize the DDR before using it.

    void EVM_init()
    {
    platform_init_flags sFlags;
    platform_init_config sConfig;
    /* Status of the call to initialize the platform */
    int32_t pform_status;

    /*
    * You can choose what to initialize on the platform by setting the following
    * flags. Things like the DDR, PLL, etc should have been set by the boot loader.
    */
    memset( (void *) &sFlags, 0, sizeof(platform_init_flags));
    memset( (void *) &sConfig, 0, sizeof(platform_init_config));

    sFlags.pll = 0; /* PLLs for clocking */
    sFlags.ddr = 0; /* External memory */
    sFlags.tcsl = 1; /* Time stamp counter */
    #ifdef _SCBP6618X_
    sFlags.phy = 0; /* Ethernet */
    #else
    sFlags.phy = 1; /* Ethernet */
    #endif
    sFlags.ecc = 0; /* Memory ECC */

    sConfig.pllm = 0; /* Use libraries default clock divisor */

    pform_status = platform_init(&sFlags, &sConfig);

    /* If we initialized the platform okay */
    if (pform_status != Platform_EOK) {
    /* Initialization of the platform failed... die */
    while (1) {
    (void) platform_led(1, PLATFORM_LED_ON, PLATFORM_USER_LED_CLASS);
    (void) platform_delay(50000);
    (void) platform_led(1, PLATFORM_LED_OFF, PLATFORM_USER_LED_CLASS);
    (void) platform_delay(50000);
    }
    }

    }
  • Oh! It's good idea!

    Thank You.

    Function EVM_init() does not initialize DDR. There is such intimation:

    Things like the DDR, PLL, etc should have been set by the boot loader.

     

    I have my own function DDR3_init(). It is good working. But so far I run it in MAIN() func.

    I have not thought of inserting it in XDC configuration:

    Startup.lastFxns.$add('&DDR3_init');

    Now I did it. 

    And it worked!

    Thanks. Regards. Alexander

  • Sounds good.
    Thanks Alex for the update.

    By default, it won't initialize the PLL and DDR but we have to modify like below.

    sFlags.pll = 1; /* PLLs for clocking */
    sFlags.ddr = 1; /* External memory */