Vault 7: Projects
This publication series is about specific projects related to the Vault 7 main publication.
6) Section (6) is the remapped IVT table. This section allows the interrupt to be remapped from the boot loader space to the
application space. In order to do this the boot loader must either know the exact address of every interrupt handler, or must
have another jump table that it jumps to in order to redirect it to the correct interrupt handler. The second approach is the
one used in the implemented boot loaders. This is implemented in the following table:
.application_ivt __APP_IVT_BASE :
{
SHORT(ABSOLUTE(__reset)); SHORT(0x04); SHORT((ABSOLUTE(__reset) >> 16) & 0x7F);
SHORT(0);
SHORT(DEFINED(__ReservedTrap0) ? ABSOLUTE(__ReservedTrap0) :
ABSOLUTE(__DefaultInterrupt)); SHORT(0x04); SHORT(DEFINED(__ReservedTrap0) ?
(ABSOLUTE(__ReservedTrap0) >> 16) & 0x7F : (ABSOLUTE(__DefaultInterrupt) >> 16) & 0x7F);
SHORT(0);
SHORT(DEFINED(__OscillatorFail) ? ABSOLUTE(__OscillatorFail) :
ABSOLUTE(__DefaultInterrupt)); SHORT(0x04); SHORT(DEFINED(__OscillatorFail) ?
(ABSOLUTE(__OscillatorFail) >> 16) & 0x7F : (ABSOLUTE(__DefaultInterrupt) >> 16) & 0x7F);
SHORT(0);
SHORT(DEFINED(__AddressError) ? ABSOLUTE(__AddressError) :
ABSOLUTE(__DefaultInterrupt)); SHORT(0x04); SHORT(DEFINED(__AddressError) ?
(ABSOLUTE(__AddressError) >> 16) & 0x7F : (ABSOLUTE(__DefaultInterrupt) >> 16) & 0x7F);
SHORT(0);
This first entry in the table is the remapped reset vector that we just discussed. The second entry in the table is the first
possible interrupt. In this case it is the ReservedTrap0 interrupt. This line of linker code will look for the __ReservedTrap0
interrupt function. If it exists it will insert a "goto __ReservedTrap0" at the second address in this table. If it doesn't find the
__ReservedTrap0 function, it will put a "goto __DefaultInterrupt" at this entry in the table. In this way just by defining the
appropriate interrupt handler function in the application code, the linker will automatically create the jump table entry
.required.
Looking at an example application_ivt table as generated by the linker script where the ReservedTrap0 interrupt is not
defined and the OscillatorFail and AddressError handlers are defined, starting at address _APP_IVT_BASE you will have the
following entries in program memory:
goto __reset
goto __DefaultInterrupt
goto __OscillatorFail
goto __AddressError
...
7) Section (7), the user application code - the only modification to the linker script required for the application code is the
changes to the memory region definitions discussed previously in the Memory Region Definitions section.
1.6.3.2.3.2.5.3 Changing the memory footprint of the boot loader
This section covers how to modify how much memory is used by the boot loader. This can be useful when adding features to
the boot loader that increase the size beyond the default example or if a version of the compiler is used that doesn't provide
a sufficient level of optimizations to fit the default boot loader.
Description
This section covers how to modify the size of the HID boot loader. This can be useful when adding features to the boot
loader that increase the size beyond the default example or if a version of the compiler is used that doesn't provide a
sufficient level of optimizations to fit the default boot loader. The boot loaders provided by default assume full optimizations
and may not work with compilers that don't have access to full optimizations.
Please read all of the other topics in the PIC24F boot loader section before proceeding in this topic. This topic will show
where the modifications need to be made and how they need to match up, but will not describe what the sections that are
being modified are or how they are implemented. This information is in previous sections.
There are three places that require corresponding changes: the boot loader linker script, the application linker script, and the
boot loader code. You may wish to make copies of the original files so that you preserve the original non-modified files.
1.6 Demos MLA - USB Library Help Device - Boot Loader - HID
265
Protego_Release_01_05-Related-OEM-Documentation-MLA_v2013_12_20-help_mla_usb.pdf