Bus Pirate: Pirate-Loader for Linux, Mac, Windows upgrades

in Bus Pirate by Ian | 1 comment

See the latest version in the documentation wiki.

This how-to describes the Pirate-Loader console program that uploads new firmware to Bus Pirates with bootloader v4+. Piotr whipped up this easy to use console app with versions for Windows, Linux, and Mac (source). The first release is here, though the latest console app will be included in future firmware upgrade archives.

The ds30 Loader v4 bootloader in the Bus Pirate has a GUI update application that works on Windows (.NET), Linux, and Mac (Mono), but it presents problems on some systems and many users would prefer not to install .net or Mono. If you don’t like the GUI updater, now you can use this simple command line application instead.

A demonstration of the Pirate-Loader update utility follows.

To upgrade with the console utility, you’ll need:

Remember: Pirate-Loader is only compatible with bootloader v4+!

Step 1. Trigger the bootloader

There are two ways to trigger the bootloader for an upgrade.

The old way is to place a jumper between the PGC and PGD pins before plugging in the USB cable. Plug it in, the MODE LED will light indicating that the bootloader is active.

HiZ>$
BOOTLOADER

In firmware v4.1+ you can just type $ at the Hi-Z mode prompt. The Bus Pirate will reset into bootloader mode without a jumper. Remember to turn off your terminal to free the serial port before proceeding.

Step 2. Load the firmware

Copy the firmware file and Pirate-Loader app for your platform into a folder. Get to your system command prompt and change to the folder.

C:\pl>pirate-loader --dev=COM10 --hex=BPv3-Firmware-v4.1.hex
+++++++++++++++++++++++++++++++++++++++++++
+ Pirate-Loader for BP with Bootloader v4 +
+++++++++++++++++++++++++++++++++++++++++++
Parsing HEX file [BPv3-Firmware-v4.1.hex]
Found 21503 words (64509 bytes)
Fixing bootloader/userprogram jumps
Opening serial device COM10...OK
Configuring serial port settings...OK
Sending Hello to the Bootloader...OK
Device ID: PIC24FJ64GA002 [d4]
Bootloader version: 1,02
Erasing page 0, 0000...OK
Writing page 0 row 0, 0000...OK
Writing page 0 row 1, 0080...OK
...
Writing page 41 row 335, a780...OK
Firmware updated successfully!
Use screen COM10 115200 to verify
C:\pl>

For most upgrades, type “pirate-loader –dev=X –hex=Y” at the command console. X is the Bus Pirate port name on your system, Y is the firmware file name to load. Pirate-Loader will output a short notice for each bootloader operation.

Step 3. Remove the jumper and reset the Bus Pirate

Now remove the jumper (if used), and reset the Bus Pirate by removing and attaching the USB cable. The firmware update is complete.

Connect to the Bus Pirate with a terminal program and press ‘i’ to verify the firmware version.

Notes: Console configuration options

* --help (display a help screen)
* --dev (specify the Bus Pirate port)
* --hello (check for bootloader only, requires reset afterward)
* --hex (specify the firmware file to load)
* --verbose (show additional details about the flash process)
* --simulate (test load process without sending data to the Bus Pirate)

Pirate-Loader supports these switches.

C:\pl>pirate-loader --help
 +++++++++++++++++++++++++++++++++++++++++++
 + Pirate-Loader for BP with Bootloader v4 +
 +++++++++++++++++++++++++++++++++++++++++++
pirate-loader usage:
./pirate-loader --dev=/path/to/device --hello
 ./pirate-loader --dev=/path/to/device --hex=/path/to/hexfile.hex [ --verbose
 ./pirate-loader --simulate --hex=/path/to/hexfile.hex [ --verbose
C:\pl>

–help shows usage examples.

C:\pl>pirate-loader --dev=COM10 --hello
+++++++++++++++++++++++++++++++++++++++++++
+ Pirate-Loader for BP with Bootloader v4 +
+++++++++++++++++++++++++++++++++++++++++++
Opening serial device COM10...OK
Configuring serial port settings...OK
Sending Hello to the Bootloader...OK
Device ID: PIC24FJ64GA002 [d4]
Bootloader version: 1,02
C:\pl>

–dev sets the Bus Pirate port. COMx is used on Windows, Linux and Mac may have a name like /dev/tty.usbserial-A111aAAA.

–hello checks if the bootloader is alive and responding. You’ll need to reset the Bus Pirate before attempting another bootloader connection after a –hello check.

C:\pl>pirate-loader --dev=COM10 --hex=BPv3-Firmware-v4.1.hex
+++++++++++++++++++++++++++++++++++++++++++
+ Pirate-Loader for BP with Bootloader v4 +
+++++++++++++++++++++++++++++++++++++++++++
Parsing HEX file [BPv3-Firmware-v4.1.hex]
Found 21503 words (64509 bytes)
Fixing bootloader/userprogram jumps
Opening serial device COM10...OK
Configuring serial port settings...OK
Sending Hello to the Bootloader...OK
Device ID: PIC24FJ64GA002 [d4]
Bootloader version: 1,02
Erasing page 0, 0000...OK
Writing page 0 row 0, 0000...OK
Writing page 0 row 1, 0080...OK
...
Writing page 41 row 335, a780...OK
Firmware updated successfully!
Use screen COM10 115200 to verify
C:\pl>

–hex specifies the firmware file to load. It will print a progress report of each page erased and each row read.

–simulate displays the burn process output but doesn’t send anything to the Bus Pirate.

–verbose shows the actual data sent for each write operation.

This entry was posted in Bus Pirate and tagged , , .

Comments

  1. Ian says:

    Sorry about the formatting problems. I think they’re fixed now.

Leave a Comment

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Notify me of followup comments via e-mail. You can also subscribe without commenting.