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.

Compiler/TM4C1294NCPDT: what is the initial values of global variables?

Part Number: TM4C1294NCPDT

Tool/software: TI C/C++ Compiler

Found an uninitialized global variable in my project, but strange enough, it didn't create any problem in the field (yet)

Further checking found that If an uninitialized global variable is "initialized" as zero by TI compiler, or the micro always starts with some constant (0 or 0xffff) in memory, the program will work

Of course, I will fix the codes to take care this problem, but just out of curiosity, does anyone know if "unintialized" variables would be initialized to zero by TI compiler, or the micro will indeed start with some constant in RMA? 

  • Hi David,

      You can find more details about different sections in the TI ARM assembly user's guide. http://www.ti.com/lit/ug/spnu118u/spnu118u.pdf. Normally, the .bss section will only reserve space in the RAM and not initialized until runtime. I don't really know why it seems to initialize to zero. Perhaps this is done during runtime as part of the device boot process (From the reset vector the _cinit00 will jump to run several boot up routines in the boot.asm) but I'm not sure. If you insist to know I will need to pass your question to our compiler team. With that said, I agree that fixing your code to not rely on the initial value of an uninitialized variable is the right thing to do.