Forums

C Compiler comparison for PIC18?

Started by Izak van Langevelde December 3, 2005
Does anyone out there know about a decent c compiler which targets the 
pic18 family? So far, I played with the Sourceboost C compiler and the 
Microchip C18 compiler, I'm happy with none of these, am willing to 
spend some money on something really good, but won't waste my time on 
buying and trying...

-- 
Grinnikend door het leven...
Izak van Langevelde wrote:

> Does anyone out there know about a decent c compiler which targets the > pic18 family? So far, I played with the Sourceboost C compiler and the > Microchip C18 compiler, I'm happy with none of these, am willing to > spend some money on something really good, but won't waste my time on > buying and trying...
It's hard to say without knowing your criteria. What were the problems with the ones your tried? I have been satisfied with HiTech, but it is more expensive. -- Thad
In article <43923d9d$0$226$892e0abb@auth.newsreader.octanews.com>,
 Thad Smith <ThadSmith@acm.org> wrote:

> Izak van Langevelde wrote: > > > Does anyone out there know about a decent c compiler which targets the > > pic18 family? So far, I played with the Sourceboost C compiler and the > > Microchip C18 compiler, I'm happy with none of these, am willing to > > spend some money on something really good, but won't waste my time on > > buying and trying... > > It's hard to say without knowing your criteria.
True, that's why I'm looking for a decent comparison, which addresses things like quality and quantity of code, ansi compliance, ease of use, support.
> What were the problems with the ones your tried? I have been > satisfied with HiTech, but it is more expensive.
The Sourceboost C Compiler has generated incorrect code on several occasions, probably because I declared a variable with a name already in use by the compiler; changing the variable name solved the problem. I cannot trust it. The Microchip C18 compiler seems to have a steep learning curve. For instance, I spend a few days to compile things which worked when compiled from sourceboost, but fail to work through C18. For instance, you have to pin your ISR at the right location in memory yourself, while this is one of the things I'd like to delegate to a compiler/linker. This is not to say C18 doesn't generate correct code, but it takes some effort to get it up and running. -- Grinnikend door het leven...
In article <1133708948.055663.79770@g49g2000cwa.googlegroups.com>,
 mhahn@hvc.rr.com wrote:

> Once you play with PICs for a while you > get used to how they do stuff, but even then you'll get caught when > Microchip does something a little different in a newer version of a > chip.
I heard this more than once: is there any reference available for differences between chip versions? -- Grinnikend door het leven...
Izak van Langevelde wrote:
> In article <43923d9d$0$226$892e0abb@auth.newsreader.octanews.com>, > Thad Smith <ThadSmith@acm.org> wrote: > > > Izak van Langevelde wrote: > > > > > Does anyone out there know about a decent c compiler which targets the > > > pic18 family? So far, I played with the Sourceboost C compiler and the > > > Microchip C18 compiler, I'm happy with none of these, am willing to > > > spend some money on something really good, but won't waste my time on > > > buying and trying... > > > > It's hard to say without knowing your criteria. > > True, that's why I'm looking for a decent comparison, which addresses > things like quality and quantity of code, ansi compliance, ease of use, > support. > > > What were the problems with the ones your tried? I have been > > satisfied with HiTech, but it is more expensive. > > The Sourceboost C Compiler has generated incorrect code on several > occasions, probably because I declared a variable with a name already in > use by the compiler; changing the variable name solved the problem. I > cannot trust it. > > The Microchip C18 compiler seems to have a steep learning curve. For > instance, I spend a few days to compile things which worked when > compiled from sourceboost, but fail to work through C18. For instance, > you have to pin your ISR at the right location in memory yourself, while > this is one of the things I'd like to delegate to a compiler/linker. > This is not to say C18 doesn't generate correct code, but it takes some > effort to get it up and running. > > -- > Grinnikend door het leven...
Yeah all the compilers out there for PICs have a pretty steep learning curve. For me most of the learning was figuring out how to configure all the different IO functions. Once you play with PICs for a while you get used to how they do stuff, but even then you'll get caught when Microchip does something a little different in a newer version of a chip. The C18 compiler (from Microchip) has the advantage of being free if you are only using it for personal use (download the student version). It costs about $500 for commercial use. It is a bit weird to get used to, but generates pretty solid code. The weirdness is mostly due to the harvard architecture of PICs. Compilers that insulate you from that will be making assumptions that may not work all that well for you. For example, the CCS PCH compiler handles tables in ROM differently than C18. PCH always calls a subroutine when accessing constant data. This can really slow down processing done in a loop. C18 on the other hand uses the TBLPTR register directly to access constant data. C18 actually generates code that's both smaller and runs faster than PCH if you are doing something like reading through a table that's stored in ROM. PCH is probably a pretty good choice for PIC novices. The price is around $100. They have lots of library functions to help with setting the chip up. And lots of examples for standard stuff like writing to a LCD display, RS-232 communications, using an external I2C eeprom, etc. But their code is going to be a bit larger than what C18 generates. And some of their IO init functions are order dependent, which if you are a beginner is a real pain to figure out. Follow their examples if you can find one that is sort of like what you want to do. I've done commercial products using the CCS PCH compiler. It's solid enough for that if you keep checking the compiler's output. I've ported some projects to C18 to see how it stacks up. For my next new project I'm leaning toward using C18. Mark
In article <eezacque-79A5A0.11501804122005@news1.news.xs4all.nl>, Izak
van Langevelde <eezacque@xs4all.nl> writes
>In article <43923d9d$0$226$892e0abb@auth.newsreader.octanews.com>, > Thad Smith <ThadSmith@acm.org> wrote: > >> Izak van Langevelde wrote: >> >> > Does anyone out there know about a decent c compiler which targets the >> > pic18 family? So far, I played with the Sourceboost C compiler and the >> > Microchip C18 compiler, I'm happy with none of these, am willing to >> > spend some money on something really good, but won't waste my time on >> > buying and trying... >> >> It's hard to say without knowing your criteria. > >True, that's why I'm looking for a decent comparison, which addresses >things like quality and quantity of code, ansi compliance, ease of use, >support.
ANSI or ISO support? BTW most compilers only go as far as ISO C 90 + A1 and the TC's not to ISO C99 BTW given that you are on a PIC ISO C compliance is almost irrelevant. -- \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ \/\/\/\/\ Chris Hills Staffs England /\/\/\/\/ /\/\/ chris@phaedsys.org www.phaedsys.org \/\/\ \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
In article <WU93mdEnqwkDFAkm@phaedsys.demon.co.uk>,
 Chris Hills <chris@phaedsys.org> wrote:

