I have migrated my keil code generated from HAL cube to stm32cubeide because of size constraint. The code is working fine when used in debugging. But when run code stand alone using st link utility, it is working fine for the first time but when perform reset its first address erased and controller gone to undefined state. Can anyone have any idea regarding this problem and how can i fix it.
Yes i have used the flash write in my code. After some research in code i found that problem is occurring due to my erase function. But can get out of it. Functions used are written below:
when break point hits, check the address you are writing to; in this example second argument is address so check the value of FLASH_STORAGE+write_cnt in debugger. It must not equal zero or 0x08000000. Also complete this test for every where you are writing to flash.
If you are using flash for data storage, try to use proven ST EEPROM emulation library and assign last two flash pages for this purpose.