chipKIT® Development Platform

Inspired by Arduino™

Bootloaders and MPLAB X

Created Sat, 03 Dec 2011 08:05:03 +0000 by Jacob Christ

Jacob Christ

Sat, 03 Dec 2011 08:05:03 +0000

I'm playing with the bootloader code and I'm trying to figure out where the macro BMXPFMSZ is defined. I'm assuming it is done by the compiler.

Found my own answer before I posted... Its a register in the PIC32 uC that indicates FLASH Size... Very cool...


Jacob Christ

Sat, 03 Dec 2011 08:13:14 +0000

Huh, this got me to thinking... A board I built that is based on the Uno32 didn't work with the default bootloader when I installed a 64K chip since its compiled for a 128K chip. Instead I had to recompile the bootloader for the smaller chip. But since the BMXPFMSZ register keep track of the size of the flash this should not be necessary.

As I think about this I'm getting confused.

In the bootloader, the flash size is stored in a macro FLASH_BYTES which is based on BMXPFMSZ. If BMXPFMSZ is a register in the PIC32 as described in Section 3. Memory Organization of the PIC32 users manual then you shouldn't be able to used it in a macro definition unless its hard coded in some header file that gets picked at compile time.

Anyway, I guess what I'm getting at is it would be nice if you didn't need to recompile for different chip memory sizes in the same family.