Does GCC support PIC (particularly the problematic PIC16 family)
Asked Answered
C

1

10

Free PIC C compiler
PIC16 C compiler

...aaaaand noone mentions gcc*. Googling lead me only to flame wars over the forums if PICs are suitable for C, and that their (at least the 6 - series) 30 instruction assemblers are very simple to learn.

Does gcc support PIC16?

* - or clang or any other popular open free compiler...if there are any others...

Carroll answered 22/5, 2013 at 11:30 Comment(1)
use sdcc instead. PIC is too ugly for gcc.Standfast
L
12

I don't believe it's supported and none of the PIC families are mentioned on the Status of Supported Architectures page. Note that there is some support for the PIC32 series because that's based on a MIPS M4K core. A few zero-cost options that come to mind are:

  • Microchip have a free version of MPLAB XC8 available. You'll see at the bottom of that page that the difference between the free and the paid versions is the optimization level. I've used the free version and the code generated still seems pretty decent.

  • For open source there is the SDCC - Small Device C Compiler. That supports the PIC16 series and while I've never used personally it seems to be widely recommended.

Lilianaliliane answered 22/2, 2014 at 4:4 Comment(2)
"I've used the free version and the code generated still seems pretty decent." I beg to differ on this point; have you looked at the actual assembly generated by freebie XC8? Lots of obvious optimizations are left out. Of course, "pretty decent" is subjective and it may be good enough for you and OP.Sanskritic
I agree with you especially on the more recent versions since I wrote this, the pro version does have a lot more optimizations. A few years ago I had something where the code generated easily fitted into code space whereas the free one was well over.Lilianaliliane

© 2022 - 2024 — McMap. All rights reserved.