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-2015 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: configure_body.py 182 2015-06-24 07:14:37Z t_ishikawa $
|
---|
68 | #
|
---|
69 |
|
---|
70 | import os.path
|
---|
71 | import os
|
---|
72 | import shutil
|
---|
73 |
|
---|
74 | # call common file
|
---|
75 | common.Source(src_abs_path + "/arch/ccrh/common.py")
|
---|
76 |
|
---|
77 | src_abs_path = os.path.abspath(SRCDIR)
|
---|
78 | wd_abs_path = os.path.abspath('.')
|
---|
79 | cfg_mtsp = wd_abs_path + r"\cfg\cfg.mtsp"
|
---|
80 | kernel_mtsp = wd_abs_path + r"\kernel\kernel.mtsp"
|
---|
81 | cfg_pass4_mtsp = wd_abs_path + r"\cfg_pass4\cfg_pass4.mtsp"
|
---|
82 | atk2_sc3_mtpj = wd_abs_path + r"\atk2-sc3.mtpj"
|
---|
83 |
|
---|
84 | if COPY_SAMPLE1:
|
---|
85 | shutil.copy(src_abs_path + r'/sample/sample1.c', '.')
|
---|
86 | shutil.copy(src_abs_path + r'/sample/sample2.c', '.')
|
---|
87 | shutil.copy(src_abs_path + r'/sample/sample.h', '.')
|
---|
88 | shutil.copy(src_abs_path + r'/sample/sample1.h', '.')
|
---|
89 | shutil.copy(src_abs_path + r'/sample/sample2.h', '.')
|
---|
90 | shutil.copy(src_abs_path + r'/sample/sample1.arxml', '.')
|
---|
91 | shutil.copy(src_abs_path + r'/sample/Rte_Type.h', '.')
|
---|
92 | shutil.copy(src_abs_path + r'/sample/sample_asm.asm', '.')
|
---|
93 |
|
---|
94 | #
|
---|
95 | # close project
|
---|
96 | #
|
---|
97 | #project.Close()
|
---|
98 | print wd_abs_path + "\\atk2-sc3"
|
---|
99 | project.Create(wd_abs_path + "\\atk2-sc3",
|
---|
100 | MicomType.RH850,
|
---|
101 | TARGET_MCU,
|
---|
102 | ProjectKind.Empty,
|
---|
103 | Compiler.CC_RH,
|
---|
104 | False)
|
---|
105 |
|
---|
106 | project.Create(wd_abs_path + "\\cfg\\cfg",
|
---|
107 | MicomType.RH850,
|
---|
108 | TARGET_MCU,
|
---|
109 | ProjectKind.Empty,
|
---|
110 | Compiler.CC_RH,
|
---|
111 | True)
|
---|
112 |
|
---|
113 | project.Create(wd_abs_path + "\\kernel\\kernel",
|
---|
114 | MicomType.RH850,
|
---|
115 | TARGET_MCU,
|
---|
116 | ProjectKind.Library,
|
---|
117 | Compiler.CC_RH,
|
---|
118 | True)
|
---|
119 |
|
---|
120 | project.Create(wd_abs_path + "\\cfg_pass4\\cfg_pass4",
|
---|
121 | MicomType.RH850,
|
---|
122 | TARGET_MCU,
|
---|
123 | ProjectKind.Empty,
|
---|
124 | Compiler.CC_RH,
|
---|
125 | True)
|
---|
126 |
|
---|
127 | #
|
---|
128 | # Change debug tool
|
---|
129 | #
|
---|
130 | debugger.DebugTool.Change(DebugTool.E1Lpd)
|
---|
131 |
|
---|
132 | #
|
---|
133 | # Add files for atk2-sc3 project
|
---|
134 | #
|
---|
135 | for file in app_app_files:
|
---|
136 | project.File.Add(wd_abs_path + "\\" + file, u"app")
|
---|
137 |
|
---|
138 | for file in app_sysmod_files:
|
---|
139 | project.File.Add(src_abs_path + "\\" + file, u"sysmod")
|
---|
140 |
|
---|
141 | for file in app_library_files:
|
---|
142 | project.File.Add(src_abs_path + "\\" + file, u"library")
|
---|
143 |
|
---|
144 | for file in app_configuration_files:
|
---|
145 | if file == 'kernel_mem.c':
|
---|
146 | project.File.Add(wd_abs_path + "\\cfg_pass4\\" + file, u"configuration4")
|
---|
147 | else:
|
---|
148 | project.File.Add(wd_abs_path + "\\cfg\\" + file, u"configuration")
|
---|
149 |
|
---|
150 | str = src_abs_path + '\\' + statup_file
|
---|
151 | project.File.Add(str, u"ã¹ã¿ã¼ãã¢ãã")
|
---|
152 |
|
---|
153 | #
|
---|
154 | # Add files fot cfg project
|
---|
155 | #
|
---|
156 | project.Change(cfg_mtsp)
|
---|
157 |
|
---|
158 | file_list = project.File.Information()
|
---|
159 | for file in file_list:
|
---|
160 | project.File.Remove(file)
|
---|
161 |
|
---|
162 | str = src_abs_path + '\\' + statup_file
|
---|
163 | project.File.Add(str, u"ã¹ã¿ã¼ãã¢ãã")
|
---|
164 |
|
---|
165 | for file in cfg_configuration_files:
|
---|
166 | project.File.Add(wd_abs_path + "\\cfg\\" + file, u"configuration")
|
---|
167 |
|
---|
168 | #
|
---|
169 | # Add files fot kernel project
|
---|
170 | #
|
---|
171 | project.Change(kernel_mtsp)
|
---|
172 |
|
---|
173 | file_list = project.File.Information()
|
---|
174 | for file in file_list:
|
---|
175 | project.File.Remove(file)
|
---|
176 |
|
---|
177 | for file in kernel_kernel_files:
|
---|
178 | project.File.Add(src_abs_path + "\\" + file, u"kernel")
|
---|
179 |
|
---|
180 | for file in kernel_arch_files:
|
---|
181 | project.File.Add(src_abs_path + "\\" + file, u"arch")
|
---|
182 |
|
---|
183 | for file in kernel_target_files:
|
---|
184 | project.File.Add(src_abs_path + "\\" + file, u"target")
|
---|
185 |
|
---|
186 | #
|
---|
187 | # Add files for cfg_pass4 project
|
---|
188 | #
|
---|
189 | project.Change(cfg_pass4_mtsp)
|
---|
190 |
|
---|
191 | file_list = project.File.Information()
|
---|
192 | for file in file_list:
|
---|
193 | project.File.Remove(file)
|
---|
194 |
|
---|
195 | for file in app_app_files:
|
---|
196 | project.File.Add(wd_abs_path + "\\" + file, u"app")
|
---|
197 |
|
---|
198 | for file in app_sysmod_files:
|
---|
199 | project.File.Add(src_abs_path + "\\" + file, u"sysmod")
|
---|
200 |
|
---|
201 | for file in app_library_files:
|
---|
202 | project.File.Add(src_abs_path + "\\" + file, u"library")
|
---|
203 |
|
---|
204 | for file in app_configuration_files:
|
---|
205 | if file == 'kernel_mem.c':
|
---|
206 | file = 'kernel_mem2.c'
|
---|
207 | project.File.Add(wd_abs_path + "\\cfg\\" + file, u"configuration")
|
---|
208 |
|
---|
209 | str = src_abs_path + '\\' + statup_file
|
---|
210 | project.File.Add(str, u"ã¹ã¿ã¼ãã¢ãã")
|
---|
211 |
|
---|
212 | project.Close(True)
|
---|
213 |
|
---|
214 | #
|
---|
215 | # Modify atk2-sc3.mtpfj
|
---|
216 | #
|
---|
217 | inputstr = ReadFile('atk2-sc3.mtpj')
|
---|
218 |
|
---|
219 | # Set cx include path
|
---|
220 | inputstr = NewSetCCRHIncludes(inputstr, atk2_sc3_rel_includes, INCLUDES, SRCDIR)
|
---|
221 | # Set libary path and file
|
---|
222 | #inputstr = NewSetLibIncludes(inputstr, atk2_sc3_lib_includes, [], SRCDIR)
|
---|
223 | inputstr = NewSetLibFiles(inputstr, atk2_sc3_lib_files)
|
---|
224 | # change Option
|
---|
225 | inputstr = ChangeItemXml(inputstr, 'OutputMessageFormat-0', '%Program% %Options%')
|
---|
226 | #inputstr = ChangeItemXml(inputstr, 'UseProEpiRuntimeLibrary-0', 'False')
|
---|
227 | #inputstr = ChangeItemXml(inputstr, 'HexadecimalFileFormat-0','MotrolaSType32Bit')
|
---|
228 | inputstr = ChangeItemXml(inputstr, 'HexOptionOutputFileName-0', r'%ProjectName%.srec')
|
---|
229 | #inputstr = ChangeItemXml(inputstr, 'OutputLinkMapFile-0', 'True')
|
---|
230 | inputstr = ChangeItemXml(inputstr, 'LinkOptionPadding-0', 'True')
|
---|
231 | inputstr = ChangeItemXml(inputstr, 'LinkOptionShowSymbol-0', 'True')
|
---|
232 | #inputstr = ChangeItemXml(inputstr, 'OutputSymbolInformationToLinkMapFile-0', 'True')
|
---|
233 | inputstr = ChangeItemXml(inputstr, 'DebuggerProperty-EssentialProperty-Clock-MainClockGeneration', MAIN_CLK)
|
---|
234 | inputstr = ChangeItemXml(inputstr, 'GeneralOptionXreserveR2-0', 'True')
|
---|
235 | inputstr = ChangeItemXml(inputstr, 'COptionOsize-0', 'AdvancedSpeed')
|
---|
236 | # Change linkoption if link_option is exist.
|
---|
237 | try:
|
---|
238 | link_option = link_option
|
---|
239 | inputstr = ChangeItemXml(inputstr, 'LinkOptionStart-0', link_option)
|
---|
240 | except NameError:
|
---|
241 | link_option = ''
|
---|
242 |
|
---|
243 |
|
---|
244 |
|
---|
245 | # Set user macro definitions
|
---|
246 | inputstr = NewSetDefine(inputstr, USER_MACRO)
|
---|
247 |
|
---|
248 | # Set Prebuild/Postbuile
|
---|
249 | # inputstr = NewSetPrebuild(inputstr, atk2_sc3_pre_python_files, "./")
|
---|
250 |
|
---|
251 | WriteFile('atk2-sc3.mtpj', inputstr)
|
---|
252 |
|
---|
253 | #
|
---|
254 | # Modify ./cfg/cfg.mtsp
|
---|
255 | #
|
---|
256 | inputstr = ReadFile('./cfg/cfg.mtsp')
|
---|
257 |
|
---|
258 | # Set cx include path
|
---|
259 | inputstr = NewSetCCRHIncludes(inputstr, cfg_rel_includes, INCLUDES, "../" + SRCDIR)
|
---|
260 |
|
---|
261 | # change Option
|
---|
262 | inputstr = ChangeItemXml(inputstr, 'OutputMessageFormat-0', '%Program% %Options%')
|
---|
263 | #inputstr = ChangeItemXml(inputstr, 'UseProEpiRuntimeLibrary-0', 'False')
|
---|
264 | #inputstr = ChangeItemXml(inputstr, 'HexadecimalFileFormat-0','MotrolaSType32Bit')
|
---|
265 | inputstr = ChangeItemXml(inputstr, 'HexOptionOutputFileName-0', 'cfg1_out.srec')
|
---|
266 | #inputstr = ChangeItemXml(inputstr, 'OutputLinkMapFile-0', 'True')
|
---|
267 | inputstr = ChangeItemXml(inputstr, 'LinkOptionShowSymbol-0', 'True')
|
---|
268 | inputstr = ChangeItemXml(inputstr, 'HexOptionOutputFolder-0', '.')
|
---|
269 |
|
---|
270 | # Set Prebuild/Postbuile
|
---|
271 | inputstr = NewSetPrebuild(inputstr, cfg_pre_python_files, "../" + SRCDIR)
|
---|
272 | inputstr = NewSetPostbuild(inputstr, cfg_post_python_files, "../" + SRCDIR)
|
---|
273 |
|
---|
274 | # Set user macro definitions
|
---|
275 | inputstr = NewSetDefine(inputstr, USER_MACRO)
|
---|
276 |
|
---|
277 | WriteFile('./cfg/cfg.mtsp', inputstr)
|
---|
278 |
|
---|
279 | #
|
---|
280 | # Mofity ./kernel/kernel.mtsp
|
---|
281 | #
|
---|
282 | inputstr = ReadFile('./kernel/kernel.mtsp')
|
---|
283 |
|
---|
284 | # Add user macro definitions
|
---|
285 | kernel_define = kernel_define + USER_MACRO
|
---|
286 |
|
---|
287 | # Set cx include path
|
---|
288 | inputstr = NewSetCCRHIncludes(inputstr, kernel_rel_includes, INCLUDES, "../" + SRCDIR)
|
---|
289 | # Set cx define
|
---|
290 | inputstr = NewSetDefine(inputstr, kernel_define)
|
---|
291 | # Set cx addition option
|
---|
292 | inputstr = NewSetCAddOpt(inputstr, kernel_c_addopt)
|
---|
293 | inputstr = NewSetAsmAddOpt(inputstr, kernel_asm_addopt)
|
---|
294 |
|
---|
295 | # change Option
|
---|
296 | inputstr = ChangeItemXml(inputstr, 'OutputMessageFormat-0', '%Program% %Options%')
|
---|
297 | #inputstr = ChangeItemXml(inputstr, 'UseProEpiRuntimeLibrary-0', 'False')
|
---|
298 | inputstr = ChangeItemXml(inputstr, 'GeneralOptionXreserveR2-0', 'True')
|
---|
299 | inputstr = ChangeItemXml(inputstr, 'COptionOsize-0', 'AdvancedSpeed')
|
---|
300 |
|
---|
301 | WriteFile('./kernel/kernel.mtsp', inputstr)
|
---|
302 |
|
---|
303 | #
|
---|
304 | # Modify cfg_pass4.mtpfj
|
---|
305 | #
|
---|
306 | inputstr = ReadFile('./cfg_pass4/cfg_pass4.mtsp')
|
---|
307 |
|
---|
308 | # Set cx include path
|
---|
309 | inputstr = NewSetCCRHIncludes(inputstr, kernel_rel_includes, INCLUDES, "../" + SRCDIR)
|
---|
310 | # Set libary path and file
|
---|
311 | #inputstr = NewSetLibIncludes(inputstr, atk2_sc3_lib_includes, [], SRCDIR)
|
---|
312 | inputstr = NewSetLibFiles(inputstr, cfg_pass4_lib_files)
|
---|
313 | # change Option
|
---|
314 | inputstr = ChangeItemXml(inputstr, 'OutputMessageFormat-0', '%Program% %Options%')
|
---|
315 | #inputstr = ChangeItemXml(inputstr, 'UseProEpiRuntimeLibrary-0', 'False')
|
---|
316 | #inputstr = ChangeItemXml(inputstr, 'HexadecimalFileFormat-0','MotrolaSType32Bit')
|
---|
317 | inputstr = ChangeItemXml(inputstr, 'HexOptionOutputFileName-0', r'%ProjectName%.srec')
|
---|
318 | #inputstr = ChangeItemXml(inputstr, 'OutputLinkMapFile-0', 'True')
|
---|
319 | inputstr = ChangeItemXml(inputstr, 'LinkOptionPadding-0', 'True')
|
---|
320 | inputstr = ChangeItemXml(inputstr, 'LinkOptionShowSymbol-0', 'True')
|
---|
321 | #inputstr = ChangeItemXml(inputstr, 'OutputSymbolInformationToLinkMapFile-0', 'True')
|
---|
322 | inputstr = ChangeItemXml(inputstr, 'DebuggerProperty-EssentialProperty-Clock-MainClockGeneration', MAIN_CLK)
|
---|
323 | inputstr = ChangeItemXml(inputstr, 'GeneralOptionXreserveR2-0', 'True')
|
---|
324 | inputstr = ChangeItemXml(inputstr, 'COptionOsize-0', 'AdvancedSpeed')
|
---|
325 | # Change linkoption if link_option is exist.
|
---|
326 | try:
|
---|
327 | link_option = link_option
|
---|
328 | inputstr = ChangeItemXml(inputstr, 'LinkOptionStart-0', link_option)
|
---|
329 | except NameError:
|
---|
330 | link_option = ''
|
---|
331 |
|
---|
332 | # Set user macro definitions
|
---|
333 | inputstr = NewSetDefine(inputstr, USER_MACRO)
|
---|
334 |
|
---|
335 | # Set Prebuild/Postbuile
|
---|
336 | inputstr = NewSetPostbuild(inputstr, cfg_pass4_post_python_files, "../" + SRCDIR)
|
---|
337 |
|
---|
338 | WriteFile('./cfg_pass4/cfg_pass4.mtsp', inputstr)
|
---|
339 |
|
---|
340 | project.Open(wd_abs_path + r'\atk2-sc3.mtpj')
|
---|
341 | project.Change(atk2_sc3_mtpj)
|
---|