Skip to content

Commit c96551a

Browse files
CYFS3Rbb666
authored andcommitted
[bsp][stm32]:update templates files
1 parent 2f992bd commit c96551a

70 files changed

Lines changed: 16873 additions & 1817 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

bsp/stm32/libraries/templates/stm32f0xx/.config

Lines changed: 1230 additions & 95 deletions
Large diffs are not rendered by default.

bsp/stm32/libraries/templates/stm32f0xx/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ msh >
108108

109109
3. 输入`pkgs --update`命令更新软件包。
110110

111+
STM32 HAL/CMSIS 驱动由软件包提供,首次从模板创建 BSP 或修改配置后,需要先执行该命令下载依赖;如果没有拉取到软件包,请先执行`pkgs --upgrade`更新软件包索引,再重新执行`pkgs --update`
112+
111113
4. 输入`scons --target=mdk4/mdk5/iar` 命令重新生成工程。
112114

113115
本章节更多详细的介绍请参考 [STM32 系列 BSP 外设驱动使用教程](../docs/STM32系列BSP外设驱动使用教程.md)
@@ -120,4 +122,4 @@ msh >
120122

121123
维护人:
122124

123-
- [xxx](https://个人主页), 邮箱:<xxx@xxx.com>
125+
- [xxx](https://个人主页), 邮箱:<xxx@xxx.com>

bsp/stm32/libraries/templates/stm32f0xx/SConscript

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
# for module compiling
22
import os
33
Import('RTT_ROOT')
4+
Import('env')
45
from building import *
56

67
cwd = GetCurrentDir()
78
objs = []
89
list = os.listdir(cwd)
910

11+
env.Append(CPPDEFINES = ['STM32F091xC'])
12+
1013
for d in list:
1114
path = os.path.join(cwd, d)
1215
if os.path.isfile(os.path.join(path, 'SConscript')):

bsp/stm32/libraries/templates/stm32f0xx/SConstruct

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,24 @@ except:
1515
print(RTT_ROOT)
1616
exit(-1)
1717

18+
def bsp_pkg_check():
19+
check_paths = [
20+
os.path.join("packages", "CMSIS-Core-latest"),
21+
os.path.join("packages", "stm32f0_cmsis_driver-latest"),
22+
os.path.join("packages", "stm32f0_hal_driver-latest")
23+
]
24+
25+
need_update = not all(os.path.exists(p) for p in check_paths)
26+
27+
if need_update:
28+
print("\n===============================================================================")
29+
print("Dependency packages missing, please running 'pkgs --update'...")
30+
print("If no packages are fetched, run 'pkgs --upgrade' first, then 'pkgs --update'...")
31+
print("===============================================================================")
32+
exit(1)
33+
34+
RegisterPreBuildingAction(bsp_pkg_check)
35+
1836
TARGET = 'rt-thread.' + rtconfig.TARGET_EXT
1937

2038
DefaultEnvironment(tools=[])
@@ -31,6 +49,7 @@ if rtconfig.PLATFORM in ['iccarm']:
3149
env.Replace(ARFLAGS = [''])
3250
env.Replace(LINKCOM = env["LINKCOM"] + ' --map rt-thread.map')
3351

52+
Export('env')
3453
Export('RTT_ROOT')
3554
Export('rtconfig')
3655

@@ -41,19 +60,13 @@ if os.path.exists(SDK_ROOT + '/libraries'):
4160
else:
4261
libraries_path_prefix = os.path.dirname(SDK_ROOT) + '/libraries'
4362

44-
SDK_LIB = libraries_path_prefix
45-
Export('SDK_LIB')
46-
4763
# prepare building environment
4864
objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False)
4965

50-
stm32_library = 'STM32F0xx_HAL'
51-
rtconfig.BSP_LIBRARY_TYPE = stm32_library
66+
rtconfig.BSP_LIBRARY_TYPE = None
5267

53-
# include libraries
54-
objs.extend(SConscript(os.path.join(libraries_path_prefix, stm32_library, 'SConscript'), variant_dir='build/libraries/'+stm32_library, duplicate=0))
5568
# include drivers
56-
objs.extend(SConscript(os.path.join(libraries_path_prefix, 'HAL_Drivers', 'SConscript'),variant_dir='build/libraries/'+'HAL_Drivers', duplicate=0))
69+
objs.extend(SConscript(os.path.join(libraries_path_prefix, 'HAL_Drivers', 'SConscript'), variant_dir='build/libraries/HAL_Drivers', duplicate=0))
5770

5871
# make a building
5972
DoBuilding(TARGET, objs)
Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
import os
2-
import rtconfig
32
from building import *
43

5-
Import('SDK_LIB')
6-
74
cwd = GetCurrentDir()
85

96
# add general drivers
@@ -15,21 +12,5 @@ CubeMX_Config/Src/stm32f0xx_hal_msp.c
1512
path = [cwd]
1613
path += [cwd + '/CubeMX_Config/Inc']
1714

18-
startup_path_prefix = SDK_LIB
19-
20-
if rtconfig.PLATFORM in ['gcc']:
21-
src += [startup_path_prefix + '/STM32F0xx_HAL/CMSIS/Device/ST/STM32F0xx/Source/Templates/gcc/startup_stm32f091xc.s']
22-
elif rtconfig.PLATFORM in ['armcc', 'armclang']:
23-
src += [startup_path_prefix + '/STM32F0xx_HAL/CMSIS/Device/ST/STM32F0xx/Source/Templates/arm/startup_stm32f091xc.s']
24-
elif rtconfig.PLATFORM in ['iccarm']:
25-
src += [startup_path_prefix + '/STM32F0xx_HAL/CMSIS/Device/ST/STM32F0xx/Source/Templates/iar/startup_stm32f091xc.s']
26-
27-
# STM32F030x6 || STM32F030x8 || STM32F031x6
28-
# STM32F038xx || STM32F042x6 || STM32F048xx
29-
# STM32F070x6 || STM32F051x8 || STM32F058xx
30-
# STM32F071xB || STM32F072xB || STM32F078xx
31-
# STM32F070xB || STM32F091xC || STM32F098xx || STM32F030xC
32-
# You can select chips from the list above
33-
CPPDEFINES = ['STM32F091xC']
34-
group = DefineGroup('Drivers', src, depend = [''], CPPPATH = path, CPPDEFINES = CPPDEFINES)
15+
group = DefineGroup('Drivers', src, depend = [''], CPPPATH = path)
3516
Return('group')

0 commit comments

Comments
 (0)