This is my tenth week work in AESTE. This week I had successfully to test the Bootloader Live Update work. Although it is update by USB device (my actual project use Ethernet). But that is a good starting point, at least I know how to use the live update demo from Harmony. Next step I have to do are:
- Upload a file to localhost by TFTP.
- PIC32MZ get the file from localhost by Ethernet.
- Using PIC32MZ check the file is valid or not by checksum.
- Store it to Flash memory if the file is download completed (valid checksum).
Now let me discuss about the Bootloader demo application for PIC32MX Ethernet Starter Kit. This demo application really spent me a lot of time in order to get it done. So, I would like to share my experience of Bootloader demo application. I am using PIC32 Bootlaoder application with USB device to test it. There are 2 types of Bootloader for Harmony v1.11 (Harmony v2.05 got 3 type) which are Basic and Live Update.
Bootloader- Basic demo application
This basic demo code need to install to PIC32MX Ethernet Starter Kit by debugger such as PICkit 3. After install this program to PIC32MX Ethernet Starter Kit, next time user can update new firmware by PIC32 Bootloader Application with USB. Please note that, the new firmware must be enable Bootloader linker script (Harmony Framework Configuration –> Bootloader Library –> Use Bootloader Library –> Build an Application Linker Script). Every time want to update a new firmware just press and hold the switch 1 (SW1), then it will jump to Bootloader mode again.
For Live Update Bootloadeer I didn’t used PIC32MX Ethernet Starter Kit due to Live Update function only support on PIC32MZ. I tested the demo code and test by PIC32 Bootloader Application. Unfortunately it doesn’t worked. After that I tried to read the memory by PICkit 3, the memory area starts from 0x1D000000 and 0X1D100000 have the same data. It means the new firmware had successfully write to the flash memory. After many trying and debugging, I changed the code from
#define BOOTLOADER_FLASH_TRIGGER_ADDRESS 0x9D101000
if (*(uint32_t *)BOOTLOADER_FLASH_TRIGGER_ADDRESS == 0xFFFFFFFF)
and finally it works. My first feeling was very excited because finally I get this Live Update Application works. But after a few seconds, I felt worried because it likes magic suddenly works and I don’t know the reason.
Next week I am going to write a simple program to receive data via TFTP. I hope I can get this done early so I can go though deeper about the Bootloader Live Update program.