The application firmware version word resides in the application space, but it is used by the bootloader to read out the application firmware version number. This makes it potentially possible to make a PC GUI that can check the currently programmed application firmware image version and determine if the user is trying to program an older .hex file than what was already programmed into the device. If a custom PC GUI application is used to perform the firmware updates, the GUI application software can then use this information to warn the user about programming an older image than the existing image, block the user from performing the operation, etc.
The Application Firmware Version Word can be read by the bootloader host/PC GUI software using the Extended Query Command Response, described below.
In order to fully implement and use the application firmware version word feature, the application firmware image must place a constant in the flash memory, at the magic version word address. For PIC18 targets, this would typically be done with code in the application firmware project, such as:
Version Word with XC8
const unsigned int VersionWord @ 0x1016 = 0x0100; //Initialize to the appropriate version value
Version Word with C18
#pragma code VersionWordSection=0x1016 rom unsigned int VersionWord = 0x0100; //Initialize to the appropriate version value #pragma code
MLA - USB Library Help Version : 2.16
![]() |