USB Library
Host Application Responsibilities

In order to minimize the bootloader firmware program memory size and complexity, the bootloader is architected to perform the most complex tasks in the host host/PC GUI software. Things such as .hex file parsing, and issuing commands, are therefore the responsibility of the host/PC software. Additionally, the firmware is currently written in such a way as to impose the following restrictions on the host/PC GUI software:

  1. When the PROGRAM_DEVICE command is used, the total program data payload sent prior to the next PROGRAM_COMPLETE command is sent, must be an exact integer number of program instructions. In other words for PIC16 and PIC18 devices, the total program memory programmed must be an even number (since program instructions are 2 bytes wide on these architectures). Sending an odd number of total data payload bytes is not supported, and therefore should be padded with 0xFF (the blank/default value of the flash memory after an erase operation) if necessary to achieve a total PROGRAM_DEVICE payload quantity (spanning multiple packets) that is even.
  2. When multiple PROGRAM_DEVICE packets are sent to the device, the addresses sent must always be contiguous (ex: second packet address must be equal to first packet’s address + the payload size), growing from lowest address to highest address. Non-contiguous address jumping is only allowed, if the host/PC program sends the PROGRAM_COMPLETE command in between the non-continuous address regions.
  3. After sending one or more PROGRAM_DEVICE packets, the host/PC software must send the PROGRAM_COMPLETE command once the end of the region is reached (of if it wants to abort operation of the entire region). The microcontroller firmware is allowed to buffer up received bytes intended for programming, without necessarily committing all of them to the non-volatile memory, until the PROGRAM_COMPLETE command is issued by the host/PC software.

MLA - USB Library Help Version : 2.16
http://www.microchip.com/mla