Before continuing with this section, please review the preceding sections to understand some of the implementation details that aren't discussed in detail in this section. Some of the implementation details of how this works is described the Understanding and Customizing the Boot Loader Implementation section. This section covers the basic flow and how it passes between the boot loader and the application.
In the boot loader implementations provided in USB Library library, the boot loader controls the reset vector. This is true for the PIC24F boot loaders as well. The reset vector resides within the boot loader memory space. This means that the boot loader must jump to the target application. This processes in show below in the following diagram and described in the following paragraphs.
1) On PIC24F devices, when a reset occurs the hardware automatically jumps to the reset vector. This is located at address 0x0000. This address resides within the boot loader memory. The compiler/linker for the boot loader code places a 'goto' instruction at the reset vector to the boot loader startup code.
2) The 'goto" instruction at the reset address will jump to the main() function for the boot loader.
3) In the boot loader startup sequence there is a check to determine if the boot loader should run or if the boot loader should jump to the application instead. In the provided examples the code checks a switch to determine if it should remain in the boot loader. If the switch is not pressed then the boot loader jumps to the user_remapped_reset_vector. At this point the control of the processor has just changed from the boot loader to the application.
4) The code at the user_remapped_reset_vector is controlled by the application project, not the boot loader. This vector effectively emulates the behavior that the normal reset vector would if a boot loader wasn't used. In this case it should jump to the startup code for the application. This is done by modified linker script for the application.
MLA - USB Library Help Version : 2.16
![]() |