Can someone tell me why my global and static variables are not being initialized even though my code specifically initializes them?
I'm using CCS v4.1.1 and am compiling the UBL modified for my target using an AM1808 processor.
if I use the const keyword I can get it to initialize.
const GPIOP pGPIO = GPIO_BASE_ADDRESS;
const pinmux_config pinmux_gpio[] =
{
{ 0,0x88880888}, // PINMUX0
{ 1,0x88080880}, // PINMUX1
{ 2,0x44444448}, // PINMUX2
{ 3,0x00440000}, // PINMUX3
{ 4,0x88008844}, // PINMUX4
{ 5,0x00888888}, // PINMUX5
{13,0x88888000}, // PINMUX13
{14,0x00000088}, // PINMUX14
{16,0x88888800}, // PINMUX16
{17,0x00000080}, // PINMUX17
{18,0x88800000}, // PINMUX18
{19,0x08000088}, // PINMUX19
{MAXMUXREGS,0}, // Last entry in table
};
but global variables like this won't initialize. Putting static in front doesn't work either.
Uint8 ledState = 0;
static Uint8 ledState = 0;
I'm working in the debugger, but believe that even running out of flash has the same result that the variables aren't initialized unless I specifically do it in code or use the const keyword. I know this because it was crashing when I didn't use const.
Is there something in the map or listing files that will tell me if the variable is being initialized?
Here are my linker options:
-z -m"C:/P4/Proj_10083_UBL/dev/DEV_UBL/OMAP-L138_FlashAndBootUtils_2_30/OMAP-L138/CCS/UBL_ARM/NOR/UBL_NOR.map" --warn_sections -i"C:/Program Files/Texas Instruments/ccsv4/tools/compiler/tms470/lib" -i"C:/Program Files/Texas Instruments/ccsv4/tools/compiler/tms470/include" -i"C:/P4/Proj_10083_UBL/dev/DEV_UBL/OMAP-L138_FlashAndBootUtils_2_30/OMAP-L138/CCS/UBL_ARM/UBL_NOR" -i"C:/P4/Proj_10083_UBL/dev/DEV_UBL/OMAP-L138_FlashAndBootUtils_2_30/OMAP-L138/CCS/UBL_ARM" --reread_libs --retain="*(.selfcopy)" --rom_model --fill_value=0xBEEF --compress_dwarf=off
According to the C compiler guide using the --rom_model should cause initialized variables to be initialized on load.