diff options
author | Ron Evans <[email protected]> | 2019-01-19 18:29:21 +0100 |
---|---|---|
committer | Ayke van Laethem <[email protected]> | 2019-01-20 18:40:49 +0100 |
commit | f89c695c8ca527a0a1e5114d86e88bede4a08eeb (patch) | |
tree | ab83f1676c90527bc0b8a10b9b2f30e43711f99f /tools | |
parent | e2be7ccf76ae9f8548394e715193e03ab47c18d6 (diff) | |
download | tinygo-f89c695c8ca527a0a1e5114d86e88bede4a08eeb.tar.gz tinygo-f89c695c8ca527a0a1e5114d86e88bede4a08eeb.zip |
generators: correctly handle clustered subtypes used in Atmel SAMD21 SVD for important peripherals
Signed-off-by: Ron Evans <[email protected]>
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/gen-device-svd.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tools/gen-device-svd.py b/tools/gen-device-svd.py index f5e5c857f..37700dd00 100755 --- a/tools/gen-device-svd.py +++ b/tools/gen-device-svd.py @@ -81,6 +81,15 @@ def readSVD(path, sourceURL): } device.peripherals.append(peripheral) peripheralDict[name] = peripheral + if 'subtypes' in derivedFrom: + for subtype in derivedFrom['subtypes']: + subp = { + 'name': name + "_"+subtype['clusterName'], + 'groupName': subtype['groupName'], + 'description': subtype['description'], + 'baseAddress': baseAddress, + } + device.peripherals.append(subp) continue peripheral = { @@ -89,6 +98,7 @@ def readSVD(path, sourceURL): 'description': description, 'baseAddress': baseAddress, 'registers': [], + 'subtypes': [], } device.peripherals.append(peripheral) peripheralDict[name] = peripheral @@ -108,6 +118,23 @@ def readSVD(path, sourceURL): clusterPrefix = clusterName + '_' clusterOffset = int(getText(cluster.find('addressOffset')), 0) if cluster.find('dim') is None: + if clusterOffset is 0: + # make this a separate peripheral + cpRegisters = [] + for regEl in cluster.findall('register'): + cpRegisters.extend(parseRegister(groupName, regEl, baseAddress, clusterName+"_")) + cpRegisters.sort(key=lambda r: r['address']) + clusterPeripheral = { + 'name': name+ "_" +clusterName, + 'groupName': groupName+ "_" +clusterName, + 'description': description+ " - " +clusterName, + 'clusterName': clusterName, + 'baseAddress': baseAddress, + 'registers': cpRegisters, + } + device.peripherals.append(clusterPeripheral) + peripheral['subtypes'].append(clusterPeripheral) + continue dim = None dimIncrement = None else: |