In this article, we will describe how to setup an embedded development workflow on Linux targeting the well known PIC 8-bit MCU line from Microchip.

We will first see how to install all the Microchip suite on Linux, then we will develop the mandatory led-blinking example to validate the whole workflow.

This article is (probably) also ok for other 8-bit PIC part numbers.

The PIC12F975

In this example, we are going to compile and flash a custom firmware for the 8-bit MCU PIC12F675. This MCU has a flash memory of 1024 words (of 14 bits each), 64 bytes of RAM and an EEPROM of 128 bytes. It features 6 I/O pins and some timers and analog comparators.


Install Microchip IDE & compiler

We use the Ubuntu Linux distribution in our example (Ubuntu 17.10). Fortunately, Microchip does provide us with a whole IDE & compiler suite that runs on Linux: the compiler is named XC8 and the IDE MPLAB X.

Follow these steps to get both installed on your Linux distribution:

Download MPLAB X IDE from Microchip.

Download the XC8 compiler (for 8 bits MCUs) from Microchip.

Install the 32 bits compatibility libraries if your Linux distribution is 64 bits:

$ sudo dpkg --add-architecture i386
$ sudo apt-get update
$ sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386
$ sudo apt-get install libexpat1-dev:i386
$ sudo apt-get install libx11-6:i386
$ sudo apt-get install libxtst6:i386

Install MPLAB X

$ tar -xf MPLABX-v4.05-linux-installer.tar
$ sudo ./ 
64 Bit, check libraries
Check for 32 Bit libraries
Verifying archive integrity... All good.
Uncompressing MPLAB X v4.05 Installer....

Install the XC8 compiler

$ chmod u+x
$ sudo ./

Reboot your computer for the new udev rules to be executed

$ reboot


$ mplab_ide &

Done! You should see MPLAB X launching itself in a nice GUI window.

Hardware setup

The led-blinking example is the hardware equivalent of the software Hello World: a quick way to validate the whole development workflow.

We use a PIC12F675 along with a 5V power supply and a conventional LED.

Here are the (very simple) schematic:

Led-blinking example

and it physical realisation:

Led-blinking example

Dev, flash and compile your first program!

Now that the hardware part is ready, time to code!

Follow these steps to get your first program ready:

Launch MPLAB X

File -> New Project -> Microchip Embedded -> Standalone Project -> Next.

Select your MCU (here, we select "Mid-Range", then "PIC12F675").

Next -> Next -> Select your programmer (Pickit3 here) then Next

Select your toolchain (XC8 here) -> Next -> Add a project name -> Finish.

On the "Project" tab of the left-hand side panel, right-click on "Source Files" then "New", then "main.c".

Name it whatever you want ("main" ?) then "Finish".

You can now write the code you want to compile. Here is the complete main program we use for led-blinking:

 * File:   main.c
 * Author: Mick Cherry
 * Created on December 18, 2017, 9:00 PM

#include <xc.h>

#pragma config FOSC = INTRCIO   /* Use the PIC internal oscillator */
#pragma config MCLRE = OFF  /* Use GP3/MCLR as GP3 IO */

void delay()    /* A simple for loop for creating a human-compliant delay */
    int counter = 0;
    for (counter = 0; counter < 10000; counter++) {

void main(void)
    TRISIO = 0b001000;  /* Set all the GPIO in output mode except GP3/MCLR as input */

    while(1) {
        GP2 = 1;    /* Set the GP2 pin to 1 */
        GP2 = 0;    /* Set the GP2 pin to 0 */

In order to get a firmware (cross-compiled binary file for the target, here the PIC12F675) inside the PIC flash memory, we need a special piece of hardware: a flasher. Here we use the Microchip Pickit 3 In-Circuit Debugger.

The procedure to connect the Pickit 3 to the PIC is very easy, just connect each of the 5 pins of the Pickit to their respective pins of the PIC12F (check the Pickit 3 pinout on this document).

Pickit connect

Then we just need to hit the "Make and Program Device Main Project" button on MPLAB X to see this on the breadboard:

Led-blinking gif

Yay it's alive!

Cortex-M0+ Bringup // Chapter 1 - Introduction

dim. 24 septembre 2017 by Mick Cherry


This article is the first of a (long) serie that explains in details how to start a small MCU (Cortex-M0+ STM32L053) from scratch.

All the basic aspects of a small mcu bringup will (hopefully) be covered: toolchain, linker script, swd, debugging, uart, ...

The present article is here to list …

read more

Create a simple shared library in C

mar. 29 août 2017 by Mick Cherry

In this post we will see how to create a (very) simple shared library in C.

A shared library is a set of compiled code that can be used by an application without embedding the whole library code inside the final application.

Shared libraries used in a "Hello World!" linux …

read more

Configure multiple SSH keys for different Github accounts

dim. 27 août 2017 by Mick Cherry

This is my first article, so I wanted to start with an easy one :)

You can not add the same SSH key on two different github accounts. So, if you want to work with multiple github accounts on the same computer, you can follow this article!

Creation of SSH keys …

read more

Update the BIOS of a XPS13 running Ubuntu

sam. 26 août 2017 by Mick Cherry

A few days ago I found out that Dell had released a new version for my XPS13 (9360) BIOS.

Here are the steps I followed to update the BIOS (no USB key or wine or Windows boot required \o/).

Dell has a page that explains some of it.

Check BIOS …

read more

Create a simple static library in C

jeu. 17 août 2017 by Mick Cherry

I only recently learned the difference between a static and a dynamic library in C, essentially because I have so far only worked with static libraries - and very few libraries.

This article will only cover a simple example of a static library in C.

The idea of a library (in …

read more

Configure a custom domain name with Pelican and Github Pages

mer. 21 juin 2017 by Mick Cherry

Having a nice Pelican blog hosted on Github Pages is already awesome.

We can make it more awesome by linking it to a cool domaine name (like

This way, your blog will be reached from instead of

Four (or three) steps …

read more

Change the visual theme of your Pelican blog

sam. 10 juin 2017 by Mick Cherry

The Pelican default theme is notmyidea-cms, but there are dozens of themes you can freely use.

Here is how I did it.

In a random folder, get all the Pelican themes

$ cd random_folder
$ git clone --recursive

You can see all the themes names (which are …

read more

Setup a free static blog with Pelican hosted on Github User Pages

ven. 09 juin 2017 by Mick Cherry

The association of Pelican and Github Pages allows for an (almost) easy setup and free-hosted static blog.

There are several Github Pages types. The one I chose to use is names User Pages.

The main steps to setup a new blog are:

  • Install the dev environnment (editor, Pelican generator, tool …
read more