Compile the Bus Pirate firmware

From DP

(Difference between revisions)
Jump to: navigation , search
(Get the code of Community Firmware v7.0 from Github)
(Get the code of Community Firmware v7.0 from Github)
Line 36: Line 36:
* [] - Discussion thread
* [] - Discussion thread
Feedback and patches are welcome!
Your feedback and patches are welcome!
==MPLAB X (Win, Linux, Mac)==
==MPLAB X (Win, Linux, Mac)==

Revision as of 11:31, 19 September 2016

There is also generic guide to compiling PIC projects.


Prepare your build environment

You need to download and install Microchip's IDE called MPLAB X and then MPLAB XC16 compiler. Below I will give an example of how to do it for Linux:

1) Download MPLABX-vVERSION-linux-installer.tar then extract and launch it:

tar -xvf ./MPLABX-vVERSION-linux-installer.tar
sudo ./

Installer needs to be run as root. If it complains about the missing libraries you will need to search and install them (32-bit versions, both "normal" and "development" packages) before trying again. At Fedora I had to install 32-bit versions of libX11-devel, libXau, libXau-devel, libxcb, libxcb-devel, libXect, libXect-devel

2) Download and run installer:

sudo ./

3) (OPTIONAL) Run a following command to get your HostID (if you forgot it) :

/opt/microchip/xc16/vVERSION/bin/xclm -hostinfo

Register and login to website, then go to this page. Write your HostID, choose your OS (Linux) and your product (XC 16), then click "Download". You will get a file, which you need to run under root:

sudo ./

Then launch MPLAB X to see the duration and ending time of your evaluation period

Example of a build environment:

[*] Ubuntu Linux 16.04.1 x64
[*] MPLAB X v3.40
[*] MPLAB XC v1.26 compiler with PRO mode enabled (60 days free evaluation license)
[*] Project Properties -> Conf: [default] -> XC16 (Global Options) -> x16-gcc -> Option Categories: Optimizations -> Optimization Level -> changed from 0 (no opt) to 3 (optimize yet more favoring speed)

Get the code of Community Firmware v7.0 from Github

Get the latest revision of Bus Pirate repository containing Community Firmware v7.0 project by running

git clone

Your feedback and patches are welcome!

MPLAB X (Win, Linux, Mac)

First of all, see the general MPLABX page how to install MPLABX. Then you open MPLAB X, load busPirate.X project, then clean and build it. If everything is correct, you will get a new .hex file in your build directory

You don't need a Microchip programmer to develop firmware for the Bus Pirate. You can use Microchip's free development tools and upload code through the USB bootloader. It's a mini PIC 24F development board!


  1. Open the Bus Pirate project in MPLAB.
  2. Uncomment the correct Bus Pirate hardware version and language in base.h.
  3. Compile the project. You may need to modify the compiler location when prompted, but MPLAB X is getting better about making these changes automatically.

Export for bootloader

Mplab-export 001.png

Updated for v4 bootloader, see Compiling PIC projects for more: The compiled firmware must be exported in order to work with the bootloader.

  1. In MPLAB, go to File->Export...
  2. Make sure that the Program Memory box is checked and the range 0 to 0xa7fa is selected.
  3. Uncheck the Configuration Bits box.
  4. Make sure INHX32 (Intel 32bit HEX) is selected on the File Format tab.
  5. Click OK to export the firmware.

Bootload the firmware following your normal upgrade process.