I have declared a tydef struct as shown below.
#define START_ADDR 0xXXXXX
typedef struct{
uint32_t checksum;
uint16_t index[len];
} block;
I changed the memory allocation of block using the below statement:
block *value = (block*) START__ADDR;
I verified the change in memory allocation as well and no issue with it. Now i am trying to update the value of checksum using
value->checksum=0xa5a5a5a5;
But the value of checksum is 0x00000000 and not getting updated to 0xa5a5a5a5. Can anyone please tell me how can i change the value of checksum.
Thanks in advance.
Regards Vybhav
You can't write to flash memory as if it was RAM and that's it. Flash being ROM. This would be why all your variables allocated in flash is/must be const
qualified, meaning read-only.
It is possible to change flash and your part could have dedicated data flash/eeprom for this purpose. But writing to such parts of the memory isn't something a compiler will do for you. You need to write a flash programming driver yourself. As in, you have to study the flash programming part in the manual + app notes.
User contributions licensed under CC BY-SA 3.0