1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
Import('env')
headers = []
instances = []
sources = []
aliases = {}
interrupts = env['PLATFORM_SPEC'].get('interrupt', {})
env.Jinja2('interrupt_enums.h', 'interrupt_enums.h.j2', interrupts = interrupts)
headers.append('interrupt_enums.h')
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'
sources.extend([
env.Jinja2('vectors_nvic.cpp', 'vectors_nvic.cpp.j2', interrupts = interrupts),
])
if 'clic' in periph:
headers.append('clic.h')
for name, data in periph['clic'].items():
instances.append({
'type': 'CLIC_t',
'name': name,
'args': [data['offset']],
})
aliases['interrupt_ctl'] = 'CLIC'
sources.extend([
File('dispatch_clic.cpp'),
env.Jinja2('vectors_clic.cpp', 'vectors_clic.cpp.j2', interrupts = interrupts),
])
env.Jinja2('interrupt.h', '../templates/periph_instances.h.j2', headers = headers, instances = instances, aliases = aliases)
Return('sources')
|