aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2018-10-01 17:14:02 +0200
committerAyke van Laethem <[email protected]>2018-10-01 17:14:33 +0200
commita72d0b795925cb0d20d6c6ef3abb2c9bce01f07c (patch)
tree85575d2ad18d008fc48b4614bdde77f3b15214be /tools
parent4c8a725d78ad975714bf2386b98c556593ba6591 (diff)
downloadtinygo-a72d0b795925cb0d20d6c6ef3abb2c9bce01f07c.tar.gz
tinygo-a72d0b795925cb0d20d6c6ef3abb2c9bce01f07c.zip
tools/gen-device-svd: make sure all clusters are included
This is important for nrf52840, which has UART pin selection in a cluster that wasn't exposed.
Diffstat (limited to 'tools')
-rwxr-xr-xtools/gen-device-svd.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/tools/gen-device-svd.py b/tools/gen-device-svd.py
index 990152748..19e300ee8 100755
--- a/tools/gen-device-svd.py
+++ b/tools/gen-device-svd.py
@@ -132,6 +132,7 @@ def readSVD(path, sourceURL):
'array': dim,
'elementsize': dimIncrement,
})
+ peripheral['registers'].sort(key=lambda r: r['address'])
device.interrupts = sorted(interrupts.values(), key=lambda v: v['index'])
licenseBlock = ''
@@ -282,8 +283,6 @@ const (
regType = 'RegValue'
if 'registers' in register:
- import pprint
- #pprint.pprint(register)
# This is a cluster, not a register. Create the cluster type.
regType = 'struct {\n'
subaddress = register['address']
@@ -291,9 +290,12 @@ const (
subregType = 'RegValue'
if subregister['array']:
subregType = '[{}]{}'.format(subregister['array'], subregType)
- #raise NotImplementedError('array in cluster register')
if subaddress != subregister['address']:
- raise NotImplementedError('gaps in cluster register')
+ numSkip = (subregister['address'] - subaddress) // 4
+ if numSkip == 1:
+ regType += '\t\t_padding{padNumber} RegValue\n'.format(padNumber=padNumber)
+ else:
+ regType += '\t\t_padding{padNumber} [{num}]RegValue\n'.format(padNumber=padNumber, num=numSkip)
if subregister['array'] is not None:
subaddress += subregister['elementsize'] * subregister['array']
else: