添加rtconfig.py注释
parent
c4b476e0ac
commit
cb8aeba653
|
@ -54,6 +54,7 @@ Export('SDK_LIB')
|
|||
# prepare building environment
|
||||
objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False)
|
||||
|
||||
# 设置stm32驱动库路径
|
||||
stm32_library = 'STM32F1xx_HAL'
|
||||
rtconfig.BSP_LIBRARY_TYPE = stm32_library
|
||||
|
||||
|
|
11
rtconfig.py
11
rtconfig.py
|
@ -1,13 +1,15 @@
|
|||
# 脚本定义了一系列变量,如编译器、链接器、相关构建选项等。这些选项将在SCons执行时用于配置构建环境
|
||||
import os
|
||||
|
||||
# toolchains options
|
||||
# 工具链选项 toolchains options
|
||||
ARCH='arm'
|
||||
CPU='cortex-m3'
|
||||
CROSS_TOOL='gcc'
|
||||
|
||||
# bsp lib config
|
||||
# bsp库设置 bsp lib config
|
||||
BSP_LIBRARY_TYPE = None
|
||||
|
||||
# 检查环境变量并相应地设置CROSS_TOOL
|
||||
if os.getenv('RTT_CC'):
|
||||
CROSS_TOOL = os.getenv('RTT_CC')
|
||||
if os.getenv('RTT_ROOT'):
|
||||
|
@ -15,6 +17,7 @@ if os.getenv('RTT_ROOT'):
|
|||
|
||||
# cross_tool provides the cross compiler
|
||||
# EXEC_PATH is the compiler execute path, for example, CodeSourcery, Keil MDK, IAR
|
||||
# 根据CROSS_TOOL设置编译器执行路径,例如CodeSourcery、Keil MDK、IAR
|
||||
if CROSS_TOOL == 'gcc':
|
||||
PLATFORM = 'gcc'
|
||||
EXEC_PATH = r'/Users/qp/Applications/gcc-arm-none-eabi-10.3-2021.10/bin'
|
||||
|
@ -25,11 +28,14 @@ elif CROSS_TOOL == 'iar':
|
|||
PLATFORM = 'iccarm'
|
||||
EXEC_PATH = r'C:/Program Files (x86)/IAR Systems/Embedded Workbench 8.3'
|
||||
|
||||
# 如果设置了环境变量RTT_EXEC_PATH,使用该路径
|
||||
if os.getenv('RTT_EXEC_PATH'):
|
||||
EXEC_PATH = os.getenv('RTT_EXEC_PATH')
|
||||
|
||||
# 设置构建模式:调试或发布
|
||||
BUILD = 'debug'
|
||||
|
||||
# 不同平台的编译器和选项设置
|
||||
if PLATFORM == 'gcc':
|
||||
# toolchains
|
||||
PREFIX = 'arm-none-eabi-'
|
||||
|
@ -176,6 +182,7 @@ elif PLATFORM == 'iccarm':
|
|||
EXEC_PATH = EXEC_PATH + '/arm/bin/'
|
||||
POST_ACTION = 'ielftool --bin $TARGET rtthread.bin'
|
||||
|
||||
# 处理分发操作,将工程打包成一个绿色的版本
|
||||
def dist_handle(BSP_ROOT, dist_dir):
|
||||
import sys
|
||||
cwd_path = os.getcwd()
|
||||
|
|
Loading…
Reference in New Issue