Topic: Variable Initialisation Issues
Hi,
I have been observing some very strange behaviour with my installation of Raisonance (RIDE: 06.10.22; 80C51: 6.4.53) whilst used with a SiLabs C8051F310. I have the following initialisation code in my C file, it's a global variable, where the enumerate mentioned has a hard coded value and the __NUM_MEM_DEV is #defined to be 4.
const tDeviceList SpiMemoryDevices[ __NUM_MEM_DEV ]= {{/*"Flash_0",*/1,1,eNumonyxM25P32,0,0,0},
{/*"Flash_1",*/1,2,eNumonyxM25P32,0,0,0},
{/*"Flash_2",*/1,3,eNumonyxM25P32,0,0,0},
{/*"Flash_3",*/1,4,eNumonyxM25P32,0,0,0}};
First Problem:
I have seen this mentioned in the forum before, but no explanation as to the cause. When the string was present in the structure, the build seemed to fail to complete correctly. When I could get the code to run I suffered from behaviour that seemed to look like stack corruption, returning to the wrong place etc. Removing code libraries built at the same time, removing other objects made no difference. I removed the string from the structure, and the compiler informed me of two basic syntax errors it had previously failed to find and then ran fine, including when previously removed libraries were returned to the code. This makes me think the initialisation of static data in the compiler had somehow been knocked over by the inclusion of string data in the startup.... Does this sound probable?
Second Problem:
Having got the code to run minus my strings, I found that my data didn't seem to be correct. So I looked in the forum at some other topics and found some relating to data initialisation... Following the suggestion in that topic I started the code up using the simulator, rather than the target hardware. I found that the data gets initialised in the simulator, but NOT in the target hardware... I base this on starting the code up, taking a couple of steps and looking at the values in the global variable.
Erm help....
Cheers,
Rob