2018-05-01 11:20 PM
hi i'm using stm32F030F4P6 what is the right way to write to the flash? from where(the start address) i can write? i know that the start address is 0x08000000 but did my code download to there? and before i write did i need to erase the address where i want to write over and over?
#flash-sector2018-05-02 04:57 AM
You can only write to locations once after you erase them. The erase block/page size is significantly larger than the minimum write unit, so you erase a block, and can then write many words.
You should try an avoid situations/code where you erase and write data in the same areas thousands of times.
The device has a 16KB FLASH, so 0x08000000..0x08003FFF, with 1KB blocks
2018-05-02 07:43 AM
thank you for the answer.
how do i know what the maximum size of the flash that my code take place when i download it?
i try to write with the function HAL_FLASH_Program to the address 0x08000000 but my code/program stuck after the writing.
and if i write to the address 0x08004000 all goes well.
thx
2018-05-02 10:40 AM
Not sure how I'd know, you could look in the .MAP file or other output from the Linker to understand the utilization. In your own code you could pull through symbols generated by the linker.
If you write at 0x08004000 and beyond it suggests the die has more than 16KB, which is possible, but you'd need to be careful as this is untested, and has the potential to be eliminated if a die shrink moves to a 16KB only implementation.