How to setup a PIC microcontroller development environment in Ubuntu 11.10 Oneiric Ocelot with piklab + sdcc
Hi! In this blog entry I’ll show you how to setup a development environment to develop and compile code for Microchip’s PIC microcontrollers. We’ll need three main packages:
- gputils – a collection of tools for the Microchip (TM) PIC microcontrollers. It includes gpasm, gplink and gplib.
- sdcc – small device C compiler
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”. This tutorial has been tested and worked in Ubuntu 11.10 and 12.04. Probably works in 12.10 too.
So, let’s start by installing the most easy stuff.
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.
sudo apt-get install alien
Install sdcc and gputils
sudo apt-get install sdcc sudo apt-get install gputils
Install piklab and its dependencies. Some of the required dependencies have to be downloaded manually from launchpad, since they are not avaliable through synaptic or apt-get. If you are running an amd64 architecture run the following commands
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.debOtherwise if you are running a 32-bit system run the following commands
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.debIf, for some reason, the wget links stop working, here are the launchpad pages to check for newer versions:
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)
wget http://www.opensuse-education.org/download/test/11.3/suse/x86_64/piklab-0.15.10-6.1.x86_64.rpm sudo alien piklab-0.15.10-6.1.x86_64.rpm sudo dpkg -i piklab_0.15.10-7.1_amd64.deb
Update (9/12/12): Since the repositories occasionally change I decided to host the packages myself. Below you can download both the .rpm or a .deb that I generated in my computer.
Update (14/11/11): Blog reader Ben tried to install in Ubuntu 32-bit and pointed out that for this version you have to fix some unmet dependencies and install a different piklab package
sudo apt-get -f install wget http://www.opensuse-education.org/download/test/11.3/suse/i586/piklab-0.15.10-6.1.i586.rpm sudo alien piklab-0.15.10-6.1.i586.rpm sudo dpkg -i piklab_0.15.10-7.1_i386.deb
(Thanks Ben )
Update (9/12/12): Since the repositories occasionally change I decided to host the packages myself. Below you can download the .rpm. (I couldn’t generate a deb package since my computer’s architecture is amd64.)
(Optional) After this process, if you want you can run the following command to clean up some unused packages that may have been installed
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.
Later I’ll add another tutorial on how to setup a basic project and upload your code to the PIC MCUs using the Tiny Bootloader interface.
Update (12/12/11): Thanks to the reader Hasan Yavuz, the links for the new versions of piklab in opensuse have been updated. Thanks Hasan!
Update (12/01/12): The tutorial on how to use Piklab with Tiny Bootloader is now available here. Check it out! 😉
Update (09/12/12): The links for the piklab packages have been updated since the previous ones had been deleted from the repositories. Thanks to blog reader Phillip Toone for letting me know that the old ones have expired.
Did you find this post helpful? Do you wish to contribute to other projects regarding computer science, electronics, robotics or mechatronics that will be posted in this blog? If you wish to do so, you can donate via paypal using the button below. Thanks!