Bus Pirate v4 and pirate loader (only firmware updates)

From DP

Jump to: navigation , search



Obtain a firmware .hex file

There are two ways of getting the firmware .hex files:

If you are downloading, it is important to check the file checksums! For example:

sha1sum ./package_latest_18092016.zip
unzip package_latest_18092016.zip
cd ./Bus_Pirate/
sha1sum ./package_latest/BPv3/*
cat ./package_latest/BPv3/SHA1_checksums.txt
sha1sum ./package_latest/BPv4/bootloader/*
cat ./package_latest/BPv4/bootloader/SHA1_checksums.txt
sha1sum ./package_latest/BPv4/combined/*
cat ./package_latest/BPv4/combined/SHA1_checksums.txt
sha1sum ./package_latest/BPv4/firmware/*
cat ./package_latest/BPv4/firmware/SHA1_checksums.txt

About the optimization levels:

- 0 - Do not optimize. The compiler’s goal is to reduce the cost of compilation and to make debugging produce the expected results
- 1 - Optimize. Optimizing compilation takes somewhat longer, and a lot more host memory for a large function. The compiler tries to reduce code size and execution time
- 2 - Optimize even more. The compiler performs nearly all supported optimizations that do not involve a space-speed trade-off
- s - Optimize yet more favoring size (superset of O2)
- 3 - Optimize yet more favoring speed (superset of O2)

Even on level 3 my BPv4 passes a self test successfully, no errors. So you could try a stronger optimization first, and then - if it is causing you some issues - you tell us about them on Github and meanwhile could use a lighter optimization version (such as level 1)

Prepare a pirate-loader

  • For Linux:
cd ./BPv4-bootloader/pirate-loader
cmake CMakeLists.txt
cmake .

  • For Windows:

you can use a pre-compiled binary:


If you want to compile from source, figure it out by yourself (headers of pirate-loader.c files have the contradicting instructions)

Short PGC and PGD of ICSP header

Bpv4-bootloader.jpg You could use:

  • Jumper (if you have soldered the pins)
  • Any small metal piece like not-covered paperclip
  • Short piece of 1P wire with removed insulation - pass it through the PGC and PGD holes, then tie in a knot to make sure there is a reliable contact

If you are not using jumper, make sure that metal piece/wire size is not too big, to eliminate the chance of it shortening the other parts of BPv4 and causing a hardware failure

Connect a Bus Pirate v4

Plug in the USB cable.

  • Windows:

Bus Pirate would appear as a USB-CDC (CDC-ACM) serial device. You may need to install the following driver in order for it to work:


To find a serial port number, open a Device Manager

  • Linux:

Bus Pirate would appear as /dev/ttyACMx. To determine x look at your kernel log:


Upload the firmware

  • Windows:
pirate-loader.exe --dev=COMx --hex=bp4.0-fw-7.0.hex

  • Linux:
sudo ./pirate-loader --dev=/dev/ttyACMx --hex=bp4.0-fw-7.0.hex

The new firmware will be installed to the Bus Pirate. If some regions would be skipped, that is fine (really???). After it installs, reset the Bus Pirate by replugging the USB cable or pressing "Reset" button. Congratulations, you should be good to go! Happy pirating!

Skipped regions

Erasing page 169, 2a400...OK
Writing page 169 row 1352, 2a400...OK
Writing page 169 row 1353, 2a480...OK
Writing page 169 row 1354, 2a500...OK
Writing page 169 row 1355, 2a580...OK
Writing page 169 row 1356, 2a600...OK
Writing page 169 row 1357, 2a680...OK
Writing page 169 row 1358, 2a700...OK
Writing page 169 row 1359, 2a780...OK
Erasing page 170, 2a800...OK
Writing page 170 row 1360, 2a800...(SKIPPED by bootloader)...OK
Writing page 170 row 1361, 2a880...(SKIPPED by bootloader)...OK
Writing page 170 row 1362, 2a900...(SKIPPED by bootloader)...OK

The new firmware is copied to the Bus Pirate. Some regions are skipped, that is fine! (really???)