here we go again.
So I manged to write a code that writes values into the flash but now I am facing a problem that looks very weird to me (bug?).
I created a variable in flash "store" (address: 0x000013d8) and intilized it with a value of 2.
Then I wrote using the EEPROM_Write(...) function a new value of 3 in the flash:
Then I tried to read this value into a uint8 variable state (address 0x1fff8168) (it does not work with state=store either):
The problem is; after the first line the state variable contains allways the intializing value (in this case 2) and not what is actually stored under the address of store (the value under the address 0x000013d8 is still the same (3)).
This behaving is caused by some compiler optimization.. The compiler "remembers" the initialization value and does not access the newly written value. I overcame problems like that by using memcpy() to retrieve the eeprom data that were set using initialization values.