From 8ee8328ab0dff7ecb130c75cbbba1ac93913e44c Mon Sep 17 00:00:00 2001 From: yaomo718 Date: Fri, 19 Jul 2019 01:15:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E4=BA=86dist=E5=91=BD?= =?UTF-8?q?=E4=BB=A4=E5=AF=B9imxrt=E7=B3=BB=E5=88=97bsp=E5=8C=85=E7=9A=84?= =?UTF-8?q?=E6=94=AF=E6=8C=81=EF=BC=8C=E4=BF=AE=E6=94=B9=E5=89=8D=E7=9A=84?= =?UTF-8?q?dist=E5=91=BD=E4=BB=A4=E7=94=9F=E6=88=90=E7=9A=84=E5=B7=A5?= =?UTF-8?q?=E7=A8=8B=E7=BC=BA=E5=B0=91=E4=BA=86Libraries=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bsp/imxrt/imxrt1052-atk-commander/SConstruct | 20 +++++++++++++++++-- bsp/imxrt/imxrt1052-atk-commander/rtconfig.py | 8 ++++++++ bsp/imxrt/imxrt1052-fire-pro/SConstruct | 20 +++++++++++++++++-- bsp/imxrt/imxrt1052-fire-pro/rtconfig.py | 8 ++++++++ bsp/imxrt/imxrt1052-nxp-evk/SConstruct | 20 +++++++++++++++++-- bsp/imxrt/imxrt1052-nxp-evk/rtconfig.py | 8 ++++++++ bsp/imxrt/tools/sdk_dist.py | 19 ++++++++++++++++++ 7 files changed, 97 insertions(+), 6 deletions(-) create mode 100644 bsp/imxrt/tools/sdk_dist.py diff --git a/bsp/imxrt/imxrt1052-atk-commander/SConstruct b/bsp/imxrt/imxrt1052-atk-commander/SConstruct index a20c6de8db..04d65dd9ff 100644 --- a/bsp/imxrt/imxrt1052-atk-commander/SConstruct +++ b/bsp/imxrt/imxrt1052-atk-commander/SConstruct @@ -45,11 +45,27 @@ if rtconfig.PLATFORM == 'iar': Export('RTT_ROOT') Export('rtconfig') +SDK_ROOT = os.path.abspath('./') + +if os.path.exists(SDK_ROOT + '/Libraries'): + libraries_path_prefix = SDK_ROOT + '/Libraries' +else: + libraries_path_prefix = os.path.dirname(SDK_ROOT) + '/Libraries' + +SDK_LIB = libraries_path_prefix +Export('SDK_LIB') + # prepare building environment objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False) -objs = objs + SConscript('../Libraries/drivers/SConscript') -objs = objs + SConscript('../Libraries/MIMXRT1050/SConscript') +imxrt_library = 'MIMXRT1050' +rtconfig.BSP_LIBRARY_TYPE = imxrt_library + +# include libraries +objs.extend(SConscript(os.path.join(libraries_path_prefix, imxrt_library, 'SConscript'))) + +# include drivers +objs.extend(SConscript(os.path.join(libraries_path_prefix, 'drivers', 'SConscript'))) # make a building DoBuilding(TARGET, objs) diff --git a/bsp/imxrt/imxrt1052-atk-commander/rtconfig.py b/bsp/imxrt/imxrt1052-atk-commander/rtconfig.py index 0161c3fe7c..9b0c3da87f 100644 --- a/bsp/imxrt/imxrt1052-atk-commander/rtconfig.py +++ b/bsp/imxrt/imxrt1052-atk-commander/rtconfig.py @@ -1,4 +1,5 @@ import os +import sys # toolchains options ARCH='arm' @@ -147,3 +148,10 @@ elif PLATFORM == 'iar': EXEC_PATH = EXEC_PATH + '/arm/bin/' POST_ACTION = 'ielftool --bin $TARGET rtthread.bin' + +def dist_handle(BSP_ROOT): + cwd_path = os.getcwd() + sys.path.append(os.path.join(os.path.dirname(BSP_ROOT), 'tools')) + from sdk_dist import dist_do_building + dist_do_building(BSP_ROOT) + \ No newline at end of file diff --git a/bsp/imxrt/imxrt1052-fire-pro/SConstruct b/bsp/imxrt/imxrt1052-fire-pro/SConstruct index a20c6de8db..04d65dd9ff 100644 --- a/bsp/imxrt/imxrt1052-fire-pro/SConstruct +++ b/bsp/imxrt/imxrt1052-fire-pro/SConstruct @@ -45,11 +45,27 @@ if rtconfig.PLATFORM == 'iar': Export('RTT_ROOT') Export('rtconfig') +SDK_ROOT = os.path.abspath('./') + +if os.path.exists(SDK_ROOT + '/Libraries'): + libraries_path_prefix = SDK_ROOT + '/Libraries' +else: + libraries_path_prefix = os.path.dirname(SDK_ROOT) + '/Libraries' + +SDK_LIB = libraries_path_prefix +Export('SDK_LIB') + # prepare building environment objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False) -objs = objs + SConscript('../Libraries/drivers/SConscript') -objs = objs + SConscript('../Libraries/MIMXRT1050/SConscript') +imxrt_library = 'MIMXRT1050' +rtconfig.BSP_LIBRARY_TYPE = imxrt_library + +# include libraries +objs.extend(SConscript(os.path.join(libraries_path_prefix, imxrt_library, 'SConscript'))) + +# include drivers +objs.extend(SConscript(os.path.join(libraries_path_prefix, 'drivers', 'SConscript'))) # make a building DoBuilding(TARGET, objs) diff --git a/bsp/imxrt/imxrt1052-fire-pro/rtconfig.py b/bsp/imxrt/imxrt1052-fire-pro/rtconfig.py index 0161c3fe7c..9b0c3da87f 100644 --- a/bsp/imxrt/imxrt1052-fire-pro/rtconfig.py +++ b/bsp/imxrt/imxrt1052-fire-pro/rtconfig.py @@ -1,4 +1,5 @@ import os +import sys # toolchains options ARCH='arm' @@ -147,3 +148,10 @@ elif PLATFORM == 'iar': EXEC_PATH = EXEC_PATH + '/arm/bin/' POST_ACTION = 'ielftool --bin $TARGET rtthread.bin' + +def dist_handle(BSP_ROOT): + cwd_path = os.getcwd() + sys.path.append(os.path.join(os.path.dirname(BSP_ROOT), 'tools')) + from sdk_dist import dist_do_building + dist_do_building(BSP_ROOT) + \ No newline at end of file diff --git a/bsp/imxrt/imxrt1052-nxp-evk/SConstruct b/bsp/imxrt/imxrt1052-nxp-evk/SConstruct index a20c6de8db..04d65dd9ff 100644 --- a/bsp/imxrt/imxrt1052-nxp-evk/SConstruct +++ b/bsp/imxrt/imxrt1052-nxp-evk/SConstruct @@ -45,11 +45,27 @@ if rtconfig.PLATFORM == 'iar': Export('RTT_ROOT') Export('rtconfig') +SDK_ROOT = os.path.abspath('./') + +if os.path.exists(SDK_ROOT + '/Libraries'): + libraries_path_prefix = SDK_ROOT + '/Libraries' +else: + libraries_path_prefix = os.path.dirname(SDK_ROOT) + '/Libraries' + +SDK_LIB = libraries_path_prefix +Export('SDK_LIB') + # prepare building environment objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False) -objs = objs + SConscript('../Libraries/drivers/SConscript') -objs = objs + SConscript('../Libraries/MIMXRT1050/SConscript') +imxrt_library = 'MIMXRT1050' +rtconfig.BSP_LIBRARY_TYPE = imxrt_library + +# include libraries +objs.extend(SConscript(os.path.join(libraries_path_prefix, imxrt_library, 'SConscript'))) + +# include drivers +objs.extend(SConscript(os.path.join(libraries_path_prefix, 'drivers', 'SConscript'))) # make a building DoBuilding(TARGET, objs) diff --git a/bsp/imxrt/imxrt1052-nxp-evk/rtconfig.py b/bsp/imxrt/imxrt1052-nxp-evk/rtconfig.py index 6049cb250d..88fd75b5e6 100644 --- a/bsp/imxrt/imxrt1052-nxp-evk/rtconfig.py +++ b/bsp/imxrt/imxrt1052-nxp-evk/rtconfig.py @@ -1,4 +1,5 @@ import os +import sys # toolchains options ARCH='arm' @@ -147,3 +148,10 @@ elif PLATFORM == 'iar': EXEC_PATH = EXEC_PATH + '/arm/bin/' POST_ACTION = 'ielftool --bin $TARGET rtthread.bin' + +def dist_handle(BSP_ROOT): + cwd_path = os.getcwd() + sys.path.append(os.path.join(os.path.dirname(BSP_ROOT), 'tools')) + from sdk_dist import dist_do_building + dist_do_building(BSP_ROOT) + \ No newline at end of file diff --git a/bsp/imxrt/tools/sdk_dist.py b/bsp/imxrt/tools/sdk_dist.py new file mode 100644 index 0000000000..9254b1b589 --- /dev/null +++ b/bsp/imxrt/tools/sdk_dist.py @@ -0,0 +1,19 @@ +import os +import sys +import shutil +cwd_path = os.getcwd() +sys.path.append(os.path.join(os.path.dirname(cwd_path), 'rt-thread', 'tools')) + +# BSP dist function +def dist_do_building(BSP_ROOT): + from mkdist import bsp_copy_files + import rtconfig + + dist_dir = os.path.join(BSP_ROOT, 'dist', os.path.basename(BSP_ROOT)) + library_path = os.path.join(os.path.dirname(BSP_ROOT), 'Libraries') + library_dir = os.path.join(dist_dir, 'Libraries') + print("=> copy bsp drivers") + bsp_copy_files(os.path.join(library_path, 'drivers'), os.path.join(library_dir, 'drivers')) + print("=> copy bsp library") + bsp_copy_files(os.path.join(library_path, rtconfig.BSP_LIBRARY_TYPE), os.path.join(library_dir, rtconfig.BSP_LIBRARY_TYPE)) + shutil.copyfile(os.path.join(library_path, 'Kconfig'), os.path.join(library_dir, 'Kconfig'))