Welcome to 1977!
Open the booloader folder in VSCode with the MPLab extension enabled and issue CTRL + B The first build will clone the wolfBoot project and build the wolfBoot as a library.
See the prebuild.sh script
The postbuild.sh script will create signed images (image1_v1_signed.bin and image2_v2_signed) which have a version string embedded at offset 0x400 from the origin. The bootloader will check this string to determine the latest image to boot (i.e anti-rollback).
Open a serial terminal on the Virtual COM port from the PKOB4 USB. Open another serial terminal using an RS232 converter on SERCOM4 (J404, PC21 - TxD and PC22 - RxD on the PIC32CZ CAxx Curiosity Ultra board).
Program the bootloader into Boot Flash Memory (0x8000000) and execute it. With blank Program Flash Memory (0x0c000000 - 0x0c4fffff), the bootloader will prompt you to transfer a new image over xmodem protocol on SERCOM4. Select one of the signed images to transfer. After the update the board will reset.
Holding down SW1 while resetting the board will put the bootloader into forced update mode where the user can select the flash bank to program and either reset after an update or perform another update (i.e to select the other bank and flash an image).
image1.bin and image2.bin are identical except for the version string (1.0.0 vs. 2.0.0). The application blinks LED0 and prompts the user to press SW0 to corrupt the image. When SW0 is pressed, the application erases a page of flash at offset 0x1000 and resets. The erased page will render the signature invalid and cause the bootloader to attempt to boot from the other flash bank. If both banks are corrupt or blank, the bootloader goes into xmodem update mode.