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