MicroPython & pic32

After getting MicroPython to run on Pico]OS in MSP432 Launchpad environment, there was a next step I absolutely had to take: See if the same system would work on Microchip PIC32.

I’m using the free version of XC32 compiler, which comes with it’s own runtime library. It is rather complete, ie. has stdio streams with similar idea for low-level device integration as newlib has on Arm environments. But to simplify things for now, I left file input/output out from the build.

After compiling with -O1 the resulting binary size is:

text     rodata    data   bss     dec      hex   filename
148960   28736     220    7324    185240   2d398 mp-test.elf

The free XC32 version doesn’t allow optimization with -O2, so the resulting binary is larger than it could be with a proper compiler.

Unfortunately I have currently only PIC32 chips with 128 Kb of flash available now, so this won’t fit into them. But MPLAB X has a simulator, which can be used to run the resulting binary. And here it is:

PicPython

I’ll have to get some bigger PIC32MX chips to try this out with real hardware. I think that PIC32MX270F256B might be a nice choice, it has 256 Kb of flash and 64 Kb of ram and is available in DIP28 package!