diff options
author | Vegard Storheil Eriksen <zyp@jvnv.net> | 2021-01-22 01:13:44 +0100 |
---|---|---|
committer | Vegard Storheil Eriksen <zyp@jvnv.net> | 2021-01-22 01:13:44 +0100 |
commit | 1a38973eb8fd0f889f7c272e9ef183687034d550 (patch) | |
tree | a673e3eda50ee3ec1edbaf7534fafdd7073d1b47 /interrupt/SConscript | |
parent | 36efee9187390a52a99919b900b8faaea49be928 (diff) |
interrupt: Refactor to be more flexible.
Diffstat (limited to 'interrupt/SConscript')
-rw-r--r-- | interrupt/SConscript | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/interrupt/SConscript b/interrupt/SConscript index c94bde8..05cafb9 100644 --- a/interrupt/SConscript +++ b/interrupt/SConscript @@ -1,18 +1,33 @@ Import('env') +headers = [] +instances = [] sources = [] +aliases = {} -interrupt_controller = env['PLATFORM_SPEC'].get('interrupt_controller') +interrupts = env['PLATFORM_SPEC'].get('interrupt', {}) -exceptions = env['PLATFORM_SPEC'].get('exception', {}) -irqs = env['PLATFORM_SPEC'].get('irq', {}) +env.Jinja2('interrupt_enums.h', 'interrupt_enums.h.j2', interrupts = interrupts) +headers.append('interrupt_enums.h') -env.Jinja2('interrupt_enums.h', 'interrupt_enums.h.j2', exceptions = exceptions, irqs = irqs), +sources.append(env.Jinja2('default_handlers.cpp', 'default_handlers.cpp.j2', interrupts = interrupts)) + +periph = env['PLATFORM_SPEC'].get('periph', {}) + +if 'nvic' in periph: + headers.append('nvic.h') + for name, data in periph['nvic'].items(): + instances.append({ + 'type': 'NVIC_t', + 'name': name, + 'args': [data['offset']], + }) + + aliases['SCB'] = 'NVIC.SCB' + aliases['interrupt_ctl'] = 'NVIC' -if interrupt_controller == 'nvic': sources.extend([ - env.Jinja2('vectors_nvic.cpp', 'vectors_nvic.cpp.j2', exceptions = exceptions, irqs = irqs), - env.Jinja2('default_handlers.cpp', 'default_handlers.cpp.j2', exceptions = exceptions, irqs = irqs), + env.Jinja2('vectors_nvic.cpp', 'vectors_nvic.cpp.j2', interrupts = interrupts), ]) Return('sources') |