1.2.3.3 Bootloader Sizing And Considerations
Bootloader Sizes
The example Bootloaders provided have XC32 optimization settings to -O2
However, in terms of size, this option does not produce the most optimal code. Turning on the -Os will reduce the size of the Bootloader.
Note: By default the bootloader size will be rounded off to the nearest erase unit size of the device
Size change considerations
It must be ensured that the user applications memory region does not overlap with the memory region reserved for the Bootloader.
The Bootloader generated by MCC should be considered a starting point for your products Bootloader. As such, adding new features may cause the Bootloader to exceed the default size calculated
If the size of the Bootloader changes, the following steps should be performed to adjust both the Bootloader and the application in order to make sure that both fit and make best use of the device memory
Increase the Bootloader Size in Bootloader MCC config menu to some approximate value and regenerate the code
Determine the new ending address of the Bootloader. This can be done by using either the .map file generated by MPLAB X IDE with the respective Compiler, or by using the ELFViewer plug-in for MPLAB X IDE
Round the size from the map file to the nearest ERASE unit size value
Enter the new value again in Bootloader Size in Bootloader MCC config menu
Change the Application start Address from system settings in both Bootloader and application projects accordingly if it is falling inside bootloader region
Recompile both the Bootloader and the application
If only the Application start address needs to be modified for application then perform following steps:
Change the Application start Address from system settings in both Bootloader and application projects accordingly
Recompile both the Bootloader and the application