1import os
2import sys
3import shutil
4cwd_path = os.getcwd()
5sys.path.append(os.path.join(os.path.dirname(cwd_path), 'rt-thread', 'tools'))
6
7# BSP dist function
8def dist_do_building(BSP_ROOT, dist_dir):
9    from mkdist import bsp_copy_files
10    import rtconfig
11
12    library_dir  = os.path.join(dist_dir, 'libraries')
13
14    print("=> copy bluetrum bsp library")
15    library_path = os.path.join(os.path.dirname(BSP_ROOT), 'libraries')
16    library_dir  = os.path.join(dist_dir, 'libraries')
17    bsp_copy_files(os.path.join(library_path, rtconfig.BSP_LIBRARY_TYPE), os.path.join(library_dir, rtconfig.BSP_LIBRARY_TYPE))
18
19    print("=> copy bsp drivers")
20    bsp_copy_files(os.path.join(library_path, 'hal_drivers'), os.path.join(library_dir, 'hal_drivers'))
21    # shutil.copyfile(os.path.join(library_path, 'Kconfig'), os.path.join(library_dir, 'Kconfig'))
22
23    print("=> copy libcpu")
24    bsp_copy_files(os.path.join(os.path.dirname(BSP_ROOT), 'libcpu'), os.path.join(dist_dir, 'libcpu'))
25