Skip to content

Commit 5f17cf9

Browse files
authored
Merge pull request #3754 from xfwangqiang/dev-lts-v3.1.x
fixed scons --dist in IMXRT BSP
2 parents bae546a + 52e76a9 commit 5f17cf9

File tree

7 files changed

+48
-13
lines changed

7 files changed

+48
-13
lines changed

bsp/imxrt/imxrt1052-atk-commander/rtconfig.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,11 @@
149149
EXEC_PATH = EXEC_PATH + '/arm/bin/'
150150
POST_ACTION = 'ielftool --bin $TARGET rtthread.bin'
151151

152-
def dist_handle(BSP_ROOT):
152+
153+
def dist_handle(BSP_ROOT, dist_dir):
154+
import sys
153155
cwd_path = os.getcwd()
154156
sys.path.append(os.path.join(os.path.dirname(BSP_ROOT), 'tools'))
155157
from sdk_dist import dist_do_building
156-
dist_do_building(BSP_ROOT)
158+
dist_do_building(BSP_ROOT, dist_dir)
157159

bsp/imxrt/imxrt1052-fire-pro/rtconfig.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,11 @@
149149
EXEC_PATH = EXEC_PATH + '/arm/bin/'
150150
POST_ACTION = 'ielftool --bin $TARGET rtthread.bin'
151151

152-
def dist_handle(BSP_ROOT):
152+
def dist_handle(BSP_ROOT, dist_dir):
153+
import sys
153154
cwd_path = os.getcwd()
154155
sys.path.append(os.path.join(os.path.dirname(BSP_ROOT), 'tools'))
155156
from sdk_dist import dist_do_building
156-
dist_do_building(BSP_ROOT)
157+
dist_do_building(BSP_ROOT, dist_dir)
158+
157159

bsp/imxrt/imxrt1052-nxp-evk/rtconfig.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,10 @@
149149
EXEC_PATH = EXEC_PATH + '/arm/bin/'
150150
POST_ACTION = 'ielftool --bin $TARGET rtthread.bin'
151151

152-
def dist_handle(BSP_ROOT):
152+
def dist_handle(BSP_ROOT, dist_dir):
153+
import sys
153154
cwd_path = os.getcwd()
154155
sys.path.append(os.path.join(os.path.dirname(BSP_ROOT), 'tools'))
155156
from sdk_dist import dist_do_building
156-
dist_do_building(BSP_ROOT)
157+
dist_do_building(BSP_ROOT, dist_dir)
157158

bsp/imxrt/imxrt1064-nxp-evk/SConstruct

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,26 @@ if rtconfig.PLATFORM == 'iar':
4545
Export('RTT_ROOT')
4646
Export('rtconfig')
4747

48+
SDK_ROOT = os.path.abspath('./')
49+
if os.path.exists(SDK_ROOT + '/Libraries'):
50+
libraries_path_prefix = SDK_ROOT + '/Libraries'
51+
else:
52+
libraries_path_prefix = os.path.dirname(SDK_ROOT) + '/Libraries'
53+
54+
SDK_LIB = libraries_path_prefix
55+
Export('SDK_LIB')
56+
4857
# prepare building environment
4958
objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False)
5059

51-
objs = objs + SConscript('../libraries/drivers/SConscript')
52-
objs = objs + SConscript('../libraries/MIMXRT1064/SConscript')
60+
imxrt_library = 'MIMXRT1064'
61+
rtconfig.BSP_LIBRARY_TYPE = imxrt_library
62+
63+
# include libraries
64+
objs.extend(SConscript(os.path.join(libraries_path_prefix, imxrt_library, 'SConscript')))
65+
66+
# include drivers
67+
objs.extend(SConscript(os.path.join(libraries_path_prefix, 'drivers', 'SConscript')))
5368

5469
# make a building
5570
DoBuilding(TARGET, objs)

bsp/imxrt/imxrt1064-nxp-evk/rtconfig.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
CPU='cortex-m7'
66
CROSS_TOOL='gcc'
77

8+
# bsp lib config
9+
BSP_LIBRARY_TYPE = None
10+
811
if os.getenv('RTT_CC'):
912
CROSS_TOOL = os.getenv('RTT_CC')
1013
if os.getenv('RTT_ROOT'):
@@ -150,3 +153,11 @@
150153

151154
EXEC_PATH = EXEC_PATH + '/arm/bin/'
152155
POST_ACTION = 'ielftool --bin $TARGET rtthread.bin'
156+
157+
158+
def dist_handle(BSP_ROOT, dist_dir):
159+
import sys
160+
cwd_path = os.getcwd()
161+
sys.path.append(os.path.join(os.path.dirname(BSP_ROOT), 'tools'))
162+
from sdk_dist import dist_do_building
163+
dist_do_building(BSP_ROOT, dist_dir)

bsp/imxrt/tools/sdk_dist.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,19 @@
55
sys.path.append(os.path.join(os.path.dirname(cwd_path), 'rt-thread', 'tools'))
66

77
# BSP dist function
8-
def dist_do_building(BSP_ROOT):
8+
def dist_do_building(BSP_ROOT, dist_dir=None):
99
from mkdist import bsp_copy_files
1010
import rtconfig
1111

12-
dist_dir = os.path.join(BSP_ROOT, 'dist', os.path.basename(BSP_ROOT))
12+
if dist_dir is None:
13+
dist_dir = os.path.join(BSP_ROOT, 'dist', os.path.basename(BSP_ROOT))
14+
15+
print("=> copy imxrt bsp library")
1316
library_path = os.path.join(os.path.dirname(BSP_ROOT), 'libraries')
1417
library_dir = os.path.join(dist_dir, 'libraries')
18+
bsp_copy_files(os.path.join(library_path, rtconfig.BSP_LIBRARY_TYPE),
19+
os.path.join(library_dir, rtconfig.BSP_LIBRARY_TYPE))
20+
1521
print("=> copy bsp drivers")
1622
bsp_copy_files(os.path.join(library_path, 'drivers'), os.path.join(library_dir, 'drivers'))
17-
print("=> copy bsp library")
18-
bsp_copy_files(os.path.join(library_path, rtconfig.BSP_LIBRARY_TYPE), os.path.join(library_dir, rtconfig.BSP_LIBRARY_TYPE))
1923
shutil.copyfile(os.path.join(library_path, 'Kconfig'), os.path.join(library_dir, 'Kconfig'))

tools/mkdist.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ def MkDist(program, BSP_ROOT, RTT_ROOT, Env, rttide = None):
349349
if 'dist_handle' in Env:
350350
print("=> start dist handle")
351351
dist_handle = Env['dist_handle']
352-
dist_handle(BSP_ROOT)
352+
dist_handle(BSP_ROOT, dist_dir)
353353

354354
# copy tools directory
355355
print('=> components')

0 commit comments

Comments
 (0)