Thomas Roth's Piodisasm Is the First Disassembler for Raspberry Pi Pico's RP2040 PIO State Machines

Designed for the RP2040's PIO state machines, this disassembler turns hex files back into source code — ready for tweaking.

Security researcher Thomas Roth has published an initial build of a Raspberry Pi RP2040 disassembler, compatible with programs written for the Raspberry Pi Pico and other RP2040-based devices.

Released late last month, the Raspberry Pi Pico is the first - but by no means last — outing for the RP2040 microcontroller, in turn the first-ever in-house silicon to be designed and released by Raspberry Pi. It's generated considerable interest, but while most users are busy writing programs for the chip Roth is taking a different approach: Writing a disassembler.

"If you're wondering 'but why,'" Roth explains, "I find that writing a disassembler for a new architecture really helps you understand every aspect of it!"

The disassembler concentrates on the RP2040's Programmable Input/Output (PIO) state machines, a key feature of the chip's popularity which allow up to eight individual state machines to be written and run simultaneously in order to add new functionality or peripherals missing in hardware.

"Just run piodisasm.py on a file that contains the PIO code as hex," Roth writes of the tool's usage. "Reassembling the generated code should yield a 100% identical hex image!"

The disassembler is a work in progress, with details on IRQ parsing and the arguments required to specify various sidesets and other options still needing some tweaking — but the functional tool, written in Python, is available on Roth's GitHub repository now under the GNU General Public License 3.0.

Gareth Halfacree
Freelance journalist, technical author, hacker, tinkerer, erstwhile sysadmin. For hire: freelance@halfacree.co.uk.
Related articles
Sponsored articles
Related articles