johnnydrazzi / USB-uC

USB MSD Bootloader for PIC Microcontrollers
GNU General Public License v3.0
33 stars 9 forks source link

PIC18F25K50 at O2 compile optimization in MPLAB X IDE #6

Open frank9876 opened 2 weeks ago

frank9876 commented 2 weeks ago

I'm using MPLAB X IDE v6.20 with XC8 v2.48. I do not have a compiler license so I cannot compile with -Os. I tried compiling the bootloader for the Pololu P-Star PIC18F25K50. It does not fit in 8K. I can program the pre-compiled hex file - USB_uC_X5K50_P_STAR.hex - and that works. However, I wanted to be able to compile my own binary and the compilation is too large by approximately 120 bytes. After looking at the code, I re-wrote the routine parse_hex in bootloader.c and the compilation now fits in 8K (approx. 8177 bytes). My changes are shown with #if 0/1 in bootloader.c in case anyone else is interested in getting the bootloader to build with the standard MPLAB X IDE. bootloader_c.zip

johnnydrazzi commented 2 weeks ago

Excellent, I’ll take a look when I get the chance and merge your changes.