2008-03-06 08:23 AM
writing a variable value inside the flash at an absoulte address
2011-05-17 03:26 AM
Is this possible with IAR compiler for STM32 to write variable value into the flash at an absolute location.
I tried this code but only get the hard fault exception. like this way: #pragma location=0x80017FC // 0x80017FC is inside the flash volatile __no_init int beta; volatile __no_init int gamma; int main(void) { beta = 0x55555555; }2011-05-17 03:26 AM
read the flash programming manual.
2011-05-17 03:26 AM
Thanks for your suggestion.
If in case I had already read that then you would like to say anything. I have already unlocked the flah programming controller, disable the read and write protection and I already have a running bootloader code that can write to flash. Now my problem is that I want to write my build and version number inside the flash using some variable but I am not able to write the variable at an absolute location if you have any experience please help me.2011-05-17 03:26 AM
ok, sorry, there was no way to know you had read it from your post. if you hadn't it was the right pointer.
that doc says under which conditions the access would be aborted, I copy one here: -Any attempt to write data that are not half-word long will result in a bus error response from the FPEC. you're accessing a full word, so that's probably it. also be sure to check the status flags after the programming.2011-05-17 03:26 AM
maybe you want the code to be more portable, something like:
static volatile int* const beta = (int*) 0x080017FC; static volatile short int* const beta_l = (short int*) 0x080017FC; static volatile short int* const beta_h = (short int*) 0x080017FE;