Repository navigation
Expand file tree
/
Copy pathSConscript
More file actions
40 lines (32 loc) · 1.42 KB
/
Copy pathSConscript
File metadata and controls
40 lines (32 loc) · 1.42 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
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('Source', 'Templates', 'system_stm32wlxx.c')]
# Map microcontroller units (MCUs) to their corresponding startup files
mcu_startup_files = {
'STM32WL55xx': 'startup_stm32wle5xx.s',
'STM32WLE5xx': 'startup_stm32wle5xx.s',
'STM32WL54xx': 'startup_stm32wle4xx.s',
'STM32WLE4xx': 'startup_stm32wle4xx.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('Source', 'Templates', 'gcc', startup_file)]
elif rtconfig.PLATFORM in ['armcc', 'armclang']:
src += [os.path.join('Source', 'Templates', 'arm', startup_file)]
elif rtconfig.PLATFORM in ['iccarm']:
src += [os.path.join('Source', 'Templates', 'iar', startup_file)]
break
# Define the build group
group = DefineGroup('STM32WL-CMSIS', src, depend=['PKG_USING_STM32WL_CMSIS_DRIVER'], CPPPATH=path)
# Return the build group
Return('group')