1#!/usr/bin/env python3 2# encoding=utf-8 3# ============================================================================ 4# @brief packet files 5# Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED. 6# Licensed under the Apache License, Version 2.0 (the "License"); 7# you may not use this file except in compliance with the License. 8# You may obtain a copy of the License at 9# 10# http://www.apache.org/licenses/LICENSE-2.0 11# 12# Unless required by applicable law or agreed to in writing, software 13# distributed under the License is distributed on an "AS IS" BASIS, 14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15# See the License for the specific language governing permissions and 16# limitations under the License. 17 18# ============================================================================ 19 20import os 21import sys 22import importlib 23 24sys.path.append(os.path.dirname(os.path.realpath(__file__))) 25sys.dont_write_bytecode = True 26 27def main(): 28 arg_ls = sys.argv 29 build_soc = sys.argv[1] 30 build_target = sys.argv[2] 31 build_extr_defines = sys.argv[3] 32 33 load_fmt = "chip_packet.%s.packet" %build_soc 34 load_mod = importlib.import_module(load_fmt) 35 36 lost_file = load_mod.is_packing_files_exist(build_soc, build_target) 37 if lost_file: 38 lost = ";".join(lost_file) 39 print(f"cannot find {lost}") 40 exit(-1) 41 if build_soc in ["ws63"]: 42 load_mod.make_all_in_one_packet(build_target, build_extr_defines) 43 else: 44 load_mod.make_all_in_one_packet(build_target) 45 46if __name__ == "__main__": 47 main() 48