[313] | 1 | #!python
|
---|
| 2 | import subprocess
|
---|
| 3 | import os
|
---|
| 4 | import sys
|
---|
| 5 |
|
---|
| 6 | #
|
---|
| 7 | # variable definition
|
---|
| 8 | #
|
---|
| 9 | INCLUDES = []
|
---|
| 10 | CFG1_DEF_TABLES = []
|
---|
| 11 |
|
---|
| 12 | # set relative path from top proj
|
---|
| 13 | proj_rel_dir = "../"
|
---|
| 14 |
|
---|
| 15 | TCPIP_API_TABLE = ""
|
---|
| 16 | CFG_TCPIP_KERNEL_TRB = ""
|
---|
| 17 |
|
---|
| 18 | # call definition file
|
---|
| 19 | common.Source(proj_rel_dir + "def.py")
|
---|
| 20 |
|
---|
| 21 | # path
|
---|
| 22 | src_abs_path = os.path.abspath(proj_rel_dir + SRCDIR)
|
---|
| 23 |
|
---|
| 24 | # call common file
|
---|
| 25 | common.Source(src_abs_path + "/arch/ccrx/common.py")
|
---|
| 26 |
|
---|
| 27 | #
|
---|
| 28 | # delete generated files
|
---|
| 29 | #
|
---|
| 30 | if os.path.exists("cfg1_out.db"):
|
---|
| 31 | os.remove("cfg1_out.db")
|
---|
| 32 | if os.path.exists("cfg2_out.db"):
|
---|
| 33 | os.remove("cfg2_out.db")
|
---|
| 34 | if os.path.exists("cfg3_out.db"):
|
---|
| 35 | os.remove("cfg3_out.db")
|
---|
| 36 | if os.path.exists("cfg1_out.c"):
|
---|
| 37 | os.remove("cfg1_out.c")
|
---|
| 38 | if os.path.exists("kernel_cfg.c"):
|
---|
| 39 | os.remove("kernel_cfg.c")
|
---|
| 40 | if os.path.exists("kernel_cfg.h"):
|
---|
| 41 | os.remove("kernel_cfg.h")
|
---|
| 42 | if os.path.exists("offset.h"):
|
---|
| 43 | os.remove("offset.h")
|
---|
| 44 | if os.path.exists("tinet_cfg.c"):
|
---|
| 45 | os.remove("tinet_cfg.c")
|
---|
| 46 | if os.path.exists("tinet_cfg.h"):
|
---|
| 47 | os.remove("tinet_cfg.h")
|
---|
| 48 |
|
---|
| 49 | if TCPIP_API_TABLE != "":
|
---|
| 50 | cfg_tcpip_api_table = srcdir + TCPIP_API_TABLE
|
---|
| 51 |
|
---|
| 52 | #
|
---|
| 53 | # make command
|
---|
| 54 | #
|
---|
| 55 | cfg_command = cfg + " --pass 1 " + "--kernel " + CFG_KERNEL
|
---|
| 56 | cfg_command += " " + cfg_includes
|
---|
| 57 | if TCPIP_API_TABLE == "":
|
---|
| 58 | cfg_command += " --api-table " + cfg_api_table
|
---|
| 59 | else:
|
---|
| 60 | cfg_command += " --api-table " + cfg_tcpip_api_table + ":tcpip"
|
---|
| 61 | cfg_command += " --api-table " + cfg_api_table + ":kernel"
|
---|
| 62 | cfg_command += " " + cfg_cfg1_def_tables
|
---|
| 63 | cfg_command += " -M cfg1_out_c.d"
|
---|
| 64 | cfg_command += " " + proj_rel_dir + CFG_FILE
|
---|
| 65 |
|
---|
| 66 | print cfg_command
|
---|
| 67 |
|
---|
| 68 | #
|
---|
| 69 | # Execute cfg path 1
|
---|
| 70 | #
|
---|
| 71 | try:
|
---|
| 72 | output = subprocess.check_output(cfg_command, stderr=subprocess.STDOUT,)
|
---|
| 73 | except subprocess.CalledProcessError, e:
|
---|
| 74 | print "ERROR!! : ", e.output
|
---|
| 75 |
|
---|
| 76 | print output
|
---|