[sdiy] Quick C query

Eric Brombaugh ebrombaugh1 at cox.net
Mon Nov 22 15:44:22 CET 2010


On Nov 22, 2010, at 3:17 AM, Neil Johnson wrote:
>> Phillip, thanks for a very interesting post. Regarding optimizations,
>> isn't Tom's MCU supported by some sort of gcc-based toolchain?
> 
> GCC is pretty good these days.  Since they moved over to SSA for the
> internal representation there are many many more optimisations that
> are possible.

The C compiler for the dsPIC (Tom's MCU in this case) is based on GCC with some proprietary optimizations added on. Unfortunately, MCHP has intertwined GCC with their own non-free material to such an extent that it's very difficult to create an OSS/Free distribution of dsPIC GCC. Tom Sailer did this a few years ago and posted the build instructions here:

http://www.baycom.org/~tom/dspic/

but it's a fairly complex process, and extremely dated at this point. The upshot of course is that unless you're willing to fork out ~$1k for MCHP's version you won't have access to the highest levels of optimization (they do allow -O1 for free), and the optimizations that are available in the OSS/Free versions of GCC are out of the question unless you're a compiler geek and capable of updating the dsPIC GCC sources yourself.

The good news is that for most stuff the free 1st-level optimization is fairly good. I've tried the higher levels during the 60-day trial period and they haven't provided a significant reduction in code size or speed on my test cases.

Eric


More information about the Synth-diy mailing list