source: rubycfg_asp/trunk/asp_dcre/arch/ccrx/post_asp.py@ 313

Last change on this file since 313 was 313, checked in by coas-nagasima, 7 years ago

ソースを追加

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