 | ULINK2 User's Guide |  |
|
|
| EraseChip| Summary |
int EraseChip (void);
| | Description | The EraseChip function deletes the content of the entire Flash memory. The EraseChip 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 Full Chip has been set in the Flash Download Setup dialog. If this function is missing in the Flash Programming Algorithm, the EraseSector function is executed until the entire content of the Flash memory area has been deleted. | | Return Value | The EraseChip function returns a value: - 0 - on success.
- 1 - on failure.
| | See Also | EraseSector | | Example |
int EraseChip (void) {
FLASH->CR |= FLASH_MER; // Mass Erase Enabled
FLASH->CR |= FLASH_STRT; // Start Erase
while (FLASH->SR & FLASH_BSY) {
IWDG->KR = 0xAAAA; // Reload IWDG
}
FLASH->CR &= ~FLASH_MER; // Mass Erase Disabled
return (0); // Done
}
Complete example exists in folder \KEIL\ARM\FLASH\STM32F10x. |
|
|