mumbel / ghidra

Ghidra is a software reverse engineering (SRE) framework

Home Page:https://www.nsa.gov/ghidra

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Peripheral register definitions

esaulenka opened this issue · comments

Please add register definitions for supported MCUs.

For example, it can be converted from XML files (I found it here: https://github.com/Hailong89/K2SAR_EMS/tree/master/02_Build/01_Compile/01_Tasking_4p3/cpcp/include/sfr ) with this simplest script:

#!/usr/bin/python

import xml.etree.ElementTree as ET

# output
#       <!-- I2C Registers -->
#           <symbol name = "I2CIFG"  address = "RAM:0051"    entry = "false"/>

root = ET.parse('regtc1724.xml').getroot()

for group in root.iter('{http://www.tasking.com/schema/sfrfile/v1.0}group'):
    group_name = group.get('name')
    group_desc = group.get('description')
    if not group_desc: group_desc = ''

    # print group.tag, group.attrib, group_name
    print '\t\t<!-- %s %s -->' % (group_name, group_desc)

    for sfr in group.iter('{http://www.tasking.com/schema/sfrfile/v1.0}sfr'):
        # print sfr.tag, sfr.attrib
        name = sfr.get('name')
        addr = sfr.get('address')
        desc = sfr.get('description')

        print '\t\t\t<symbol name = "%s"\taddress = "%s"\tentry = "false"/>' % (name, addr)

That's awesome, will look into it soon

@esaulenka I didnt add the low address values since those are in the .sinc file, may need to look into that later. but for now hopefully this is what you were looking for, those files are great, thanks for the link to them.
cde75b5