Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,325 changes: 1,230 additions & 95 deletions bsp/stm32/libraries/templates/stm32f0xx/.config

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion bsp/stm32/libraries/templates/stm32f0xx/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ msh >

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

STM32 HAL/CMSIS 驱动由软件包提供,首次从模板创建 BSP 或修改配置后,需要先执行该命令下载依赖;如果没有拉取到软件包,请先执行`pkgs --upgrade`更新软件包索引,再重新执行`pkgs --update`。

4. 输入`scons --target=mdk4/mdk5/iar` 命令重新生成工程。

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

维护人:

- [xxx](https://个人主页), 邮箱:<xxx@xxx.com>
- [xxx](https://个人主页), 邮箱:<xxx@xxx.com>
3 changes: 3 additions & 0 deletions bsp/stm32/libraries/templates/stm32f0xx/SConscript
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
# for module compiling
import os
Import('RTT_ROOT')
Import('env')
from building import *

cwd = GetCurrentDir()
objs = []
list = os.listdir(cwd)

env.Append(CPPDEFINES = ['STM32F091xC'])

for d in list:
path = os.path.join(cwd, d)
if os.path.isfile(os.path.join(path, 'SConscript')):
Expand Down
29 changes: 21 additions & 8 deletions bsp/stm32/libraries/templates/stm32f0xx/SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,24 @@ except:
print(RTT_ROOT)
exit(-1)

def bsp_pkg_check():
check_paths = [
os.path.join("packages", "CMSIS-Core-latest"),
os.path.join("packages", "stm32f0_cmsis_driver-latest"),
os.path.join("packages", "stm32f0_hal_driver-latest")
]

need_update = not all(os.path.exists(p) for p in check_paths)

if need_update:
print("\n===============================================================================")
print("Dependency packages missing, please running 'pkgs --update'...")
print("If no packages are fetched, run 'pkgs --upgrade' first, then 'pkgs --update'...")
print("===============================================================================")
exit(1)

RegisterPreBuildingAction(bsp_pkg_check)

TARGET = 'rt-thread.' + rtconfig.TARGET_EXT

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

Export('env')
Export('RTT_ROOT')
Export('rtconfig')

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

SDK_LIB = libraries_path_prefix
Export('SDK_LIB')

# prepare building environment
objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False)

stm32_library = 'STM32F0xx_HAL'
rtconfig.BSP_LIBRARY_TYPE = stm32_library
rtconfig.BSP_LIBRARY_TYPE = None

# include libraries
objs.extend(SConscript(os.path.join(libraries_path_prefix, stm32_library, 'SConscript'), variant_dir='build/libraries/'+stm32_library, duplicate=0))
# include drivers
objs.extend(SConscript(os.path.join(libraries_path_prefix, 'HAL_Drivers', 'SConscript'),variant_dir='build/libraries/'+'HAL_Drivers', duplicate=0))
objs.extend(SConscript(os.path.join(libraries_path_prefix, 'HAL_Drivers', 'SConscript'), variant_dir='build/libraries/HAL_Drivers', duplicate=0))

# make a building
DoBuilding(TARGET, objs)
21 changes: 1 addition & 20 deletions bsp/stm32/libraries/templates/stm32f0xx/board/SConscript
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import os
import rtconfig
from building import *

Import('SDK_LIB')

cwd = GetCurrentDir()

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

startup_path_prefix = SDK_LIB

if rtconfig.PLATFORM in ['gcc']:
src += [startup_path_prefix + '/STM32F0xx_HAL/CMSIS/Device/ST/STM32F0xx/Source/Templates/gcc/startup_stm32f091xc.s']
elif rtconfig.PLATFORM in ['armcc', 'armclang']:
src += [startup_path_prefix + '/STM32F0xx_HAL/CMSIS/Device/ST/STM32F0xx/Source/Templates/arm/startup_stm32f091xc.s']
elif rtconfig.PLATFORM in ['iccarm']:
src += [startup_path_prefix + '/STM32F0xx_HAL/CMSIS/Device/ST/STM32F0xx/Source/Templates/iar/startup_stm32f091xc.s']

# STM32F030x6 || STM32F030x8 || STM32F031x6
# STM32F038xx || STM32F042x6 || STM32F048xx
# STM32F070x6 || STM32F051x8 || STM32F058xx
# STM32F071xB || STM32F072xB || STM32F078xx
# STM32F070xB || STM32F091xC || STM32F098xx || STM32F030xC
# You can select chips from the list above
CPPDEFINES = ['STM32F091xC']
group = DefineGroup('Drivers', src, depend = [''], CPPPATH = path, CPPDEFINES = CPPDEFINES)
group = DefineGroup('Drivers', src, depend = [''], CPPPATH = path)
Return('group')
Loading
Loading