Using the SDCC (Small Device C Compiler) is a greate way to fit more code into smaller Microchip PIC parts (Such as the PIC12F/PIC16F series) of microcontrollers.
Having used the XC8 compiler for these parts in free mode, taking a look at the generated assembly will reveal alot of wasted moving of variables to the w register. This is simply to encourage people to upgrade and purchase the compiler. Having used the Pro version of the compiler at work it does indeed optimise these wasted statements away, and further optimises the code in some often interesting ways.
By using SDCC however you always get clean and consistent code that is a pleasure to work with.
My IDE of choice is Code::Blocks, having orginally used it for some simple SDL games engines I have found it invaluable when working on console programs, ARM procjects, AVR projects and now PIC projects.
To setup Code::Blocks to work with the SDCC compiler, we need to download and install the following:
Code::Blocks IDE: We don’t need the integrated MingW compiler, but you may find it usefull for other programming tasks
SDCC: You can grab the latest Binary from http://sourceforge.net/projects/sdcc/files/
GPUTILS: You can grab the latest binary from http://sourceforge.net/projects/gputils/files/
Install each of the above programs making a note of where each program has been installed to.
Once Complete, run the code::blocks IDE:
The next set of settings are specific to the processor you will be using.
SDCC splits the microchip PIC series into PIC14 (PIC12F/16F) and PIC16(PIC18F).
Click File > New > Project and select Empty Project then follow the instructions. Make sure to deselect Debug
Using your programmer (I have the PICKIT3 and the MPLAB IPE) program the hex file to your PIC and you are done.