I got PIC32 starter kit today. Here are some impressions:
- Comes with eval version of C32 C-compiler with 64KB code size limit. C32 is actually called C32-gcc, so it's a gcc derivative. The source is on the website, but who knows if it's recent or complete.
- Hardware debugging (breakpoints, goto cursor) works in MPLAB on this little board, but I found that sometimes it gets into a mode where it thinks that breakpoints are not supported: "breakpoint limit for hardware is 0" in the breakpoint dialogue. This is fixed if you restart MPLAB. Anyway, you can view both assembly and C source during single-stepping. It's pretty nice.
- You can DBPRINTF over JTAG (and also DBGETS). It's very slow. It was not documented that you had to add a define to make this work for new projects (-DPIC32_START_KIT- add the define in Project->Build Options->Project->C-compiler->Macros). The debug I/O library is not part of the main library- it was just a db_utils.a file (no source) in the StartKitTutorial directory (the "hello world" program).
I had to copy it to the timer interrupt demo program that I wanted to try to get it working. I then had to replace all the UART I/O calls to debug I/O calls. There is no UART interface on the starter board, so they must be designing these demos for some other board (actually they are labs for a course- maybe FAE or early customer training?)
One annoying thing about this form of JTAG I/O (which is not unique to PIC)- it's not a real serial port. When you call DBGETS, a window pops up in MPLAB for you to type a string. This is a modal window, so you can not actually halt the debugger when it is up. So don't put DBGETS in a loop! There is no way to poll for keyboard input. When the DBGETS is waiting for input, the CPU is basically break-point halted, so interrupts stop running.
- This is how you make interrupt handlers:
void __ISR(TIMER_1_VECTOR, ipl2) my_handler(void) { mPORTDToggleBits(BIT_0); // Blink a led mT1ClearIntFlag(); }
And that's about it (set up the timer and EnableIntT1). You do not have to explicity write the my_handler address to a vector, the compiler just does it.
- The IDE needs a little work. There were some screen update glitches when I closed various windows. It core dumped when switching projects. The manual for the C-libraries (particularly the peripherals) is missing.
- On the other hand, things did generally work. You basically hit F10 to compile and F9 to run. It prompts you for downloading the code to the board.
- There are compiler settings for making compressed MIPS 16-bit code (like the ARM thumb code). Both worked. Last time I used MIPS, there was no 16-bit option.
Some notes about the PIC32 CPU:
- Someone complained that the chip has only 16-bit timers: this is not exactly true: timers can be paired up to form single 32-bit timers.
- There is a RTC clock generator (and an RTCC block) on the chip with pins for a 32 KHz crystal.
- There is support for some kind of external trace buffer on the CPU. You must have to buy some special ICE to make use of it.
- The code examples include HTML server on a TCP/IP stack, but they need a board with Microchip's ethernet to SPI interface chip.