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
|
Import('env')
headers = []
instances = []
sources = []
aliases = {}
periph = env['PLATFORM_SPEC'].get('periph', {})
if 'rcc' in periph:
buses = env['PLATFORM_SPEC']['periph']['rcc']['RCC']['bus']
env.Jinja2('rcc_enums.h', 'rcc_enums.h.j2', buses = buses)
headers.append('rcc_methods.h')
headers.append('rcc_reg.h')
for name, data in periph['rcc'].items():
instances.append({
'type': 'RCC_t<RCC_reg_%s_t>' % data['type'],
'name': name,
'args': [data['offset']],
})
sources.extend([
File('rcc.cpp'),
File('flash.cpp'),
])
env.Jinja2('rcc.h', '../templates/periph_instances.h.j2', headers = headers, instances = instances, aliases = aliases)
headers = []
instances = []
aliases = {}
if 'stm32_flash' in periph:
headers.append('flash_methods.h')
headers.append('stm32_flash.h')
for name, data in periph['stm32_flash'].items():
instances.append({
'type': 'STM32_FLASH_t<STM32_FLASH_reg_%s_t>' % data['type'],
'name': name,
'args': [data['offset']],
})
env.Jinja2('flash.h', '../templates/periph_instances.h.j2', headers = headers, instances = instances, aliases = aliases)
Return('sources')
|