• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env python
2# coding:utf-8
3# Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED.
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#     http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16import sys,string,re,os
17sys.path.append(os.path.split(os.path.realpath(__file__))[0])
18from ctypes import *
19from parse_elf import *
20import json
21
22if __name__ == '__main__':
23    print("Running parse step1 at", sys.executable,
24          " version:%d.%d.%d " % (sys.version_info[0], sys.version_info[1], sys.version_info[2]))
25    out_dir = sys.argv[1]
26    debug_file = sys.argv[2]
27    nm_file = sys.argv[3]
28    xml_file = sys.argv[4]
29
30    if not os.path.isdir(out_dir):
31        os.makedirs(out_dir)
32    parse_elf_step_1(debug_file,
33        os.path.join(out_dir, 'auto_class.py'),
34        os.path.join(out_dir, 'auto_struct.txt'),
35        nm_file,
36        os.path.join(out_dir, 'global.txt'),
37        out_dir,
38        xml_file
39    )
40    print("Build parse tool success.")
41