Compile the Bus Pirate firmware

From DP

(Difference between revisions)
Jump to: navigation , search
m (MPLAB X (Win, Linux, Mac))
m (Prepare your build environment)
Line 5: Line 5:
'''1)''' Download ''MPLABX-vVERSION-linux-installer.tar'' then extract and launch it:
'''1)''' Download ''MPLABX-vVERSION-linux-installer.tar'' then extract and launch it:
-
  tar -xvf ./MPLABX-vVERSION-linux-installer.tar
+
  tar -xvf ./MPLABX-v'''VERSION'''-linux-installer.tar
-
  sudo ./MPLABX-v3.40-linux-installer.sh
+
  sudo ./MPLABX-v'''VERSION'''-linux-installer.sh
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
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 ''xc16-vVersion-full-install-linux-installer.run'' installer:
+
'''2)''' Download and run ''xc16-vVERSION-full-install-linux-installer.run'' installer:
-
  sudo ./xc16-vVersion-full-install-linux-installer.run
+
  sudo ./xc16-v'''VERSION'''-full-install-linux-installer.run
'''3)''' '''(OPTIONAL)'''
'''3)''' '''(OPTIONAL)'''
Run a following command to get your HostID (if you forgot it) :
Run a following command to get your HostID (if you forgot it) :
-
  /opt/microchip/xc16/vVERSION/bin/xclm -hostinfo
+
  /opt/microchip/xc16/v'''VERSION'''/bin/xclm -hostinfo
Register and login to [http://www.microchip.com/myMicrochip/ website], then go to [http://www.microchip.com/MPLABXCEvaluationLicense this page]. Write your HostID, choose your OS (Linux) and your product (XC 16), then click "Download". You will get a ''YOURHOSTID-xc16-demo.sh'' file, which you need to run under root:
Register and login to [http://www.microchip.com/myMicrochip/ website], then go to [http://www.microchip.com/MPLABXCEvaluationLicense this page]. Write your HostID, choose your OS (Linux) and your product (XC 16), then click "Download". You will get a ''YOURHOSTID-xc16-demo.sh'' file, which you need to run under root:
-
  sudo ./YOURHOSTID-xc16-demo.sh
+
  sudo ./'''YOURHOSTID'''-xc16-demo.sh
Then launch MPLAB X to see the duration and ending time of your evaluation period
Then launch MPLAB X to see the duration and ending time of your evaluation period
Line 25: Line 25:
  '''[*]''' MPLAB XC v1.26 compiler with PRO mode enabled (60 days free evaluation license)
  '''[*]''' 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)
  '''[*]''' 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 code of Community Firmware v7.0 from Github==

Revision as of 13:55, 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 ./MPLABX-vVERSION-linux-installer.sh

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 xc16-vVERSION-full-install-linux-installer.run installer:

sudo ./xc16-vVERSION-full-install-linux-installer.run


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 YOURHOSTID-xc16-demo.sh file, which you need to run under root:

sudo ./YOURHOSTID-xc16-demo.sh

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 https://www.github.com/BusPirate/Bus_Pirate.git


Your feedback and patches are welcome!

MPLAB X (Win, Linux, Mac)

Repository contains the following MPLABX project files:

./BPv4-bootloader/firmware-v1/bpv4-bootloader.X
./Firmware/busPirate.X


Firmware project file is universal, while a bootloader project file is only for Bus Pirate v4 .

1) Open a desired project file with MPLAB X:

File -> Open project -> ...


2) If this project is a firmware, you need to choose a configuration that matches your device:

Run -> Project configuration -> Bus Pirate v3 or v4
(depends on for what device you want to build) ^


3) (OPTIONAL) Right click on a project, then go through the menus to choose the optimization level:

Project Properties -> Conf: ... -> XC16 (Global Options) -> xc16-gcc -> Option categories: Optimizations -> Opimization Level

Note: this option is available only if you got 60 days of PRO evaluation from Microchip

4) Clean and build - press this button to build a project

5) The primary result of project build is a .hex file.

    Bootloader:
./BPv4-bootloader/firmware-v1/bpv4-bootloader.X/dist/default/production/bpv4-bootloader.X.production.hex
     Firmware:
./Firmware/busPirate.X/dist/BusPirate_v4/production/busPirate.X.production.hex
./Firmware/busPirate.X/dist/BusPirate_v4/production/busPirate.X.production.hex

After you obtain the results of your build, install the recently compiled firmware/bootloader using this guide