Maybe my google kung-fu is not strong enough, but I couldn't find a decent disassembler for the Raspberry Pi 3. All that I've found (binutils, LLVM, Capstone) were huge, full of dependencies, most of them incomplete and difficult to use. Neither really suitable for a bare metal project.
So I've written one. It's really lightweight (less than 128k), yet it supports all ARMv8.2 instructions. It is as easy to integrate and use as it gets: a single C header file with only one function, licensed under MIT license.
You pass the address of the instruction and a pre-allocated buffer. The function returns the address of the next instruction, and writes the zero terminated disassembled string into the buffer using only sprintf(). Really simple.
Code: Select all
#include <aarch64.h> // include the architecture to use addr = disasm(uint64_t addr, char *str);
Writing the disassembler was easy. On the other hand I've spent 2 weeks with copying the instruction table out of that dull DDI0487 documentation. It took me endless hours often late at night. Although I've double checked it, there's a chance that I might mixed up some (possibly vector) arguments. If you find any error with the disassembly, please check the instruction table text file, and let me know. I'll fix it right away.