> In article <eezacque-79A5A0.11501804122005@news1.news.xs4all.nl>, Izak > van Langevelde <eezacque@xs4all.nl> writes > >In article <43923d9d$0$226$892e0abb@auth.newsreader.octanews.com>, > > Thad Smith <ThadSmith@acm.org> wrote: > > > >> Izak van Langevelde wrote: > >> > >> > Does anyone out there know about a decent c compiler which targets the > >> > pic18 family? So far, I played with the Sourceboost C compiler and the > >> > Microchip C18 compiler, I'm happy with none of these, am willing to > >> > spend some money on something really good, but won't waste my time on > >> > buying and trying... > >> > >> It's hard to say without knowing your criteria. > > > >True, that's why I'm looking for a decent comparison, which addresses > >things like quality and quantity of code, ansi compliance, ease of use, > >support. > > ANSI or ISO support?
Tech support, i.e. responsive people who know what they are talking about.
> BTW most compilers only go as far as ISO C 90 + A1 and the TC's not to > ISO C99 > > BTW given that you are on a PIC ISO C compliance is almost irrelevant.
If I write code I appreciate some level of agreement about what it should do, this is where standards come in handy. -- Grinnikend door het leven...
On Sun, 4 Dec 2005 15:26:31 +0000, the renowned Chris Hills
<chris@phaedsys.org> wrote:

>In article <eezacque-79A5A0.11501804122005@news1.news.xs4all.nl>, Izak >van Langevelde <eezacque@xs4all.nl> writes >>In article <43923d9d$0$226$892e0abb@auth.newsreader.octanews.com>, >> Thad Smith <ThadSmith@acm.org> wrote: >> >>> Izak van Langevelde wrote: >>> >>> > Does anyone out there know about a decent c compiler which targets the >>> > pic18 family? So far, I played with the Sourceboost C compiler and the >>> > Microchip C18 compiler, I'm happy with none of these, am willing to >>> > spend some money on something really good, but won't waste my time on >>> > buying and trying... >>> >>> It's hard to say without knowing your criteria. >> >>True, that's why I'm looking for a decent comparison, which addresses >>things like quality and quantity of code, ansi compliance, ease of use, >>support. > >ANSI or ISO support? >BTW most compilers only go as far as ISO C 90 + A1 and the TC's not to >ISO C99 > >BTW given that you are on a PIC ISO C compliance is almost irrelevant.
Well, there is at least one that has 8-bit ints... 8-( Best regards, Spehro Pefhany -- "it's the network..." "The Journey is the reward" speff@interlog.com Info for manufacturers: http://www.trexon.com Embedded software/hardware/analog Info for designers: http://www.speff.com
> I've done commercial products using the CCS PCH compiler. It's solid > enough for that if you keep checking the compiler's output. I've ported > some projects to C18 to see how it stacks up. For my next new project > I'm leaning toward using C18. > > Mark >
Just to add. I have used CCS compilers professionally for a few years and also was considering C18 for future projects. So I ported working CCS code to C18. The fiddly interrupt methodology (where you have to know which registers your ISR is going to use so that you can save them on entry), was a bit of a joke. Hitec & CCS hide you from this (unless you specifically don't want them to). The latest version of the C18 compiler was supposed to address some of the ISR issues. However, they have only gone part of the way which in my opinion is even worse. My Microchip FAE is still looking into a problem where high ISRs corrupt some registers on exit from the high ISR when the high ISR interrupts a low ISR. It has been appeox. 2 months and they are still scratching heads. In some cases the CCS compiler was much better at producing smaller code. I didn't expect this as I have always been of the opinion that the CCS compiler is a bit 'cheasy'. Anyway, at the moment I have decided not to comit to using the C18 compiler until the known issues are fixed. Hitec is similar is many ways to the C18 compiler but with much better C friendly interrupt handling (if you so choose). Hitec has a good reputation and I must say that I have never had any problems with it... ever. My 2p worth = Hitec is best, then CCS, then others. Jim
On 2005-12-04, Izak van Langevelde <eezacque@xs4all.nl> wrote:
> True, that's why I'm looking for a decent comparison, which addresses > things like quality and quantity of code, ansi compliance, ease of use, > support.
I put this together last year: http://www.xargs.com/pic/picc18-vs-c18.html -- John W. Temples, III