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.

TMS320F280049C: A problem of an array of pointers

Part Number: TMS320F280049C

Hi, TI experts:

i define an array of pointers, which save the ADC resault rigister's address, but when i load and run program use a emulater,it's seem work well

but when i run the program in offline mode, i read the array's content are all " 0000" use comm and the corresponding function did not run successfully

Why does the pointer array fail to initialize properly in offline mode?how can i do, pls help me

Note:I did not zero out the data on this RAM anywhere in the program

  • Hi,

    What do you mean by offline mode? Do you mean, without the JTAG connected?

    Can you share the linker cmd file you use? I believe you are using the Flash based linker cmd file

    Regards,

    Veena

  • yes , the offline mode means without the JTAG connected.

    both with JTAG or without JTAG, the program is runing in flash.

    from the memory we can know the pointer array is map in "ebss"

    PAGE 1 :

    RAM_STACK : origin = 0x000000, length = 0x000300 /* on-chip RAM block M0 */
    RAM_EBSS : origin = 0x000300, length = 0x000100 /* on-chip RAM block M1 */

       .ebss               : > RAM_EBSS    PAGE = 1

  • ebss is the section for variables. There is also a section .cinit created with the initial values. This section should be laced in Flash for standalone execution. The _c_int00 function loads the variables in RAM with the initial values stored in Flash. This happens before main function

    .cinit           : > FLASH_BANK0_SEC1, ALIGN(8)

    Regards,

    Veena

  • OK, I change the array define using  "const" keyword

    const Uint16 *pAdAddrList[] =
    {
    (Uint16 *)(&adDataAD1),
    (Uint16 *)(&adDataAD2),
    (Uint16 *)(&adDataAD3),
    (Uint16 *)(&adDataAD4),
    (Uint16 *)(&adDataAD5),
    (Uint16 *)(&adDataAD6),
    (Uint16 *)(&adDataAD7),
    (Uint16 *)(&adDataAD8),
    (Uint16 *)(&adDataAD9),
    (Uint16 *)(&adDataAD10),
    (Uint16 *)(&adDataAD11),
    (Uint16 *)(&adDataAD12),
    (Uint16 *)(&adDataAD13),
    (Uint16 *)(&adDataAD14),
    (Uint16 *)(&adDataAD15),
    (Uint16 *)(&adDataAD16),
    (Uint16 *)(&adDataAD17),
    };

    you can see the "cinit" has the array's content

    but why the ram data is all zero?

  • I forgot to tell you that we use our own boot code befoe main code.

    Does this mean the c_int00 code will not run when without the JTAG connected 

    but c_int00 code will run when using emulater even use our own boot before code_start 

  • c_init00 is called as part of codestart function which we allocate it to the allocation entry point address. Once BootROM code is completed, it will branch to this location.

    What do you mean by your own boot code? do you define this at the entry point location? Does this invoke the c_init00 function?

    Regards,

    Veena

  • What do you mean by your own boot code?   yes,  when BootROM code is completed, it go to codestart (0x80000) , then is go to our own boot code.  we didn't call the c_init00, So what's problem will be produced when we don't call the c_init00 function?

  • c_init00 function initializes all the globals.

    int a = 10; -> Compiler allocates a memory for the variable a, and the value 10 is stored in flash, as part of .cinit section. c_int000 function is the one which initializes the 'a' variables to 10 by reading the .cinit section

    It also does some other basic initializations such as stack pointer init, setting the modes, etc and finally branch to main function. It is recommended to call _c_init00 function  unless your boot code takes care of all these initializations.

    Regards,

    Veena

  • ok,got it

    thank you