Why does the bootloader use 4096 words? - majbthrd/pic16f1454-bootloader GitHub Wiki

It is highly desirable for a bootloader to leverage hardware-based write-protection.

This ensures that errant code does not inadvertently damage the very bootloader needed to repair/replace the firmware.

The PIC16F1454/PIC16F1455/PIC16F1459 does provide such hardware-based write-protection, but only in two sizes:

  • 512 words
  • 4096 words

4096 words is more than what should be needed for a USB bootloader.

At the time (2013) that I wrote this bootloader in C, 512 words seemed woefully too few. HOWEVER, I've since been proven wrong; it is possible to fit a USB bootloader into 512 words with hand-optimized assembly code.

What this means is that the maximum "app" size for this particular project is more restricted than would be desirable.

An intermediate value would have benefited the device.

The only practical choice (4096) for write-protection leaves 4095 (1 word is used as a CRC check) for the user "app". This is still plenty for many applications; see the example apps for... well... examples.

All Wiki content and images are (C) Copyright Peter Lawrence All Rights Reserved Redistribution without permission is not authorized