1 | #!python
|
---|
2 | # -*- coding: utf-8 -*-
|
---|
3 | #
|
---|
4 | # TOPPERS ATK2
|
---|
5 | # Toyohashi Open Platform for Embedded Real-Time Systems
|
---|
6 | # Automotive Kernel Version 2
|
---|
7 | #
|
---|
8 | # Copyright (C) 2013-2014 by Center for Embedded Computing Systems
|
---|
9 | # Graduate School of Information Science, Nagoya Univ., JAPAN
|
---|
10 | # Copyright (C) 2013-2014 by FUJI SOFT INCORPORATED, JAPAN
|
---|
11 | # Copyright (C) 2013-2014 by Panasonic Advanced Technology Development Co., Ltd., JAPAN
|
---|
12 | # Copyright (C) 2013-2014 by Renesas Electronics Corporation, JAPAN
|
---|
13 | # Copyright (C) 2013-2014 by Sunny Giken Inc., JAPAN
|
---|
14 | # Copyright (C) 2013-2014 by TOSHIBA CORPORATION, JAPAN
|
---|
15 | # Copyright (C) 2013-2014 by Witz Corporation, JAPAN
|
---|
16 | #
|
---|
17 | # ä¸è¨èä½æ¨©è
|
---|
18 | ã¯ï¼ä»¥ä¸ã®(1)ï½(4)ã®æ¡ä»¶ãæºããå ´åã«éãï¼æ¬ã½ããã¦ã§
|
---|
19 | # ã¢ï¼æ¬ã½ããã¦ã§ã¢ãæ¹å¤ãããã®ãå«ãï¼ä»¥ä¸åãï¼ã使ç¨ã»è¤è£½ã»æ¹
|
---|
20 | # å¤ã»åé
|
---|
21 | å¸ï¼ä»¥ä¸ï¼å©ç¨ã¨å¼ã¶ï¼ãããã¨ãç¡åã§è¨±è«¾ããï¼
|
---|
22 | # (1) æ¬ã½ããã¦ã§ã¢ãã½ã¼ã¹ã³ã¼ãã®å½¢ã§å©ç¨ããå ´åã«ã¯ï¼ä¸è¨ã®èä½
|
---|
23 | # 権表示ï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿è¨¼è¦å®ãï¼ãã®ã¾ã¾ã®å½¢ã§ã½ã¼
|
---|
24 | # ã¹ã³ã¼ãä¸ã«å«ã¾ãã¦ãããã¨ï¼
|
---|
25 | # (2) æ¬ã½ããã¦ã§ã¢ãï¼ã©ã¤ãã©ãªå½¢å¼ãªã©ï¼ä»ã®ã½ããã¦ã§ã¢éçºã«ä½¿
|
---|
26 | # ç¨ã§ããå½¢ã§åé
|
---|
27 | å¸ããå ´åã«ã¯ï¼åé
|
---|
28 | å¸ã«ä¼´ãããã¥ã¡ã³ãï¼å©ç¨
|
---|
29 | # è
|
---|
30 | ããã¥ã¢ã«ãªã©ï¼ã«ï¼ä¸è¨ã®èä½æ¨©è¡¨ç¤ºï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨
|
---|
31 | # ã®ç¡ä¿è¨¼è¦å®ãæ²è¼ãããã¨ï¼
|
---|
32 | # (3) æ¬ã½ããã¦ã§ã¢ãï¼æ©å¨ã«çµã¿è¾¼ããªã©ï¼ä»ã®ã½ããã¦ã§ã¢éçºã«ä½¿
|
---|
33 | # ç¨ã§ããªãå½¢ã§åé
|
---|
34 | å¸ããå ´åã«ã¯ï¼æ¬¡ã®ããããã®æ¡ä»¶ãæºããã
|
---|
35 | # ã¨ï¼
|
---|
36 | # (a) åé
|
---|
37 | å¸ã«ä¼´ãããã¥ã¡ã³ãï¼å©ç¨è
|
---|
38 | ããã¥ã¢ã«ãªã©ï¼ã«ï¼ä¸è¨ã®è
|
---|
39 | # ä½æ¨©è¡¨ç¤ºï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿è¨¼è¦å®ãæ²è¼ãããã¨ï¼
|
---|
40 | # (b) åé
|
---|
41 | å¸ã®å½¢æ
|
---|
42 | ãï¼å¥ã«å®ããæ¹æ³ã«ãã£ã¦ï¼TOPPERSããã¸ã§ã¯ãã«
|
---|
43 | # å ±åãããã¨ï¼
|
---|
44 | # (4) æ¬ã½ããã¦ã§ã¢ã®å©ç¨ã«ããç´æ¥çã¾ãã¯éæ¥çã«çãããããªãæ
|
---|
45 | # 害ãããï¼ä¸è¨èä½æ¨©è
|
---|
46 | ããã³TOPPERSããã¸ã§ã¯ããå
|
---|
47 | 責ãããã¨ï¼
|
---|
48 | # ã¾ãï¼æ¬ã½ããã¦ã§ã¢ã®ã¦ã¼ã¶ã¾ãã¯ã¨ã³ãã¦ã¼ã¶ããã®ãããªãç
|
---|
49 | # ç±ã«åºã¥ãè«æ±ãããï¼ä¸è¨èä½æ¨©è
|
---|
50 | ããã³TOPPERSããã¸ã§ã¯ãã
|
---|
51 | # å
|
---|
52 | 責ãããã¨ï¼
|
---|
53 | #
|
---|
54 | # æ¬ã½ããã¦ã§ã¢ã¯ï¼AUTOSARï¼AUTomotive Open System ARchitectureï¼ä»
|
---|
55 | # æ§ã«åºã¥ãã¦ããï¼ä¸è¨ã®è¨±è«¾ã¯ï¼AUTOSARã®ç¥ç財ç£æ¨©ã許諾ãããã®ã§
|
---|
56 | # ã¯ãªãï¼AUTOSARã¯ï¼AUTOSARä»æ§ã«åºã¥ããã½ããã¦ã§ã¢ãåç¨ç®çã§å©
|
---|
57 | # ç¨ããè
|
---|
58 | ã«å¯¾ãã¦ï¼AUTOSARãã¼ããã¼ã«ãªããã¨ãæ±ãã¦ããï¼
|
---|
59 | #
|
---|
60 | # æ¬ã½ããã¦ã§ã¢ã¯ï¼ç¡ä¿è¨¼ã§æä¾ããã¦ãããã®ã§ããï¼ä¸è¨èä½æ¨©è
|
---|
61 | ã
|
---|
62 | # ãã³TOPPERSããã¸ã§ã¯ãã¯ï¼æ¬ã½ããã¦ã§ã¢ã«é¢ãã¦ï¼ç¹å®ã®ä½¿ç¨ç®ç
|
---|
63 | # ã«å¯¾ããé©åæ§ãå«ãã¦ï¼ãããªãä¿è¨¼ãè¡ããªãï¼ã¾ãï¼æ¬ã½ããã¦ã§
|
---|
64 | # ã¢ã®å©ç¨ã«ããç´æ¥çã¾ãã¯éæ¥çã«çãããããªãæ害ã«é¢ãã¦ãï¼ã
|
---|
65 | # ã®è²¬ä»»ãè² ããªãï¼
|
---|
66 | #
|
---|
67 | # $Id: post_cfg_pass4.py 181 2015-06-12 10:02:03Z t_ishikawa $
|
---|
68 | #
|
---|
69 |
|
---|
70 | import subprocess
|
---|
71 | import os
|
---|
72 | import sys
|
---|
73 | import re # for regular expression
|
---|
74 | import shutil
|
---|
75 |
|
---|
76 | # set relative path from top proj
|
---|
77 | proj_rel_dir = "../"
|
---|
78 |
|
---|
79 | # call definition file
|
---|
80 | common.Source(proj_rel_dir + "def.py")
|
---|
81 |
|
---|
82 | # path
|
---|
83 | src_abs_path = os.path.abspath(proj_rel_dir + SRCDIR)
|
---|
84 |
|
---|
85 | # call common file
|
---|
86 | common.Source(src_abs_path + "/arch/ccrh/common.py")
|
---|
87 |
|
---|
88 | #
|
---|
89 | # convert map file
|
---|
90 | #
|
---|
91 | inputfile = open("./DefaultBuild/cfg_pass4.map")
|
---|
92 | outputfile = open("./DefaultBuild/cfg_pass4.syms", 'w')
|
---|
93 |
|
---|
94 | r = re.compile("^\s+([0-9a-f]+)\s+[0-9a-f]+\s+\w+\s+,\w+\s+\*\s+")
|
---|
95 | line = inputfile.readline()
|
---|
96 | pre_line = line
|
---|
97 | while line:
|
---|
98 | line = line.replace('\r\n','') #delete newline
|
---|
99 | m = r.search(line)
|
---|
100 | if m:
|
---|
101 | outputfile.write(m.group(1) + " T " + pre_line + "\n")
|
---|
102 | pre_line = line
|
---|
103 | line = inputfile.readline()
|
---|
104 |
|
---|
105 | inputfile.close()
|
---|
106 | outputfile.close()
|
---|
107 |
|
---|
108 | #
|
---|
109 | # copy pass 1 generated files
|
---|
110 | #
|
---|
111 | print "Copy pass 1 generated file"
|
---|
112 | shutil.copy("../cfg/cfg1_out.srec", ".")
|
---|
113 | shutil.copy("../cfg/cfg1_out.syms", ".")
|
---|
114 | shutil.copy("../cfg/cfg2_out.tf", ".")
|
---|
115 | shutil.copy("../cfg/cfg2_out.tf", "./cfg3_out.tf")
|
---|
116 |
|
---|
117 | #
|
---|
118 | # Execute cfg path 3
|
---|
119 | #
|
---|
120 | # make command
|
---|
121 | cfg_command = cfg + " --pass 4 " + "--kernel " + CFG_KERNEL
|
---|
122 | cfg_command += " --api-table " + cfg_api_table
|
---|
123 | cfg_command += " " + cfg_cfg1_def_tables + cfg_includes
|
---|
124 | cfg_command += " --rom-image ./DefaultBuild/cfg_pass4.srec --symbol-table ./DefaultBuild/cfg_pass4.syms"
|
---|
125 | cfg_command += " -T " + cfg_mem_tf
|
---|
126 | cfg_command += " --ini-file " + cfg_ini_file
|
---|
127 | cfg_command += " " + cfg_input_str
|
---|
128 |
|
---|
129 | print cfg_command
|
---|
130 |
|
---|
131 | # Execute
|
---|
132 | try:
|
---|
133 | output = subprocess.check_output(cfg_command, stderr=subprocess.STDOUT,)
|
---|
134 | except subprocess.CalledProcessError, e:
|
---|
135 | print "ERROR!! : ", e.output
|
---|
136 | sys.exit()
|
---|
137 |
|
---|
138 | output.replace('\r','')
|
---|
139 | print output
|
---|
140 |
|
---|