1.3.7.1 Debugging UART, I2C, SPI and CAN Bootloaders for Cortex-M Based MCUs
The UART, I2C, SPI and CAN bootloaders for Cortex-M based MCU's are designed to run from SRAM to support:
-
Simultaneous Flash memory write and reception of the next block of data
-
Self update
-
For debugging these bootloaders make use of software breakpoints instead of Hardware breakpoints
Steps to enable software breakpoints and start debugging
- Enable software breakpoint from the project configuration dashboard by clicking the button as shown below
-
Software breakpoints inside main() when running from SRAM do not work when set before starting the debugger
- For them to work first set a Breakpoint in startup_xc32.c file as it is running from Flash
-
Start the debugger from MPLAB IDE and the software break point in startup file will be hit
-
Once the breakpoint is hit in startup file, then set breakpoints anywhere the user wants, such as in main() function as shown below
-
Resume the debugger and the user should be able to debug as usual
