From 70830cd9da2c74c5881af18b677a9d6fdfbadf71 Mon Sep 17 00:00:00 2001 From: Ron Evans Date: Wed, 28 Nov 2018 10:27:09 +0100 Subject: tools: correct error generating board files that calculated the address incorrectly after a cluster type Signed-off-by: Ron Evans --- tools/gen-device-svd.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'tools') diff --git a/tools/gen-device-svd.py b/tools/gen-device-svd.py index f823d3400..dcfd3a2da 100755 --- a/tools/gen-device-svd.py +++ b/tools/gen-device-svd.py @@ -293,6 +293,7 @@ const ( padNumber += 1 regType = 'RegValue' + lastCluster = False if 'registers' in register: # This is a cluster, not a register. Create the cluster type. regType = 'struct {\n' @@ -320,13 +321,18 @@ const ( regType += '\t\t_padding{padNumber} RegValue\n'.format(padNumber=padNumber) else: regType += '\t\t_padding{padNumber} [{num}]RegValue\n'.format(padNumber=padNumber, num=numSkip) + else: + lastCluster = True regType += '\t}' + address = subaddress if register['array'] is not None: regType = '[{}]{}'.format(register['array'], regType) out.write('\t{name} {regType}\n'.format(name=register['name'], regType=regType)) # next address - if register['array'] is not None: + if lastCluster is True: + lastCluster = False + elif register['array'] is not None: address = register['address'] + register['elementsize'] * register['array'] else: address = register['address'] + register['elementsize'] -- cgit v1.2.3