1 | #!python
|
---|
2 | import subprocess
|
---|
3 | import os
|
---|
4 | import sys
|
---|
5 | import re # for regular expression
|
---|
6 | import shutil
|
---|
7 |
|
---|
8 | #
|
---|
9 | # variable definition
|
---|
10 | #
|
---|
11 | INCLUDES = []
|
---|
12 | CFG1_DEF_TABLES = []
|
---|
13 |
|
---|
14 | # set relative path from top proj
|
---|
15 | proj_rel_dir = ""
|
---|
16 |
|
---|
17 | # call definition file
|
---|
18 | common.Source("./def.py")
|
---|
19 |
|
---|
20 | # path
|
---|
21 | src_abs_path = os.path.abspath(SRCDIR)
|
---|
22 |
|
---|
23 | # call common file
|
---|
24 | common.Source(src_abs_path + "/arch/ccrx/common.py")
|
---|
25 |
|
---|
26 | #
|
---|
27 | # convert map file
|
---|
28 | #
|
---|
29 | inputfile = open("./DefaultBuild/asp.map")
|
---|
30 | outputfile = open("./DefaultBuild/asp.syms", 'w')
|
---|
31 |
|
---|
32 | r1 = re.compile("^\s+(_\w+)")
|
---|
33 | r2 = re.compile("^\s+([0-9a-f]+)\s+")
|
---|
34 | line = inputfile.readline()
|
---|
35 | while line:
|
---|
36 | line = line.replace('\r\n','') #delete newline
|
---|
37 | m1 = r1.search(line)
|
---|
38 | if m1:
|
---|
39 | line = inputfile.readline()
|
---|
40 | line = line.replace('\r\n','') #delete newline
|
---|
41 | m2 = r2.search(line)
|
---|
42 | outputfile.write("0x" + m2.group(1) + " T " + m1.group(1) + "\n")
|
---|
43 | line = inputfile.readline()
|
---|
44 |
|
---|
45 | inputfile.close()
|
---|
46 | outputfile.close()
|
---|
47 |
|
---|
48 | #
|
---|
49 | # copy pass 2 generated files
|
---|
50 | #
|
---|
51 | print "Copy pass 2 generated file"
|
---|
52 | shutil.copy("./cfg/cfg2_out.db", ".")
|
---|
53 |
|
---|
54 | #
|
---|
55 | # Execute cfg path 3
|
---|
56 | #
|
---|
57 | # make command
|
---|
58 | cfg_command = cfg + " --pass 3 " + "--kernel " + CFG_KERNEL + " -O"
|
---|
59 | cfg_command += " " + cfg_includes
|
---|
60 | cfg_command += " --rom-image ./DefaultBuild/asp.srec --rom-symbol ./DefaultBuild/asp.syms"
|
---|
61 | cfg_command += " -T " + cfg_check_trb
|
---|
62 |
|
---|
63 | print cfg_command
|
---|
64 |
|
---|
65 | # Execute
|
---|
66 | try:
|
---|
67 | output = subprocess.check_output(cfg_command, stderr=subprocess.STDOUT,)
|
---|
68 | except subprocess.CalledProcessError, e:
|
---|
69 | print "ERROR!! : ", e.output
|
---|
70 | sys.exit()
|
---|
71 |
|
---|
72 | output.replace('\r','')
|
---|
73 | print output
|
---|
74 |
|
---|
75 | #
|
---|
76 | # dlete pass 2 generated files
|
---|
77 | #
|
---|
78 | print "Delete pass 2 generated file"
|
---|
79 | os.remove("cfg2_out.db")
|
---|