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.

'Load memory' before starting program?

Hi,

I am using the C6670 and trying to load a large matrix in for the program to use at run-time.

I am using the 'load memory' function in CCS, and this works OK if I run the program, pause the program, then load, then play the program. If I try to load the memory before starting the program, which is what I need to do, the memory is wiped. Presumably this is due to some initialization?

Is there a way to load the memory before starting the program so that it persists?

And/or is there another way to load large vectors/matrices on the DSP? Simply writing them in .c files causes the compiler to grind to a halt.

Many thanks for your help!

David

  • I have added ."NOINIT", so in .cfg I have

    // Create data sections for specific memory locations
    Program.sectMap[".A_inv_vals"] = new Program.SectionSpec();
    Program.sectMap[".A_inv_vals"].loadAddress=0x80258010;
    Program.sectMap[".A_inv_vals"].type = "NOINIT";

    and in the main file I have

    #pragma DATA_SECTION(A_inv_vals,".A_inv_vals")
    #pragma DATA_ALIGN (A_inv_vals, 16)
    Uint32 A_inv_vals[0xFFFF];
  • Hi David,

    I've notified the support team. Their feedback will be posted here.

    Best Regards,
    Yordan
  • Here is what I would do.

    In the memory segment definition (either in the cmd file or in the platform definition if you use RTSC platform) I would define a memory segment, give it a name and star address and length, but do not put any section in this memory - see for example a code like the following:

    MEMORY
    {
        SPECIAL_MEMORY:           o = 0xFF000000   l = 0x01000000  /* The end of the logical memory will be used for load memory */   

       OTHER Memories......

    Next load the data into this section of the memory the way you usually do before load ing the program

    In the program define a pointer, say a floating point pointer and assign the value 0xff000000 to the pointer

    And proceed from here

    If I am not clear post more questions.  If I was clear and you can implement. close the thread

    Thanks

    Ran

  • Thanks Ran,

    This looks good, and think I have it working if I use your suggested memory range.

    If I try to put it in the DDR3, at 0x80258010, as I had before at
    then I get:

    "A_INV_VALS memory range
    overlaps existing memory range DDR3"

    there is no special reason to have it in DDR3, just that the range required might get very big, so I don't want to run out of space or overlap with something important!

    Thanks,

    David
  • OK, what address is your DDR3 (other words, how big is your DDR3?)

    The problem that you encounter is that the memory segment that you define is already defined somewhere else.
    Look at your project. Is it a RTSC project? Do you have a platform? Thus you have to change your platform.

    If the memory is defined in a command file (XXX.cmd) then look at the memory definition and make sure you do not overwrite the new memory segment on top of already defined memory

    Ran
  • Hi David,


    Is there a way to load the memory before starting the program so that it persists?


    Can you please check this api "Startup.lastFxns.$add" in *.cfg file if this solves your question ?

    C:\ti\mcsdk_2_01_02_06\examples\ndk\helloWorld\evmc6670l\helloWorld.cfg

    /*
    ** 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');



    C:\ti\mcsdk_2_01_02_06\examples\ndk\helloWorld\helloWorld.c

    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);
    }
    }

    }