X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=src%2Fbootloader%2Fbootloader.rs;h=d4a686b5ea83a290f16f4518f251c71a5f3fc03f;hb=1b1fe0d53c04d6e7d7ff81387399813fb8147161;hp=311b1a60e6a2ed491474eecf0d986c10d58d54a3;hpb=fafbe49123de3572c496e964fc3048b3ab2e28d8;p=gps-watch.git diff --git a/src/bootloader/bootloader.rs b/src/bootloader/bootloader.rs index 311b1a6..d4a686b 100644 --- a/src/bootloader/bootloader.rs +++ b/src/bootloader/bootloader.rs @@ -46,6 +46,7 @@ enum Error { UnknownCommand = 1, InvalidArgument, ChecksumMismatch, + PermissionDenied, } extern { @@ -191,6 +192,11 @@ impl Bootloader { 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);