Author Topic: Microchip C Compilers - which free compiler do you use?  (Read 22718 times)

0 Members and 1 Guest are viewing this topic.

Offline andygTopic starter

  • Regular Contributor
  • *
  • Posts: 59
  • Country: au
    • gock.net
Microchip C Compilers - which free compiler do you use?
« on: July 04, 2011, 09:09:25 am »
Hi

I would like to get into using PIC MCUs. I have mainly used AVR in the past using avr-gcc which is free.

I was wondering what people are using out there with regards to PIC compilers which are free. From what I can see:

MPLAB C - doesn't work for PIC12/16, but for the other devices it supports, some optimisations are crippled after 60 days
HiTech C - free version has crippled optimisations
CCS - not free

What do you guys use? Are you paying, or just live with the crippled features? Is the disabled optimisations versions still okay for general projects?

Andy
 

Online oPossum

  • Super Contributor
  • ***
  • Posts: 1415
  • Country: us
  • Very dangerous - may attack at any time
Re: Microchip C Compilers - which free compiler do you use?
« Reply #1 on: July 04, 2011, 02:38:47 pm »
I recommend beginning with the 16 bit PIC (24H/24F/30F/33F series). The GCC derived compiler for those parts that is part of MPLAB is much more like AVRGCC than any of the compilers for the 8 bit PICs.

The Microstick is a nice low cost way to get stared with the 16 bit PICs. It has an integrated programmer and debugger, so you don't need any additional hardware to get started.
 

Offline cyberfish

  • Regular Contributor
  • *
  • Posts: 240
  • Country: gb
Re: Microchip C Compilers - which free compiler do you use?
« Reply #2 on: July 04, 2011, 04:45:25 pm »
Is there a specific reason you want to switch to PIC?

For free tools, AVR is much better. I used SDCC for PIC before, but it's fairly limited and buggy. According to friend that's a PIC assembly expert, it also generates very un-optimal code.

If you want more power, ARM (ARM7/ARM9/Cortex) is another platform with great open source tools.
 

Offline Nermash

  • Frequent Contributor
  • **
  • Posts: 257
Re: Microchip C Compilers - which free compiler do you use?
« Reply #3 on: July 04, 2011, 08:46:16 pm »
I have used Hitech free version for 12F and 16F pics, and I am currently working with C18 trial compiler on 18F2685 chip, mainly due to the fact that Microchip TCP IP stack natively supports it.

Both are fine for me, altough I sometimes hit syntax limitations in these compilers,probably  being "spoiled" with C++ uni education :)

For me personally free version of both are fine, I tend to lean toward Hitech, but that's just because I started with it in the first place. IMHO, for general type of personal projects I would recomend free versions, optimisations come in to play with big number theory, penny saving and micromanagement.
 

Offline johnmx

  • Frequent Contributor
  • **
  • Posts: 285
  • Country: pt
Re: Microchip C Compilers - which free compiler do you use?
« Reply #4 on: July 04, 2011, 09:26:07 pm »
I use the following compilers:
PIC10/12: MPASM (Assembler)
PIC16: HI-TECH
PIC18: MPLAB C18
PIC24: MPLAB C30
PIC32: MPLAB C32

The only issue I have with the free limited versions is when I want to compile the bootloader program for some micros.

If I need a fully optimized (for speed or time execution) function, I write it in assembly.
Best regards,
johnmx
 

Offline cyberfish

  • Regular Contributor
  • *
  • Posts: 240
  • Country: gb
Re: Microchip C Compilers - which free compiler do you use?
« Reply #5 on: July 04, 2011, 09:30:21 pm »
Optimization is helpful because it allows us to write easily readable code and leave it to the compiler for low level optimizations.

Eg. without optimizations, you'll have to write multiplications and divisions by powers of 2 as shifts, if you want them to execute in reasonable time (and code space). No need to worry about that if you have optimization, because all modern compilers are smart enough to do that for you.

Other examples include loop unrolling, and function inlining. They all make the code very ugly if you want to optimize in C by hand.

That's why I would not use a non-optimizing compiler. Clean code is easy to read, easy to maintain, and easy to spot bugs in.
 

Offline bxs

  • Regular Contributor
  • *
  • Posts: 89
  • Country: 00
Re: Microchip C Compilers - which free compiler do you use?
« Reply #6 on: July 04, 2011, 10:04:09 pm »
*For me, 8bit:

- Baseline Architecture (PIC10, PIC12, PIC16) -> ASM

- Mid-Range Architecture (PIC12, PIC16) -> ASM / HI-TECH C

- Enhanced Mid-Range Architecture (PIC12FXXX, PIC16F1XX) -> HI-TECH C

- PIC18 Architecture (PIC18) -> MPLAB C18

*For 16bit and 32bit -> MPLAB C compilers.

For personal use, free versions are fine.

In case of PIC32 you can also look at CHIPKIT:
http://www.microchip.com/chipkit
https://github.com/chipKIT32/chipKIT32-MAX/downloads
http://www.chipkit.org/forum/
 

Offline RCMR

  • Frequent Contributor
  • **
  • Posts: 405
Re: Microchip C Compilers - which free compiler do you use?
« Reply #7 on: July 05, 2011, 04:46:24 am »
I use the Hitech C for PIC16 work and the Microchip C18 for PIC18 work.

Both are perfectly adequate but I do like the libraries in the Hitech compiler -- can save a bit of time when compared to using C18.

As for the AVR vs PIC debate -- fortunately much of the difference in CPU architecture is hidden when you're using C so it becomes somewhat moot.

PICs are cheap and plentiful and there's a wonderful underlying consistency within each family, Atmel's processors can become pretty hard to find at times.

However, it's horses for courses and the bottom line is -- it's all good!
 

Offline andygTopic starter

  • Regular Contributor
  • *
  • Posts: 59
  • Country: au
    • gock.net
Re: Microchip C Compilers - which free compiler do you use?
« Reply #8 on: July 05, 2011, 07:34:59 am »
Thanks,

Its interesting to see what people are using.

@cyberfish: I'm not really "switching", just wanted to learn a different MCU and I know PIC is pretty popular. Plus I liked the fact you could debug your program with the PicKit. I'll look at the ARM Cortex based MCUs too.

Not sure what do do yet. Just wanted to learn some PIC but not willing to pay $$$ for a compiler yet. But it sounds like the free limited optmisation versions might be okay to use.
 

Offline cyberfish

  • Regular Contributor
  • *
  • Posts: 240
  • Country: gb
Re: Microchip C Compilers - which free compiler do you use?
« Reply #9 on: July 05, 2011, 08:55:46 am »
Debugging with PicKit is definitely a very big advantage. Cortex has that, too. JTAG programming + debugging with a $30 dongle (or build your own, which is essentially just a FTDI breakout board).

I think PICs have better/more peripherals compared to AVR, but for free toolchain, AVR is definitely the way to go.

avrgcc is state of the art official compiler, that's free and open source. Doesn't get much better than that. ARM is similar.

If you just want to try another MCU, I think ARM would be a good idea because of the better open source tools (GCC/GDB), and it's also more "different".
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf