Skip to content

majbthrd/PIC16F1-USB-DFU-Bootloader

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

USB DFU Bootloader for PIC16F1454/5/9

This bootloader has been tested with Linux, Windows, and MacOS.

Thank you to pidcodes for assigning a USB VID:PID.

Matt Sarnoff demonstrated what is possible with his excellent hand-optimized assembly 512 word USB Bootloader.

Its minimal size rightfully puts to shame existing C-code-based bootloaders such as mine.

This project takes the concept of Matt's bootloader, but overhauled the code to instead implement the industry-standard DFU protocol that is supported under multiple Operating Systems via existing tools such as dfu-util and webdfu.

This bootloader also has the added advantage of CRC-14 protection of the user application.

A list of commercial products that already use this bootloader is available on the wiki.

Usage

For MPLAB/XC8 compilation, the following options are needed:

--codeoffset=0x200
--rom=default,-0-1FF,-1F7F-1F7F

The utility provided in the ./tools/ subdirectory converts a .hex file into a CRC-14 protected binary image:

454hex2dfu foo.hex foo.dfu

Downloading can be accomplished with your DFU software of choice. For dfu-util, usage would be like so:

dfu-util -D write.dfu

Limitations

  • A PIC16F145x chip of silicon revision A5 or later is required due to an issue with writing to program memory on revision A2 parts. The value at address 0x8006 in configuration space should be 0x1005 or later. See the silicon errata document for more information.

  • The configuration words are hard-coded in the bootloader (see the __config lines in bootloader.asm); the downloaded app inherits these settings and cannot invoke different values.

License

The contents of this repository are released under a 3-clause BSD license.

Releases

No releases published

Packages

No packages published

Languages

  • C 92.6%
  • Assembly 4.2%
  • Makefile 2.7%
  • C++ 0.5%