1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2022, RT-Thread Development Team
#
# SPDX-License-Identifier: Apache-2.0
#
# Email: [email protected]
#
#
# Change Logs:
# Date Author Notes
# 2022-11-15 zhugengyu The first version
#
import os
import shutil
import argparse
parser = argparse.ArgumentParser()
parser.description='please enter two parameters <project-name> and <export-path> ...'
parser.add_argument("-n", "--name", help="project name", type=str, default="phytium-a32")
parser.add_argument("-o", "--output", help="export path", type=str, default="./phytium-a32")
args = parser.parse_args()
print('=== Exporting Phytium BSP for RT-Studio ====')
board_src_path = os.path.abspath(r'../board')
librs_src_path = os.path.abspath(r'../libraries')
board_dst_path = os.path.abspath(r'./board')
librs_dst_path = os.path.abspath(r'./libraries')
print(' Copying BSP board from {} to {}'.format(board_src_path, board_dst_path))
print(' Copying BSP libraries from {} to {}'.format(librs_src_path, librs_dst_path))
if os.path.exists(board_dst_path):
shutil.rmtree(board_dst_path)
if os.path.exists(librs_dst_path):
shutil.rmtree(librs_dst_path)
shutil.copytree(board_src_path, board_dst_path)
shutil.copytree(librs_src_path, librs_dst_path)
os.system('scons --dist-ide --project-name={} --project-path={}'.format(args.name, args.output))
if os.path.exists(board_dst_path):
shutil.rmtree(board_dst_path)
if os.path.exists(librs_dst_path):
shutil.rmtree(librs_dst_path)
|