Jump to main content

##

# 1.1.34 PIC32CM SG00/GC00 Curiosity Pro Development Board: Building and Running the UART Bootloader applications

Downloading and building the application

To clone or download this application from Github,go to the main page of this repository and then click Clone button to clone this repo or download as zip file. This content can also be download using content manager by following these instructions

Path of the application within the repository is apps/uart_bootloader/

To build the application, refer to the following table and open the project using its IDE.

Bootloader Application

Project Name | Description
--- | ---
bootloader\pic32cm_sg00_curioisty_pro_trustzone\pic32cm_sg00_curiosity_pro\pic32cm_sg00group | MPLABX Project for PIC32CM SG00/GC00 Curiosity Pro Development Board

Test Application

Project Name | Description
--- | ---
test_app\pic32cm_sg00_curiosity_pro_trustzone\pic32cm_sg00_curiosity_pro\pic32cm_sg00group | MPLABX Project for PIC32CM SG00/GC00 Curiosity Pro Development Board

Setting up PIC32CM SG00/GC00 Curiosity Pro Development Board

- Connect the Debug USB port on the board to the computer using a micro USB cable

Setting up the host script

- Refer to Bootloader Host Script Help for setting up the btl_host.py utility used to send the application binary from host PC

Running the Application

1. Open the test application project bootloader\pic32cm_sg00_curiosity_pro_trustzone\pic32cm_sg00_curiosity_pro\pic32cm_sg00group in the IDE

2. Set pic32cm_sg00.X as main project.

3. Build the project to generate the binary (Do not program the binary)

4. Copy the generated application binary file and save in different folder( Note: the bin file generated has no fuse bits)

   - <harmony3_path>bootloader_apps_uart\apps\uart_bootloader\test_app\pic32cm_sg00_curiosity_pro_trustzone\pic32cm_sg00_curiosity_pro\pic32cm_sg00.X\dist\default\production\pic32cm_sg00.X.production.unified.bin

5. Set pic32cm_sg00_secure.X as main project in the IDE and launch MCC.

6. Enable Fuse Bit and Regenerate the application

7. Build the project to generate the binary (Do not program the binary)

8. Run the btl_fuse_bin_gen.py from command prompt to generate fuse bits bin file

        python <harmony3_path>\bootloader\tools\btl_fuse_bin_gen.py -d PIC32CM_GC00_SG00 -f <harmony3_path>\bootloader_apps_uart\apps\uart_bootloader\test_app\pic32cm_sg00_curiosity_pro_trustzone\pic32cm_sg00_curiosity_pro_secure\pic32cm_sg00_secure.X\dist\default\production\pic32cm_sg00_secure.X.production.hex -o devcfg.bin

9. Open the bootloader project bootloader\pic32cm_sg00_curioisty_pro_trustzone\pic32cm_sg00_secure\pic32cm_sg00_secure.X in the IDE

10. Build and program the application using the IDE

11. Once both file are generated devcg.bin and pic32cm_sg00.X.production.unified.bin is ready Run below command to flash the bin file.

    python <harmony3_path>/bootloader/tools/btl_host.py -v -i <COM_PORT> -d PIC32CM_GC00_SG00 -a 0xc000000 -f <folder_path>/pic32cm_sg00.X.production.unified.bin -e 0xa000000 -g <folder_path>\devcfg.bin

12. If above step is successful then the LED0 should start blinking

13. Open the Terminal application (Ex.:Tera Term) on the computer

14. Configure the serial port settings as follows:

    - Baud : 115200
    - Data : 8 Bits
    - Parity : None
    - Stop : 1 Bit
    - Flow Control : None

15. Reset or Power cycle the device

16. LED0 should start blinking and you should see below output on the console

17. Press and hold the Switch SW0 to trigger Bootloader from test application and you should see below output

18. If fuse bits are already programmed, to only update the application, use

    python <harmony3_path>/bootloader/tools/btl_host.py -v -i <COM_PORT> -d PIC32CM_GC00_SG00 -a 0xc000000 -f <folder_path>/pic32cm_sg00.X.production.unified.bin

19. To program the fuse bits, the device must first be erased using the IDE. After erasing, repeat steps 11 to 17.

Additional Steps (Optional)

- To bootload any other application refer to Configuring an application to be bootloaded for CORTEX-M based MCUs