 | ULINK2 User's Guide |  |
|
|
| EraseSector| Summary |
int EraseSector (
unsigned long adr); /* Sector address */
| | Description | The EraseSector function deletes the content of the sector starting at the address adr. The function is invoked whenever the µVision menu Flash - Erase is used, or whenever an attempt is made to download the program to Flash and the option Erase Sectors has been set in the Flash Download Setup dialog. | | Return Value | The EraseSector function returns a value: - 0 - on success.
- 1 - on failure.
| | See Also | EraseChip | | Example |
int EraseSector (unsigned long adr) {
FLASH->CR |= FLASH_PER; // Page Erase Enabled
FLASH->AR = adr; // Page Address
FLASH->CR |= FLASH_STRT; // Start Erase
while (FLASH->SR & FLASH_BSY) {
IWDG->KR = 0xAAAA; // Reload IWDG
}
FLASH->CR &= ~FLASH_PER; // Page Erase Disabled
return (0); // Done
}
Complete example exists in folder \KEIL\ARM\FLASH\STM32F10x. |
|
|