Showing results for 
Search instead for 
Did you mean: 

Programming STM32G0 Flash Memory while executing from Flash


Hello All, 

I need to perform two separate tasks. 

First I need to locate an array of constant integers at the fixed address 0x8000 0000. I know this has to be done though the linker script. But  I am a little out of touch with writing linker scripts. Can Anyone help me with the specific command I need to insert into the linker file?

Second, I need to copy some values that I have stored in a RAM array and write to the Flash memory at the address 0x8000 0000 either using the in-built HAL drivers or the LL drivers if required. If someone can point me in the right direction that would be highly appreciated. If any one can share some sample code that would be highly appreciated. 



ST Employee

Hello @CSE_Anand,

I suppose you mean the 0x0800 0000 address, which is the beginning of the internal user flash. This address is the default location of the vector table, I suggest you choose a different address range for your data.

The user flash has limited erase cycle number, to store data in it, it's highly recommended to use a wear leveling system. There are very nice examples of it right here: X-CUBE-EEPROM - EEPROM emulation expansion software for STM32Cube - STMicroelectronics



To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.