m32c

Getting the sources

Tool First Released Last Changes
gcc 4.1 svn "trunk"
binutils 2.17 cvs "head"
newlib 1.14 cvs "head"
gdb 6.5 cvs "head"

Building the sources

$(srcdir)/configure --target=m32c-elf

gcc option gas option MCU family pointer size data space code space
-mcpu=r8c --m16c R8C 16 bits 64 Kb 64 Kb
-mcpu=m16c --m16c M16C 16 bits 64 Kb 1 Mb
-mcpu=m32cm --m32c M16C/8x 24 bits 16 Mb 16 Mb
-mcpu=m32c --m32c M32C 24 bits 16 Mb 16 Mb

Note that int is 16 bits, long is 32 bits, and size_t (i.e. max size of structures and arrays) is 16 bits (because making it bigger would result in much slower code).

I have a comprehensive testsuite for m32c GAS which tests about 844,000 individual opcode patterns. A summary of the results is available, so you can see which opcodes aren't yet supported. (it's not yet part of the distributed testsuite because the exploded sources are over 20 Mb)

Random Utilities and Stuff

In my dealings with these chips, I've had to come up with many ways to program them - serial lines, USB chips, and one case of an embedded ARM device programming five embedded R8C devices. Since I do all of this under Linux, I've had many people ask me how I do it. Here's how: I recently added a patch to gcc (it'll be in 4.6) to support Renesas's SFR.h files for their chips. There's some caveats - it only works in C, and you have to convert the syntax from 1234H to 0x1234. I use this perl script (you'll have to rename it and make it executable) like this:
    sfr-ren-to-gcc renesas/sfr_r81B.h > gcc/sfr_r8c_1b.h

Vendor support

Unofficial patches

These are patches that I have not yet been able to get approved for the official FSF source tree, for one reason or another.
gcc-reload1.c.patch
This is an old patch which addresses the fact that the m32c family only has two general purpose address registers (A0 and A1), yet sometimes needs three. It attempts to group reloads together to share one of the registers across two of the reloads, reducing the need to only two address registers. If you get a compiler error along the lines of "Unable to find register in class A_REGS" or "Unable to find spill register in class A_REGS", you might need this patch.