The second flash sector (address 0x400) stores the flash configuration
field -- resetting the MCU with 0xff stored in there bricks the device.
UnknownCommand = 1,
InvalidArgument,
ChecksumMismatch,
+ PermissionDenied,
}
extern {
if sector > 0xff {
Err(Error::InvalidArgument)
+ } else if sector == 0x01 {
+ // The second sector contains the flash configuration field,
+ // and keeping it in the erased state has the potential
+ // to brick the device.
+ Err(Error::PermissionDenied)
} else {
flash::erase(sector);