Programming PIC under Ubuntu

Microcontroller Topics
Post Reply
User avatar
Shane
Captain
Captain
Posts: 226
Joined: Sun Jul 19, 2009 9:59 pm
Location: Jönköping, Sweden

Programming PIC under Ubuntu

Post by Shane » Tue Jan 03, 2012 1:29 am

I was looking for a method to program a PIC under Ubuntu and here is the way to do it. No, you don't need MPLab :)

First we will have to install following tools.
  1. gputils – a collection of tools for the Microchip (TM) PIC microcontrollers. It includes gpasm, gplink and gplib.
  2. sdcc – small device C compiler
  3. piklab – an integrated development environment (IDE) for applications based on Microchip PIC and dsPIC microcontrollers similar to the MPLAB environment. It integrates with several compiler and assembler toolchains. It supports the most common programmers (serial, parallel, ICD2, Pickit2, Picstart+), the ICD2 debugger, and several bootloaders (Tiny, Pickit2 and Picdem).
The installation that I will describe here was only tested in a 64 bit architecture but I will provide the links for a 32 bit architecture as well. If you try it then please let me know if it works or not in order to update this “How To”.
So, let’s start by installing the most easy stuff.
  1. Install Alien. Alien is a program that converts between the rpm, dpkg, stampede slp, and slackware tgz file formats. If you want to use a package from another distribution other than the one you have installed, you can use alien to convert it. Since piklab is a kde application and there is no deb package available for Ubuntu Oneiric, we’ll have to convert a rpm package to deb.

    Code: Select all

    sudo apt-get install alien
  2. Install sdcc and gputils

    Code: Select all

    sudo apt-get install sdcc
    sudo apt-get install gputils
  3. Install piklab and its dependencies. Some of the required dependencies have to be downloaded manually from launchpad, since they are not available through synaptic or apt-get. If you are running an amd64 architecture run the following commands

    Code: Select all

    sudo apt-get install kdelibs5-data
    wget http://launchpadlibrarian.net/68040450/kdelibs-data_3.5.10.dfsg.1-5ubuntu2_all.deb
    sudo dpkg -i kdelibs-data_3.5.10.dfsg.1-5ubuntu2_all.deb
    sudo apt-get install libqt3-mt
    wget http://launchpadlibrarian.net/68496910/libavahi-qt3-1_0.6.30-0ubuntu2_amd64.deb
    sudo dpkg -i libavahi-qt3-1_0.6.30-0ubuntu2_amd64.deb
    wget http://launchpadlibrarian.net/35160268/liblua50_5.0.3-4_amd64.deb
    sudo dpkg -i liblua50_5.0.3-4_amd64.deb
    wget http://launchpadlibrarian.net/35160270/liblualib50_5.0.3-4_amd64.deb
    sudo dpkg -i liblualib50_5.0.3-4_amd64.deb
    wget http://launchpadlibrarian.net/68040034/kdelibs4c2a_3.5.10.dfsg.1-5ubuntu2_amd64.deb
    sudo dpkg -i kdelibs4c2a_3.5.10.dfsg.1-5ubuntu2_amd64.deb
    Otherwise if you are running a 32-bit system run the following commands

    Code: Select all

    sudo apt-get install kdelibs5-data
    wget http://launchpadlibrarian.net/68040450/kdelibs-data_3.5.10.dfsg.1-5ubuntu2_all.deb
    sudo dpkg -i kdelibs-data_3.5.10.dfsg.1-5ubuntu2_all.deb
    sudo apt-get install libqt3-mt
    wget http://launchpadlibrarian.net/68495846/libavahi-qt3-1_0.6.30-0ubuntu2_i386.deb
    sudo dpkg -i libavahi-qt3-1_0.6.30-0ubuntu2_i386.deb
    wget http://launchpadlibrarian.net/35166252/liblua50_5.0.3-4_i386.deb
    sudo dpkg -i liblua50_5.0.3-4_i386.deb
    wget http://launchpadlibrarian.net/35166254/liblualib50_5.0.3-4_i386.deb
    sudo dpkg -i liblualib50_5.0.3-4_i386.deb
    wget http://launchpadlibrarian.net/68040451/kdelibs4c2a_3.5.10.dfsg.1-5ubuntu2_i386.deb
    sudo dpkg -i kdelibs4c2a_3.5.10.dfsg.1-5ubuntu2_i386.deb
    If, for some reason, the wget links stop working, here are the launchpad pages to check for newer versions:
    https://launchpad.net/ubuntu/oneiric/+p ... elibs-data
    https://launchpad.net/ubuntu/oneiric/+p ... vahi-qt3-1
    https://launchpad.net/ubuntu/oneiric/+package/liblua50
    https://launchpad.net/ubuntu/oneiric/+p ... iblualib50
    https://launchpad.net/ubuntu/oneiric/+p ... delibs4c2a

    Now let’s download an rpm version of piklab, convert it to a .deb package and install it (this is for 64-bit. check the update below for 32-bit)

    Code: Select all

    wget http://download.opensuse.org/repositories/Education/openSUSE_11.3/x86_64/piklab-0.15.10-6.5.x86_64.rpm
    sudo alien piklab-0.15.10-6.4.x86_64.rpm
    sudo dpkg -i piklab_0.15.10-7.4_amd64.deb
    For 32-bit

    Code: Select all

    sudo apt-get -f install
    get http://download.opensuse.org/repositories/Education/openSUSE_11.3/i586/piklab-0.15.10-6.4.i586.rpm
    sudo alien piklab-0.15.10-6.4.i586.rpm
    sudo dpkg -i piklab_0.15.10-7.4_i386.deb
(Optional) After this process, if you want you can run the following command to clean up some unused packages that may have been installed;

Code: Select all

sudo apt-get autoremove
And that’s it. By now piklab should be available in your unity menu. You can also type “piklab” in your console to open it. Setup your programmer and projects in piklab and you’re ready to do some cool stuff with your PIC MCUs.
Post Reply

Return to “Microcontrollers”