53.1 Appendix A: MPLAB® Harmony v3 UART-I2C Factory Bootloader for PIC32CM LE00/LS00/LS60
The Bootloader programmed at production by Microchip is an MPLAB Harmony v3-based Bootloader capable of programming an application binary using either the UART or I2C interface.
Key Features:
- The Bootloader is programmed at the
Flash memory location (
0x00000000
) and takes up to 4KB of Flash memory. It is protected by default using the SULCK and BOOTPROT fuse settings from any erase-writes. The BOOTPROT value is set to 4KB (0x1000
). - The Bootloader startup code copies
the Bootloader from the Flash memory to the SRAM from (
0x20001010
) before calling the main function. The main function (and therefore the entire Bootloader) runs from the SRAM to allow upgrading of the Bootloader code itself in Flash memory. The Bootloader code will unlock the BOOTPROT region before updating if the Bootloader region has to be programmed. - The Bootloader provides a feature to read the current version of the Bootloader by using the read version command
- The Bootloader provides a feature to program the Fuse settings, which are part of the USER Row and the BOCOR Row using a separate command
- The Bootloader will provide two ways
to trigger the Bootloader mode:
- External trigger: Bootloader will be triggered based on the status of a dedicated GPIO pin
- Internal trigger: Bootloader will be triggered based on the trigger pattern written at a specific location in the SRAM by the application firmware
- After a new application image is programmed, the Bootloader will verify the programmed application space by generating a CRC-32 value and comparing it with the CRC-32 received from the Host. The application CRC will not be verified after every reset before jumping to the application space for faster startup.
- The Bootloader will read the first
four bytes of application space (
0x1000
) to decide if a valid application is present. If the contents of the first four bytes are not0xFFFFFFFF
, then the Bootloader assumes a valid application is present and jumps to the application. If a valid application is not present, then the Bootloader will wait, and remain in Bootloader mode.
Key Features for TrustZone variants PIC32CM LS00/LS60:
- The Bootloader is part of the Secure Flash BOOTPROT (BS) region with no BNSC region.
- The Bootloader will always jump to
the Application Secure Region at location
0x1000
after programming. Therefore, The applications reset handler must be part of the Application Secure Region, which can further call its Non-Secure region if any.
Key Requirements:
- By default the Bootloader expects the
application to start from the
0x1000
location. Therefore, the application should be built to start from the0x1000
Flash location. - The proper fuse settings required by the application must be sent along with application binary. See Fuse Configurations in this chapter.
- External Pull-ups must be used for the I2C SDA and SCL lines.