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.

TMS320F28379D: Initialized variables in GSRAM in Standalone mode are not initialized on CPU2

Part Number: TMS320F28379D

Hello,

I'm trying a simple program where the code for CPU2 uses initialized global variables. These global variables are stored in GSRAM13.

When I run a program from RAM or FLASH, everything works properly and these global variables are initialized correctly. But when I run the program in STANDALONE mode, the program runs correctly, but the above-mentioned global variables are not initialized.

I tried both linker options (-- rom_model, --ram_model). In the memory browser I saw a properly initialized variables in GSRAM (--ram_model) or a correct initialization record at the address of the .cinit section (--rom_model) before running the code. After runnig the code, variables in GSRAM are not initialized.

Any advice? Thank you.

Regards,

Jozef

  • Hi Jozef,

    How are you initializing these global variables when you run the program in STANDALONE mode?

    Do you have a code in Flash that initializes these variables and stores in RAM?

    RAM is a volatile memory, so on a power cycle the contents of the RAM are lost. 

    Regards,

    Nirav

  • Hi Nirav,

    thank you for your reply.

    You are absolutely true about RAM memory. So using --ram_model linker option was pointless attempt in the Standalone mode.


    Yes, I have the code in Flash. Linker command file is below.

    SECTIONS
    {
       /* Allocate program areas: */
       .cinit              : > FLASHB      PAGE = 0, ALIGN(4)
       .pinit              : > FLASHB,     PAGE = 0, ALIGN(4)
       .text               : > FLASHB      PAGE = 0, ALIGN(4)
       codestart           : > BEGIN       PAGE = 0, ALIGN(4)
    
    #ifdef __TI_COMPILER_VERSION__
       #if __TI_COMPILER_VERSION__ >= 15009000
        .TI.ramfunc : {} LOAD = FLASHD,
                             RUN = RAMLS0 | RAMLS1 | RAMLS2 |RAMLS3,
                             LOAD_START(_RamfuncsLoadStart),
                             LOAD_SIZE(_RamfuncsLoadSize),
                             LOAD_END(_RamfuncsLoadEnd),
                             RUN_START(_RamfuncsRunStart),
                             RUN_SIZE(_RamfuncsRunSize),
                             RUN_END(_RamfuncsRunEnd),
                             PAGE = 0, ALIGN(4)
       #else
       ramfuncs            : LOAD = FLASHD,
                             RUN = RAMLS0 | RAMLS1 | RAMLS2 |RAMLS3,
                             LOAD_START(_RamfuncsLoadStart),
                             LOAD_SIZE(_RamfuncsLoadSize),
                             LOAD_END(_RamfuncsLoadEnd),
                             RUN_START(_RamfuncsRunStart),
                             RUN_SIZE(_RamfuncsRunSize),
                             RUN_END(_RamfuncsRunEnd),
                             PAGE = 0, ALIGN(4)   
       #endif
    #endif
    						 
       /* Allocate uninitalized data sections: */
       .stack              : > RAMM1        PAGE = 1
       .ebss               : > RAMLS5       PAGE = 1
       .esysmem       : > RAMLS5       PAGE = 1
    
       /* Initalized sections go in Flash */
       .econst             : > FLASHB      PAGE = 0, ALIGN(4)
       .switch             : > FLASHB      PAGE = 0, ALIGN(4)
       .reset           : > RESET,     PAGE = 0, TYPE = DSECT /* not used, */


    When I used --rom_model linker option, I can see right initialization record in .cinit memory section after program load. But on a power cycle, global variables in GSRAM are not initialized.

    It seems that the boot routine doesn't copy data from the initialization tables (pointed to by .cinit) into the specified variables in the ramgs section.

    Regards,

    Jozef

  • Problem solved!


    I have to setup CPU2 as master for GSRAM13 memory before calling the function IPCBootCPU2(C1C2_BROM_BOOTMODE_BOOT_FROM_FLASH).

    EALLOW;
    MemCfgRegs.GSxMSEL.bit.MSEL_GS13 = 1;   // CPU2 is master for RAMGS13 memory.
    EDIS;
    
    IPCBootCPU2(C1C2_BROM_BOOTMODE_BOOT_FROM_FLASH);
    

    Regards,

    Jozef