Chip Erase vs Sector Erase – STM32 ARM Keil Guide

armkeilstm32

In Keil IDE Software there are two ways to erase chip before program it.

enter image description here

  • What does do "Erase Sectors" mode?
  • When to use "Erase sectors" mode and when to use "Erase Full Chip" Mode?

Best Answer

Erasing the full chip would be faster, but if you need to retain part of the contents (for example, if you have a custom bootloader or some data stored at a particular address) then you can erase individual sectors which you wish to change, for example erase an old main program and load a new one in its place.

Beware that sectors can be somewhat larger than you might at times find convenient. On some MCUs they are also not all the same size, but may be smaller in some regions to give more fine grained flexibility.