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.

Report an outdated entry Suggest a translation fix

Primary sources

  1. README.md GitHub · leveldown-security/SVD-Loader-Ghidra · Revision 4b21fa5
  2. SVD-Loader.py GitHub · leveldown-security/SVD-Loader-Ghidra · Revision 4b21fa5
  3. SVD-Loader.py#L84-L105 GitHub · leveldown-security/SVD-Loader-Ghidra · Revision 4b21fa5
  4. SVD-Loader.py#L131-L201 GitHub · leveldown-security/SVD-Loader-Ghidra · Revision 4b21fa5
  5. cmsis_svd/__init__.py GitHub · leveldown-security/SVD-Loader-Ghidra · Revision 4b21fa5
  6. LICENSE GitHub · leveldown-security/SVD-Loader-Ghidra · Revision 4b21fa5

More in Firmware and hardware

All 29 entries in Firmware and hardware