Tool
SVD-Loader for Ghidra
Ghidra script from leveldown security that reads a CMSIS-SVD file, the XML format describing a microcontroller's memory-mapped peripherals and their registers, and applies it to firmware already loaded in Ghidra. It creates memory blocks for the peripheral address ranges, a structure type for each peripheral with its registers as fields, and a label at each peripheral base address, so register accesses can be read by peripheral and register name. It targets little-endian Arm Cortex-M devices and bundles a fork of the cmsis-svd parser ported to Ghidra's Jython.
Requirements & limits
- The repository has no releases or tags. The reviewed master head is a 2024-02-01 merge that expanded the installation instructions; the last code changes, merged on 2023-03-04, added error handling to the script and fixed derivedFrom handling for peripherals in the bundled parser. The README names no supported Ghidra release, a 2019 commit fixed compatibility with Ghidra 9.1, and the repository has no tests.
- It runs inside Ghidra's CodeBrowser: add the cloned repository as a script directory in the Script Manager, then run SVD-Loader.py on the open program. The script is written for Ghidra's Jython environment, and it imports the bundled cmsis_svd package (version 0.4) from the same directory.
- Supply the CMSIS-SVD file for the target chip, which the README suggests taking from the cmsis-svd collection or a Keil software pack, and the firmware image already imported into Ghidra. The script stops on an SVD that declares a big-endian CPU and warns but continues when the CPU is not a Cortex-M. Peripheral ranges that conflict with existing memory blocks are reported and skipped.
- Only peripherals and registers are applied: the generated memory blocks are uninitialized, volatile and read/write, and register bit fields, enumerated values and interrupts from the SVD are not added. Results depend on the supplied SVD file; when a block or structure cannot be created, the script prints the failure and moves on.
- SVD-Loader.py is GPL-3.0; the forked cmsis_svd/ code keeps upstream cmsis-svd's Apache-2.0 license. The blog post the README links for usage details returned HTTP 404 at review. The script was not run in Ghidra.
About this entry
- Type
- Tool
- Category
- Firmware tools
- Relationship
- Foundation tool
- Targets
- Firmware
Sources reviewed
The description was reviewed against primary sources. This does not establish runtime testing, security auditing or verified compatibility.
Primary sources
- README.md GitHub · leveldown-security/SVD-Loader-Ghidra · Revision 4b21fa5
- SVD-Loader.py GitHub · leveldown-security/SVD-Loader-Ghidra · Revision 4b21fa5
- SVD-Loader.py#L84-L105 GitHub · leveldown-security/SVD-Loader-Ghidra · Revision 4b21fa5
- SVD-Loader.py#L131-L201 GitHub · leveldown-security/SVD-Loader-Ghidra · Revision 4b21fa5
- cmsis_svd/__init__.py GitHub · leveldown-security/SVD-Loader-Ghidra · Revision 4b21fa5
- LICENSE GitHub · leveldown-security/SVD-Loader-Ghidra · Revision 4b21fa5
More in Firmware and hardware
- ThinkPad IMX471: recovering camera tuning for Linux · Case study
- flipper-telink: replacement firmware for Tuya Zigbee remotes · Case study
- Supermodel: initial Real3D Pro-1000 image-generator emulation · Case study
- OpenDMCUFirm: a reimplemented Wii U DMCU display firmware · Case study
- reflecticon-224: running Lexicon 224 reverb firmware on emulated hardware · Case study
- TeddyCloud: a self-hosted replacement for the Toniebox cloud · Case study