Boot loader for updating Firmware

bluetoothbootloaderfirmwarepicusb

I am using pic controller with USB HID boot loader which will do a firmware update via USB and i have tested it successfully.If i add a blue tooth device(UART) and tries for a firmware update I trust it will fail to do an update.
In this case should i replace the USB HID boot loader and go for Serial Boot loader(UART) right.?

What should be done to make it compatible for both Bluetooth and USB?
Or is there any boot loader available that will do the job?
Smart phones/devices use update over air and USB right.?

Best Answer

In smart phones and other similar devices, the bootloader will not do any kind of communications to download the new software image: this will be handled by a 'download client' that runs in the application and stores the image to a memory location that can be used by the bootloader. Once the image has been downloaded and validated, the application resets the device to launch the bootloader.

This is a good approach for several reasons:

  • The bootloader is frequently constrained in size and coding it as a simple Flash programmer makes this less restrictive.
  • The application has the opportunity to inspect the downloaded image for errors (CRC, Hamming codes, etc) before programming starts.
  • Interrupting the download is less likely to result in a device failure.
  • You can use multiple physical transport media for performing the download.
  • You can unit test the bootloader by provisioning test images without having to test the transport at the same time.
  • The bootlaoder can verify the application software every time the device is reset or powered and re-program it if required.

The main drawbacks are:

  • You may need an external non-volatile memory device to store the downloaded image.
  • The bootloader will need to be able to access the external memory device to retieve the dowloaded image.

I would therefore recommend that you move the USB and Serial download code from the bootloader to the application, implement an external memory device to store the downloaded software and convert the bootloader to be a 'NVM bootloader'.