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.

TMS320F28335: Global variables initialization to zero

Part Number: TMS320F28335

Dear Champs,

I am asking this to customers.

For F28335 (with COFF format), will all the global variables be initialized to zero initially like in boot-ROM codes so that the user need not do it?

Or should the user always need to initialize global variables themselves?

If yes, is it better to initialize global variables to zero before main or in the beginning of main codes for code efficiency/speed?

If they migrate onto newer devices like F280049 with EABI format, is this still same?

Wayne Huang 

  • Wayne Huang said:
    For F28335 (with COFF format), will all the global variables be initialized to zero initially like in boot-ROM codes so that the user need not do it?

    No

    Wayne Huang said:
    Or should the user always need to initialize global variables themselves?

    Yes

    Wayne Huang said:
    is it better to initialize global variables to zero before main or in the beginning of main codes for code efficiency/speed?

    There is no clear answer.  Try it both ways and see.  

    Wayne Huang said:
    If they migrate onto newer devices like F280049 with EABI format, is this still same?

    No.  Under EABI, all global variables are initialized to 0 by default.

    For more details on all these questions, please search the C28x compiler manual for these sub-chapter titles:

    • Initializing Static and Global Variables in COFF ABI Mode
    • Zero Initializing Variables

    Regarding COFF ABI initialization, also see the article Uninitialized Static Objects Not Set to Zero in COFF.

    Thanks and regards,

    -George