2018-06-13 12:13 AM
Hello all,
I have a proplem with initialising variables in a function. The function is -with some other functions- in a seperate .c file. Here is a picture with the start of the function.
The variable last_block and the structure state s gets initialised but deflate_type and deflate_error not. I difnied them as static so I can watch them in the live watch view:
The variable ''val'' is in another function in the same file. As you can see the variables val, deflate_type and deflate_err gets all the location 0x00000000 which value is the address of CSTACK$$Limit. The variables last_bloc and deflate_type gets initialised in the same code line (see picture above) but last_block works and deflate_type not. I looked in the map file and I only can´t find the variable last_block and the structure state s. Maybe someone know why the other variables didn´t get initialised correctly?
Regards
Tobias
2018-06-13 12:46 AM
Isn't zero an initialization value ?
I use to initialize all static variables explicitly, even with zero.
And I'm pretty sure with '-Wa' you get a respective warning.
2018-06-13 02:58 AM
I am not shure what you mean. The location of the variables val, deflate_type and deflate_err is 0x00000000 but the value 0x20000B08. Even when I initialise them with 0 the value is 0x20000B08
2018-06-13 03:15 AM
The location of the variables val, deflate_type and deflate_err is 0x00000000...
Ahhh yes, correct. Which is strange IMHO, or is 0 a valid address ???
Are you sure the compiler did not optimize it out ?
Try with 'static volatile'.