10.07.2015 Views

AN1388 – PIC32 Bootloader - Microchip

AN1388 – PIC32 Bootloader - Microchip

AN1388 – PIC32 Bootloader - Microchip

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>AN1388</strong>PROGRAM FLASHThe PC host application sends one or multiple hexrecords in Intel Hex format along with the programFlash command. The MPLAB C32 compiler generatesthe image in the Intel Hex format. Each line in the Intelhexadecimal file represents a hexadecimal record.Each hexadecimal record starts with a colon (:) and isin ASCII format. The PC host application discards thecolon and converts the remaining data from ASCII tohexadecimal, and then sends the data to thebootloader. The bootloader extracts the destinationaddress and data from the hex record, and writes thedata into program Flash.The request frame from the PC host application to thebootloader is shown in Example 6.JUMP TO APPLICATIONThe Jump to Application command from the PChost application commands the bootloader to executethe application. The request frame from the PC hostapplication to the bootloader is shown in Example 10.EXAMPLE 10: REQUEST[…]There is no response to this command from thebootloader because the bootloader immediately exitsthe firmware upgrade mode and begins executing theapplication.EXAMPLE 6: REQUEST[…][…]Where:HEX_RECORD is the Intel Hex record in hexadecimal formatThe response from the bootloader to the PC hostapplication is shown in Example 7.EXAMPLE 7:RESPONSE[…]READ CRCThe read CRC command is used to verify the contentof the program Flash after programming. The requestframe from the PC host application to the bootloader isshown in Example 8.EXAMPLE 8:REQUEST[…]ADRS_LB, ADRS_HB, ADRS_UB and ADRS_MB, asshown in Example 8, represent the 32-bit Flashaddresses from where the CRC calculation begins.NUMBYTES_LB, NUMBYTES_HB, NUMBYTES_UB andNUMBYTES_MB, as shown in Example 8, represent thetotal number of bytes in 32-bit format for which the CRCis to be calculated.The response from the bootloader to the PC hostapplication is shown in Example 9.EXAMPLE 9: RESPONSE[…]DS01388B-page 10© 2011-2012 <strong>Microchip</strong> Technology Inc.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!