CPIK Project Page


CPIK (the C compiler for PIC18 devices) is now released under GPL licence.
CPIK V0.5 is an easy to use, near ANSI C compiler which is fully integrated with PikDev. This project is still in progress but the current version is perfectly usable (from Pikdev or from command-line interpreter).

Contributors for this project are Welcome - please read the documentation for details about how to contribute.

Roadmap:

  • V0.6 Support for IEEE-754 floating point numbers
  • V0.7 Optimizer improvement
  • V0.8 Libraries

See here the PDF documentation.

Contact: Drop me an email here


What is new:

-in version 0.5.0 (Sienna)

  • Full support for 32 bit signed and unsigned integers
  • Rewritten support for side-effect operators such as +=, *=, etc.

-in version 0.4.1 (release 1 & 2) (Alain Bashung)

  • Bug fix in return statement: please upgrade !
  • Bug fix when passing arrays as function parameters
  • New tutorial about LCD display support and A/D conversion
  • Totally rewritten support for static entities initialization: initialization of static structs and unions is now supported, initializer expressions containing constant symbolic data are supported
  • Bug fix when compiling a malformed expression (r 2) please upgrade !
  • Bug fix in sizeof operator when applied to undeclared variable (r 2)
  • Array size specified by a constant expression (ie: 1+2*3) is now supported (r 2)

-in version 0.4.0 (Barcelona)

  • ANSI compliant support for struct and union
  • Many code optimizer improvements
  • Comes with a simple tutorial dedicated to beginners

CPIK tutorial: The tutorial is now provided as a separate PDF file .
It includes schematics and C source code. This code can be downloaded separatly as a compressed archive

I strongly encourage people who intend to switch to PIC18 and/or C language to read this tutorial. PIC18 devices represent a huge improvement compared to their 16F counterpart, and are not really much more expensive. The C language is really flexible and powerful, so it is a pity that people continue to write assembly code although this is generally not necessary.

Distribution:

CPIK is distribued in two tarballs:

  1. The binary version is sufficient to develop C code for PIC. It contains the compiler itself, a run-time library, some specialized libraries, headers and documentation. Most libraries have been developped for testing purpose, so they are not very versatile. As I do not have enough time to do everything, new or better libraries are welcome.
  2. The source version is useful if you plan to contribute to the compiler, or just want to rebuild the application from source. This code is released under GPL license. See below installation details.

Caution: If you plan to build the compiler from source code, you must also install the precompiled binary package, because the source package does not contain neither libraries nor devices specific headers.

Don't forget to download and install PiKdev version >= 1.1.0 which have support for cpik C projects and PicKit2 USB programmer.

Debian/Ubuntu users can install cpik directly from .deb package.

CPIK 0.5.0-1 (full support for 32 bit integers)
Debian bin package for debian-like distro cpik_0.5.0-1_i386.deb
Tarball (precompiled binary) cpik-0.5.0-1-bin.tar.gz
Tarball (source code) cpik-0.5.0-1-src.tar.gz
CPIK 0.4.1-2 (minor bug fixes+minor improvement)
Debian bin package for debian-like distro cpik_0.4.1-2_i386.deb
Tarball (precompiled binary) cpik-0.4.1-2-bin.tar.gz
Tarball (source code) cpik-0.4.1-2-src.tar.gz
CPIK 0.4.1-1 (very important bug fixes+full support of static initializers)
Debian bin package for debian-like distro cpik_0.4.1-1_i386.deb
Tarball (precompiled binary) cpik-0.4.1-1-bin.tar.gz
Tarball (source code) cpik-0.4.1-1-src.tar.gz
CPIK 0.4.0 (support for struct and union)
Debian bin package for debian-like distro cpik_0.4.0-2_i386.deb
Tarball (precompiled binary) cpik-0.4.0-2-bin.tar.gz
Tarball (source code) cpik-0.4.0-2-src.tar.gz
CPIK 0.3
Debian bin package for debian-like distro (minor .deb fix) cpik_0.3-3_i386.deb
RPM bin package for Red Hat-like distro (tested FC9 only) cpik-0.3-3.i386.rpm
Debian bin package for debian-like distro cpik_0.3-2_i386.deb
Tarball (precompiled binary, fix RTL and installation issues) cpik-0.3-2-bin.tar.gz
Tarball (precompiled binary) cpik-0.3-bin.tar.gz
Tarball (source code) cpik-0.3-src.tar.gz

INSTALLATION OF PRECOMPILED BINARY FROM TARBALL

  • Unpack the archive
    tar xzvf cpik-[version]-bin.tar.gz
    
  • Go to cpik directory
    cd cpik[version]
    
  • Become root
    su
    Password: [root passwd]
    
  • Run the installation script
    ./cpik-install
  • Return to user mode
    exit
  • Read the documentation located in the doc directory of binary distribution.
    A tutorial is also available at the same location.

  • Run PiKdev and configure it for cpik (the only thing to do is to configure the path to cpik : /usr/bin/cpik), then create a new C project : enjoy!

INSTALLATION OF PRECOMPILED BINARY FROM DEBIAN ARCHIVE
  • Use dpkg tool
    su
    Password: [root passwd]
    dpkg -i cpik[version].deb
    
  • or kpackage graphic tool (from KDE suite)

BUILD FROM SOURCE CODE

  • Unpack the archive
    tar xzvf cpik-[version]-src.tar.gz
    
  • Go to cpik directory
    cd cpik
    
  • Generate the Makefile (you need the qmake utility, from Qt toolkit)
    qmake -o Makefile cpik[version].pro (version should be 04x for v0.4.x)
    
  • Build the application
    make
  • become root
    su
    Password: [root passwd]
    
  • install the executable in proper directory
    make install
    
  • Return to user mode
    exit