|
This page contains information how to use MPLAB X IDE and XC32 Compilers from Michrochip with preloaded USB-HID bootloader from Mikroelektronika (i.e. mikroBootloader). More specifically, this page is dedicated to MINI-32 for PIC32MX and MINI-32 for PIC32MZ starter boards from Mikroelektronika. MikroBootloader provides free and simple way of MCU programing, however, downloading code compiled using XC32 onto MCU using mikroBootloader one might experience issues of program not executing or MCU resetting. It should be noted that this issue is not experienced if program is downloaded directly using PicKit3 Programmer. Solution proposed here is to modify MCU startup code provided by XC32 compiler in order to enable proper functionality when using mikroBootloader.
The issue of program not executing or MCU resetting manifest when using XC32 compiler version v1.30 or newer which coincides with introduction of MPLAB harmony framework and particularly PIC32MZ family support (this family introduces the microMIPS compressed instruction-set architecture or ISA). Using XC32 compiler version v1.22 or earlier with mikroBootloader works fine and produces no issues. However, switching to newer compiler versions (v1.30 or newer) produces aforementioned issue. Hint of this problem can be found in XC32 release notes and it’s related to ISA mode switching and jal instruction.
Based on the way issue manifest, XC32 release notes and taking into account that using older versions of XC32 complier works fine indicated that problem was in MCU assembly startup code (crt0.S). By examining startup code in different compiler version a new startup code is produces (startup.S) which solves this issue.
Therefore, in order to successfully use MPLAB X IDE and XC32 Compilers with mikroBootloader following steps should be performed:
Notice: In new startup.S macro USE_MIKROE_BOOTLOADER is defined. This macro activates skipping of assembly ISA switching code and modification of jump to startup section of the code. It will cause warning message (“Startup set for MIKROE bootloader”) to be emitted during project build. This warning can be safely ignored (it just represents a feedback info). If this macro is omitted or commented startup.S reduces to default crt0.S startup code.
Demo project (simple blink LED example) provided below is built using following ecosystem:
Notice: For PIC32MX demo project is successfully tested using XC32 compiler version v1.1, v1.22, v1.40, v2.15 and v3.01. PROJECT FILES&DOCS: - PIC32 Assebmly startup code for use with mikroBootloader: startup.S |
IMAGE GALLERY:
Joomla Extensions