forked from STMicroelectronics/cmsis-device-l4
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSConscript
More file actions
60 lines (53 loc) · 2.34 KB
/
SConscript
File metadata and controls
60 lines (53 loc) · 2.34 KB
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
52
53
54
55
56
57
58
59
60
from building import *
import os
# Import environment variables
Import('env')
# Get the current working directory
cwd = GetCurrentDir()
# Initialize include paths and source files list
path = [os.path.join(cwd, 'Include')]
src = [os.path.join(cwd, 'Source', 'Templates', 'system_stm32l4xx.c')]
# Map microcontroller units (MCUs) to their corresponding startup files
mcu_startup_files = {
'STM32L412xx': 'startup_stm32l412xx.s',
'STM32L422xx': 'startup_stm32l422xx.s',
'STM32L431xx': 'startup_stm32l431xx.s',
'STM32L432xx': 'startup_stm32l432xx.s',
'STM32L433xx': 'startup_stm32l433xx.s',
'STM32L442xx': 'startup_stm32l442xx.s',
'STM32L443xx': 'startup_stm32l443xx.s',
'STM32L451xx': 'startup_stm32l451xx.s',
'STM32L452xx': 'startup_stm32l452xx.s',
'STM32L462xx': 'startup_stm32l462xx.s',
'STM32L471xx': 'startup_stm32l471xx.s',
'STM32L475xx': 'startup_stm32l475xx.s',
'STM32L476xx': 'startup_stm32l476xx.s',
'STM32L485xx': 'startup_stm32l485xx.s',
'STM32L486xx': 'startup_stm32l486xx.s',
'STM32L496xx': 'startup_stm32l496xx.s',
'STM32L4A6xx': 'startup_stm32l4a6xx.s',
'STM32L4P5xx': 'startup_stm32l4p5xx.s',
'STM32L4Q5xx': 'startup_stm32l4q5xx.s',
'STM32L4R5xx': 'startup_stm32l4r5xx.s',
'STM32L4R7xx': 'startup_stm32l4r7xx.s',
'STM32L4R9xx': 'startup_stm32l4r9xx.s',
'STM32L4S5xx': 'startup_stm32l4s5xx.s',
'STM32L4S7xx': 'startup_stm32l4s7xx.s',
'STM32L4S9xx': 'startup_stm32l4s9xx.s',
}
# Check each defined MCU, match the platform and append the appropriate startup file
cpp_defines_tuple = env.get('CPPDEFINES', [])
cpp_defines_list = [item[0] if isinstance(item, tuple) else item for item in cpp_defines_tuple]
for mcu, startup_file in mcu_startup_files.items():
if mcu in cpp_defines_list:
if rtconfig.PLATFORM in ['gcc', 'llvm-arm']:
src += [os.path.join(cwd, 'Source', 'Templates', 'gcc', startup_file)]
elif rtconfig.PLATFORM in ['armcc', 'armclang']:
src += [os.path.join(cwd, 'Source', 'Templates', 'arm', startup_file)]
elif rtconfig.PLATFORM in ['iccarm']:
src += [os.path.join(cwd, 'Source', 'Templates', 'iar', startup_file)]
break
# Define the build group
group = DefineGroup('STM32L4-CMSIS', src, depend=['PKG_USING_STM32L4_CMSIS_DRIVER'], CPPPATH=path)
# Return the build group
Return('group')