leveldown-security / SVD-Loader-Ghidra

GNU General Public License v3.0
480 stars 98 forks source link

Supporting Bit Packing #12

Open marsfan opened 3 years ago

marsfan commented 3 years ago

Ghidra supports bit packed bytes for structs. This can allow labeling of the individual bits in the register. Since SVD files already contain this info, this can be used to add additional detail to the register mapping when disassembling, reducing need to reference a datasheet.

I would be happy to implement this myself, but I will not be able to for a couple of weeks. I wanted to add this as a report so that I have a personal reminder of it.

Edit: Here is an example of a bit packed struct for the USB_CNTR register on the STM32L100R8 ![image](https://user-images.githubusercontent.com/9311953/118569020-e77be580-b72d-11eb-96d2-fa858f0d1e44.png)
redfast00 commented 1 year ago

@marsfan I would be very interested in this feature, but I'm a bit discouraged by https://github.com/NationalSecurityAgency/ghidra/issues/647: since the decompiler can't handle bitfields yet, will adding this be useful for reverse engineers?