]> git.donarmstrong.com Git - kiibohd-controller.git/commitdiff
Adding FPROT flash protection bit for 4k Bootloader on the mk20dx128vlf5
authorJacob Alexander <haata@kiibohd.com>
Wed, 5 Nov 2014 08:09:33 +0000 (00:09 -0800)
committerJacob Alexander <haata@kiibohd.com>
Wed, 5 Nov 2014 08:12:31 +0000 (00:12 -0800)
- Minimum protection size is 4k on the mk20dx128vlf5

Lib/mk20dx.c

index b1a32ed43a72942f16be21755448913e6ebe47d9..4ae27dc064cd50334d2b902f19318c55ffc5846e 100644 (file)
@@ -361,7 +361,17 @@ const uint8_t flashconfigbytes[16] = {
 __attribute__ ((section(".flashconfig"), used))
 const uint8_t flashconfigbytes[16] = {
        0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, // Backdoor Verif Key 28.3.1
-       0xFF, 0xFF, 0xFF, 0xFF, // Program Flash Protection Bytes FPROT0-3
+
+       //
+       // Protecting the first 4k of Flash memory from being over-written while running (bootloader protection)
+       // Still possible to overwrite the bootloader using an external flashing device
+       // For more details see:
+       //  http://cache.freescale.com/files/training/doc/dwf/AMF_ENT_T1031_Boston.pdf (page 8)
+       //  http://cache.freescale.com/files/microcontrollers/doc/app_note/AN4507.pdf
+       //  http://cache.freescale.com/files/32bit/doc/ref_manual/K20P48M50SF0RM.pdf (28.34.6)
+       //
+       0xFF, 0xFF, 0xFF, 0xFE, // Program Flash Protection Bytes FPROT0-3
+
        0xBE, // Flash security byte FSEC
        0x03, // Flash nonvolatile option byte FOPT
        0xFF, // EEPROM Protection Byte FEPROT