Vault 7: Projects

This publication series is about specific projects related to the Vault 7 main publication.

bits are therefore stored on the same flash memory erase page as other (non-critical) program memory space that could
theoretically be used by the application program. On these devices, it is generally recommended to modify the linker settings
for the application program image, so that the application project is built so that it does not use any of the program memory
that is shared with the flash memory erase page containing the configuration bits (ex: the last implemented flash memory
page). This ensures that the application firmware image can be fully re-programmed, without requiring the configuration bit
reprogramming mode to be enabled (by the UNLOCK_CONFIG) command.
NOTE: The HID bootloader PC application and firmware will not reprogram the last page of flash memory on these
PIC18FxxJxx devices (which is shared with the config bits), unless the user configures the bootloader PC GUI program to
perform config bit reprogramming operations, with the UNLOCK_CONFIG command. This restriction only applies to the
specific microcontrollers that implement the configuration bits in the program flash memory space.
1.6.3.1.4 Application Version Information
This section describes how to use the application version feature of the boot loader example.
Description
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
1.6.3.1.5 Host Application Responsibilities
Discusses some of the responsibilities of the host application. These tasks must be performed in order to insure proper boot
loading operation.
Description
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
1.6 Demos MLA - USB Library Help Device - Boot Loader - HID
242

e-Highlighter

Click to send permalink to address bar, or right-click to copy permalink.

Un-highlight all Un-highlight selectionu Highlight selectionh