I am writing embedded code in GHS environment and I am facing such a strange issue that I have never encountered before. All global variables except for constant ones which are initialized before run-time are set the highest value of a data type. For example:
I define a global variable:
static uint8 Dcm_Cbk_Gu8_FirstReqAfterReset = 1;
However, the value of the variable is always set to 255 no matter what the initial value is. I am sure that the variable is not used yet anywhere in the code. If the data type is uint16, the value shall always be 65535 until It is changed in run-time. Well, It happens to all global variables no what the data type is.
Note that the situation doesn't occur if the variable is declared globally and initialized in run-time, but this way violates the coding convention.
Actually, Everything works well in another environment (built by make) but when I Merged the code (*.c,*h) and move the whole linker file to a different environment (built by Scon struct), I got the issue. The MCU that is used is chorus 10M (SPC58NH92).
Anybody knows about the reason, could you please broaden my knowledge? Thank you!