cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F2xx Flash memory partial erasing?

w21685
Associate II
Posted on October 23, 2016 at 20:09

Hello,

Would it be possible to erase the flash memory partially before writing data ?

It takes a long time to erase 1sector base. (128kByte or 64kByte)

If possible, could you some advice how to apply?

Thanks.

4 REPLIES 4
Posted on October 23, 2016 at 20:44

Create a gap in your firmware image so you use the 16kb sectors.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
w21685
Associate II
Posted on October 24, 2016 at 16:25

Thank you for your reply.

But I don't understand what you mentioned.

If possible, could you be more specific?

Thanks.

Posted on October 24, 2016 at 18:10

Break the Load Region for your firmware into TWO separate areas using your Linker Script or Scatter File.

ie

Region 1 0x08000000..0x080003FFF 16KB

Region 2 0x08010000..0x0800FFFFF 1MB-64KB

Then you will have THREE 16KB sectors at 0x08004000, 0x08008000 and 0x0800C000 which will erase faster

Alternative create TWO firmwares, a loader that starts at 0x08000000 and an application that starts at 0x08010000

Review the IAP examples

Review your tool chain documentation

The sectors have a defined size, and erase times, you can't do a partial erase. You can write multiple instances of the same structure back-to-back in flash, and then find the most recent, a concept call Journalling. Here you only need to erase when you consume all available space, or you can ping-pong between two flash sectors

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
w21685
Associate II
Posted on October 24, 2016 at 20:13

Thanks. I will try it.