添加rtconfig.py注释

main
邱棚 2023-05-10 11:34:01 +08:00
parent c4b476e0ac
commit cb8aeba653
2 changed files with 10 additions and 2 deletions

View File

@ -54,6 +54,7 @@ Export('SDK_LIB')
# prepare building environment # prepare building environment
objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False) objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False)
# 设置stm32驱动库路径
stm32_library = 'STM32F1xx_HAL' stm32_library = 'STM32F1xx_HAL'
rtconfig.BSP_LIBRARY_TYPE = stm32_library rtconfig.BSP_LIBRARY_TYPE = stm32_library

View File

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