flash_erase
Erase a target flash range by address and length to clear corrupt OTA journals, stale boot descriptors, or half-written images and recover a non-booting board.
Instructions
Erases a flash range on the target (OpenOCD 'flash erase_address pad'), rounding out to the driver's erase-sector boundaries. The recovery tool for a board that will not boot: clearing a corrupt OTA journal, a stale boot descriptor, or a half-written image. Requires an explicit address AND length — there is deliberately no mass-erase default.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| length | Yes | Bytes to erase. Rounded UP to the erase-sector boundary. | |
| verify | No | Read back the first 64 bytes and confirm they hold this part's erased value — 0x00 on STM32L0/L1, 0xFF elsewhere, taken from the profile MCU (default true). | |
| address | Yes | Start address, e.g. '0x08016000'. Rounded DOWN to the erase-sector boundary. | |
| session | No | Optional debug-session name. Omit for the default target. | |
| sector_size_bytes | No | Erase-sector size of this part (e.g. 4096 on STM32L1, up to 131072 on F4). Give it and the write guard checks the padded range that is really erased; omit it and the guard can only check the range you asked for. |