From cb8aeba65379447be37065b8163ded92f5c8c19d Mon Sep 17 00:00:00 2001 From: 12345qiupeng Date: Wed, 10 May 2023 11:34:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0rtconfig.py=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SConstruct | 1 + rtconfig.py | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/SConstruct b/SConstruct index e03acc8..b531380 100644 --- a/SConstruct +++ b/SConstruct @@ -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 diff --git a/rtconfig.py b/rtconfig.py index 6d903c6..8c35331 100644 --- a/rtconfig.py +++ b/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()