USB Library
Memory Map

As configured by default, PIC16 and PIC18 USB HID bootloader uses the flash memory mapping as shown the figure below: 

PIC18 HID Bootloader Memory Map 

 

 

PIC16 HID Bootloader Memory Map 

 

 

The figure below shows the table with currently implemented memory addresses for PIC16 and PIC18 USB bootloaders. 

Actual flash memory address implementation values 

 

Let us examine each section in the memory mapping closely:

  1. Reset Vector – The reset vector is defined by hardware. This is located at address 0x0000. Any reset to the CPU will go to the reset vector. The main job of the reset vector is to jump to the code that needs to be run. In the case of a bootloader, this means jumping to the bootloader code (4)).
  2. Interrupt Handler Vector – This is another section that is defined by the hardware. PIC18F devices have two interrupt vectors, high priority interrupt vector and low priority interrupt vector, and they are located at 0x0008 and 0x0018 respectively. PIC16F devices have one interrupt vector located at 0x0004.
  3. Bootloader Absolute Entry – This is the absolute entry point into the bootloader firmware, so application projects can jump into bootloader mode at runtime. The entry address that is currently set in the PIC18 and PIC16 bootloader is 0x001C.
  4. Bootloader code – This is where the bootloader code resides. This section handles all of the loading of the new application code.
  5. User Remapped Reset Vector – This section is defined by the bootloader. This is the remapped reset vector address that indicates start of the main application code.
  6. User Remapped Interrupt Vector – Since the hardware interrupt vector is located in the bootloader space, the bootloader must remap all of the interrupts to the application space. This is done using user remapped interrupt vector. In PIC16 and PIC18 bootloader implementations, user remapped interrupt vector(s) are defined in the bootloader code.
  7. Application code – This section is where the main application code is located.
  8. Flash Signature Word – This is the address in program memory in Application Space where Flash Signature Word is located. This is a special program memory word that gets programmed (only after the entire erase/program/verify process is completed successfully) with a known value, and indicates to the bootloader code that the application firmware image is fully intact. It is necessary for the flash signature word to be located on the very first erase page during the erase sequence, and must also be the very last portion of program memory that gets re-programmed. In the current implementation, the Flash Signature Word is located within the application program memory space, at a specific fixed address. Additional details on Flash Signature process are described in the Flash Signature section.
  9. Application Firmware Version Word – This word also resides in the application space, but it is used by the bootloader firmware to read out the application firmware version number. In the current implementation, this word is located at fixed address in the application space. Additional details on Application Firmware Version Word are described below.

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