@@ -15,42 +15,35 @@ except:
1515 print (RTT_ROOT )
1616 exit (- 1 )
1717
18- TARGET = 'rtthread.' + rtconfig .TARGET_EXT
19- DefaultEnvironment (tools = [])
20- if rtconfig .PLATFORM == 'armcc' :
21- env = Environment (tools = ['mingw' ],
22- AS = rtconfig .AS , ASFLAGS = rtconfig .AFLAGS ,
23- CC = rtconfig .CC , CFLAGS = rtconfig .CFLAGS ,
24- CXX = rtconfig .CXX , CXXFLAGS = rtconfig .CXXFLAGS ,
25- AR = rtconfig .AR , ARFLAGS = '-rc' ,
26- LINK = rtconfig .LINK , LINKFLAGS = rtconfig .LFLAGS ,
27- # overwrite cflags, because cflags has '--C99'
28- CXXCOM = '$CXX -o $TARGET --cpp -c $CXXFLAGS $_CCCOMCOM $SOURCES' )
29- else :
30- env = Environment (tools = ['mingw' ],
31- AS = rtconfig .AS , ASFLAGS = rtconfig .AFLAGS ,
32- CC = rtconfig .CC , CFLAGS = rtconfig .CFLAGS ,
33- CXX = rtconfig .CXX , CXXFLAGS = rtconfig .CXXFLAGS ,
34- AR = rtconfig .AR , ARFLAGS = '-rc' ,
35- LINK = rtconfig .LINK , LINKFLAGS = rtconfig .LFLAGS ,
36- CXXCOM = '$CXX -o $TARGET -c $CXXFLAGS $_CCCOMCOM $SOURCES' )
18+ TARGET = 'rt-thread.' + rtconfig .TARGET_EXT
3719
20+ DefaultEnvironment (tools = [])
21+ env = Environment (tools = ['mingw' ],
22+ AS = rtconfig .AS , ASFLAGS = rtconfig .AFLAGS ,
23+ CC = rtconfig .CC , CFLAGS = rtconfig .CFLAGS ,
24+ AR = rtconfig .AR , ARFLAGS = '-rc' ,
25+ CXX = rtconfig .CXX , CXXFLAGS = rtconfig .CXXFLAGS ,
26+ LINK = rtconfig .LINK , LINKFLAGS = rtconfig .LFLAGS )
3827env .PrependENVPath ('PATH' , rtconfig .EXEC_PATH )
3928
4029if rtconfig .PLATFORM == 'iar' :
4130 env .Replace (CCCOM = ['$CC $CFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -o $TARGET $SOURCES' ])
4231 env .Replace (ARFLAGS = ['' ])
43- env .Replace (LINKCOM = env ["LINKCOM" ] + ' --map rtthread .map' )
32+ env .Replace (LINKCOM = env ["LINKCOM" ] + ' --map rt-thread .map' )
4433
4534Export ('RTT_ROOT' )
4635Export ('rtconfig' )
4736
4837SDK_ROOT = os .path .abspath ('./' )
38+
4939if os .path .exists (SDK_ROOT + '/libraries' ):
5040 libraries_path_prefix = SDK_ROOT + '/libraries'
5141else :
5242 libraries_path_prefix = os .path .dirname (SDK_ROOT ) + '/libraries'
5343
44+ from utils import _make_path_relative
45+ libraries_path_prefix = _make_path_relative (os .path .abspath ('./' ), libraries_path_prefix )
46+
5447SDK_LIB = libraries_path_prefix
5548Export ('SDK_LIB' )
5649
@@ -60,14 +53,19 @@ objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False)
6053imxrt_library = 'MIMXRT1060'
6154rtconfig .BSP_LIBRARY_TYPE = imxrt_library
6255
56+ bsp_vdir = 'build'
57+
6358# include libraries
64- objs .extend (SConscript (os .path .join (libraries_path_prefix , imxrt_library , 'SConscript' )))
59+ objs .extend (SConscript (os .path .join (libraries_path_prefix , imxrt_library , 'SConscript' ),
60+ variant_dir = bsp_vdir + '/libraries/' + imxrt_library , duplicate = 0 ))
6561
6662# include drivers
67- objs .extend (SConscript (os .path .join (libraries_path_prefix , 'drivers' , 'SConscript' )))
63+ objs .extend (SConscript (os .path .join (libraries_path_prefix , 'drivers' , 'SConscript' ),
64+ variant_dir = bsp_vdir + '/libraries/drivers' , duplicate = 0 ))
6865
69- # include peripherals
70- objs .extend (SConscript (os .path .join (libraries_path_prefix , 'peripherals' , 'SConscript' )))
66+ bsp_port_script = os .path .join (os .getcwd (), 'board' , 'ports' , 'SConscript' )
67+ if os .path .isfile (bsp_port_script ):
68+ objs .extend (SConscript (bsp_port_script , variant_dir = bsp_vdir + '/board/ports' , duplicate = 0 ))
7169
7270# make a building
7371DoBuilding (TARGET , objs )
0 commit comments