From e4e17c36d008de98d7a30232565eb5b725989c10 Mon Sep 17 00:00:00 2001 From: Bob McWhirter Date: Tue, 27 Jul 2021 13:46:17 -0400 Subject: [PATCH] Handle NVICs in multi-core chips. --- parse.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/parse.py b/parse.py index b9a5afc..8af5883 100755 --- a/parse.py +++ b/parse.py @@ -643,6 +643,11 @@ def parse_chips(): # print("Got", len(chip['cores']), "cores") for core in chip['cores']: core_name = core['name'] + + if (chip_nvic + '-' + core_name) in chip_interrupts: + # if there's a more specific set of irqs... + chip_nvic = chip_nvic + '-' + core_name + if not core_name in h['interrupts'] or not core_name in h['defines']: core_name = 'all' #print("Defining for core", core_name) @@ -1086,11 +1091,21 @@ chip_interrupts = {} def parse_interrupts(): print("parsing interrupts") - for f in glob('sources/cubedb/mcu/IP/NVIC-*_Modes.xml'): - ff = removeprefix(f, 'sources/cubedb/mcu/IP/NVIC-') + for f in glob('sources/cubedb/mcu/IP/NVIC*_Modes.xml'): + ff = removeprefix(f, 'sources/cubedb/mcu/IP/NVIC') ff = removesuffix(ff, '_Modes.xml') + chip_irqs = {} r = xmltodict.parse(open(f, 'rb')) + + if ff.startswith('1') or ff.startswith('2'): + ff = removeprefix(ff, '1') + ff = removeprefix(ff, '2') + core = corename(next(filter(lambda x: x['@Name'] == 'CoreName', r['IP']['RefParameter']))['@DefaultValue']) + ff = ff + "-" + core + + ff = removeprefix(ff, '-') + irqs = next(filter(lambda x: x['@Name'] == 'IRQn', r['IP']['RefParameter'])) for irq in irqs['PossibleValue']: value = irq['@Value']