source: atk2-sc3-1.4.0-ntisr/arch/ccrh/configure_body.py@ 172

Last change on this file since 172 was 172, checked in by ertl-ishikawa, 8 years ago

ATK2-SC3 1.4.0 RH850依存部 非信頼C2ISR対応を追加

  • Property svn:executable set to *
File size: 12.0 KB
Line 
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
70import os.path
71import os
72import shutil
73
74# call common file
75common.Source(src_abs_path + "/arch/ccrh/common.py")
76
77src_abs_path = os.path.abspath(SRCDIR)
78wd_abs_path = os.path.abspath('.')
79cfg_mtsp = wd_abs_path + r"\cfg\cfg.mtsp"
80kernel_mtsp = wd_abs_path + r"\kernel\kernel.mtsp"
81cfg_pass4_mtsp = wd_abs_path + r"\cfg_pass4\cfg_pass4.mtsp"
82atk2_sc3_mtpj = wd_abs_path + r"\atk2-sc3.mtpj"
83
84if 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()
98print wd_abs_path + "\\atk2-sc3"
99project.Create(wd_abs_path + "\\atk2-sc3",
100 MicomType.RH850,
101 TARGET_MCU,
102 ProjectKind.Empty,
103 Compiler.CC_RH,
104 False)
105
106project.Create(wd_abs_path + "\\cfg\\cfg",
107 MicomType.RH850,
108 TARGET_MCU,
109 ProjectKind.Empty,
110 Compiler.CC_RH,
111 True)
112
113project.Create(wd_abs_path + "\\kernel\\kernel",
114 MicomType.RH850,
115 TARGET_MCU,
116 ProjectKind.Library,
117 Compiler.CC_RH,
118 True)
119
120project.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#
130debugger.DebugTool.Change(DebugTool.E1Lpd)
131
132#
133# Add files for atk2-sc3 project
134#
135for file in app_app_files:
136 project.File.Add(wd_abs_path + "\\" + file, u"app")
137
138for file in app_sysmod_files:
139 project.File.Add(src_abs_path + "\\" + file, u"sysmod")
140
141for file in app_library_files:
142 project.File.Add(src_abs_path + "\\" + file, u"library")
143
144for 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
150str = src_abs_path + '\\' + statup_file
151project.File.Add(str, u"スタートアップ")
152
153#
154# Add files fot cfg project
155#
156project.Change(cfg_mtsp)
157
158file_list = project.File.Information()
159for file in file_list:
160 project.File.Remove(file)
161
162str = src_abs_path + '\\' + statup_file
163project.File.Add(str, u"スタートアップ")
164
165for 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#
171project.Change(kernel_mtsp)
172
173file_list = project.File.Information()
174for file in file_list:
175 project.File.Remove(file)
176
177for file in kernel_kernel_files:
178 project.File.Add(src_abs_path + "\\" + file, u"kernel")
179
180for file in kernel_arch_files:
181 project.File.Add(src_abs_path + "\\" + file, u"arch")
182
183for 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#
189project.Change(cfg_pass4_mtsp)
190
191file_list = project.File.Information()
192for file in file_list:
193 project.File.Remove(file)
194
195for file in app_app_files:
196 project.File.Add(wd_abs_path + "\\" + file, u"app")
197
198for file in app_sysmod_files:
199 project.File.Add(src_abs_path + "\\" + file, u"sysmod")
200
201for file in app_library_files:
202 project.File.Add(src_abs_path + "\\" + file, u"library")
203
204for 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
209str = src_abs_path + '\\' + statup_file
210project.File.Add(str, u"スタートアップ")
211
212project.Close(True)
213
214#
215# Modify atk2-sc3.mtpfj
216#
217inputstr = ReadFile('atk2-sc3.mtpj')
218
219# Set cx include path
220inputstr = NewSetCCRHIncludes(inputstr, atk2_sc3_rel_includes, INCLUDES, SRCDIR)
221# Set libary path and file
222#inputstr = NewSetLibIncludes(inputstr, atk2_sc3_lib_includes, [], SRCDIR)
223inputstr = NewSetLibFiles(inputstr, atk2_sc3_lib_files)
224# change Option
225inputstr = ChangeItemXml(inputstr, 'OutputMessageFormat-0', '%Program% %Options%')
226#inputstr = ChangeItemXml(inputstr, 'UseProEpiRuntimeLibrary-0', 'False')
227#inputstr = ChangeItemXml(inputstr, 'HexadecimalFileFormat-0','MotrolaSType32Bit')
228inputstr = ChangeItemXml(inputstr, 'HexOptionOutputFileName-0', r'%ProjectName%.srec')
229#inputstr = ChangeItemXml(inputstr, 'OutputLinkMapFile-0', 'True')
230inputstr = ChangeItemXml(inputstr, 'LinkOptionPadding-0', 'True')
231inputstr = ChangeItemXml(inputstr, 'LinkOptionShowSymbol-0', 'True')
232#inputstr = ChangeItemXml(inputstr, 'OutputSymbolInformationToLinkMapFile-0', 'True')
233inputstr = ChangeItemXml(inputstr, 'DebuggerProperty-EssentialProperty-Clock-MainClockGeneration', MAIN_CLK)
234inputstr = ChangeItemXml(inputstr, 'GeneralOptionXreserveR2-0', 'True')
235inputstr = ChangeItemXml(inputstr, 'COptionOsize-0', 'AdvancedSpeed')
236# Change linkoption if link_option is exist.
237try:
238 link_option = link_option
239 inputstr = ChangeItemXml(inputstr, 'LinkOptionStart-0', link_option)
240except NameError:
241 link_option = ''
242
243
244
245# Set user macro definitions
246inputstr = NewSetDefine(inputstr, USER_MACRO)
247
248# Set Prebuild/Postbuile
249# inputstr = NewSetPrebuild(inputstr, atk2_sc3_pre_python_files, "./")
250
251WriteFile('atk2-sc3.mtpj', inputstr)
252
253#
254# Modify ./cfg/cfg.mtsp
255#
256inputstr = ReadFile('./cfg/cfg.mtsp')
257
258# Set cx include path
259inputstr = NewSetCCRHIncludes(inputstr, cfg_rel_includes, INCLUDES, "../" + SRCDIR)
260
261# change Option
262inputstr = ChangeItemXml(inputstr, 'OutputMessageFormat-0', '%Program% %Options%')
263#inputstr = ChangeItemXml(inputstr, 'UseProEpiRuntimeLibrary-0', 'False')
264#inputstr = ChangeItemXml(inputstr, 'HexadecimalFileFormat-0','MotrolaSType32Bit')
265inputstr = ChangeItemXml(inputstr, 'HexOptionOutputFileName-0', 'cfg1_out.srec')
266#inputstr = ChangeItemXml(inputstr, 'OutputLinkMapFile-0', 'True')
267inputstr = ChangeItemXml(inputstr, 'LinkOptionShowSymbol-0', 'True')
268inputstr = ChangeItemXml(inputstr, 'HexOptionOutputFolder-0', '.')
269
270# Set Prebuild/Postbuile
271inputstr = NewSetPrebuild(inputstr, cfg_pre_python_files, "../" + SRCDIR)
272inputstr = NewSetPostbuild(inputstr, cfg_post_python_files, "../" + SRCDIR)
273
274# Set user macro definitions
275inputstr = NewSetDefine(inputstr, USER_MACRO)
276
277WriteFile('./cfg/cfg.mtsp', inputstr)
278
279#
280# Mofity ./kernel/kernel.mtsp
281#
282inputstr = ReadFile('./kernel/kernel.mtsp')
283
284# Add user macro definitions
285kernel_define = kernel_define + USER_MACRO
286
287# Set cx include path
288inputstr = NewSetCCRHIncludes(inputstr, kernel_rel_includes, INCLUDES, "../" + SRCDIR)
289# Set cx define
290inputstr = NewSetDefine(inputstr, kernel_define)
291# Set cx addition option
292inputstr = NewSetCAddOpt(inputstr, kernel_c_addopt)
293inputstr = NewSetAsmAddOpt(inputstr, kernel_asm_addopt)
294
295# change Option
296inputstr = ChangeItemXml(inputstr, 'OutputMessageFormat-0', '%Program% %Options%')
297#inputstr = ChangeItemXml(inputstr, 'UseProEpiRuntimeLibrary-0', 'False')
298inputstr = ChangeItemXml(inputstr, 'GeneralOptionXreserveR2-0', 'True')
299inputstr = ChangeItemXml(inputstr, 'COptionOsize-0', 'AdvancedSpeed')
300
301WriteFile('./kernel/kernel.mtsp', inputstr)
302
303#
304# Modify cfg_pass4.mtpfj
305#
306inputstr = ReadFile('./cfg_pass4/cfg_pass4.mtsp')
307
308# Set cx include path
309inputstr = NewSetCCRHIncludes(inputstr, kernel_rel_includes, INCLUDES, "../" + SRCDIR)
310# Set libary path and file
311#inputstr = NewSetLibIncludes(inputstr, atk2_sc3_lib_includes, [], SRCDIR)
312inputstr = NewSetLibFiles(inputstr, cfg_pass4_lib_files)
313# change Option
314inputstr = ChangeItemXml(inputstr, 'OutputMessageFormat-0', '%Program% %Options%')
315#inputstr = ChangeItemXml(inputstr, 'UseProEpiRuntimeLibrary-0', 'False')
316#inputstr = ChangeItemXml(inputstr, 'HexadecimalFileFormat-0','MotrolaSType32Bit')
317inputstr = ChangeItemXml(inputstr, 'HexOptionOutputFileName-0', r'%ProjectName%.srec')
318#inputstr = ChangeItemXml(inputstr, 'OutputLinkMapFile-0', 'True')
319inputstr = ChangeItemXml(inputstr, 'LinkOptionPadding-0', 'True')
320inputstr = ChangeItemXml(inputstr, 'LinkOptionShowSymbol-0', 'True')
321#inputstr = ChangeItemXml(inputstr, 'OutputSymbolInformationToLinkMapFile-0', 'True')
322inputstr = ChangeItemXml(inputstr, 'DebuggerProperty-EssentialProperty-Clock-MainClockGeneration', MAIN_CLK)
323inputstr = ChangeItemXml(inputstr, 'GeneralOptionXreserveR2-0', 'True')
324inputstr = ChangeItemXml(inputstr, 'COptionOsize-0', 'AdvancedSpeed')
325# Change linkoption if link_option is exist.
326try:
327 link_option = link_option
328 inputstr = ChangeItemXml(inputstr, 'LinkOptionStart-0', link_option)
329except NameError:
330 link_option = ''
331
332# Set user macro definitions
333inputstr = NewSetDefine(inputstr, USER_MACRO)
334
335# Set Prebuild/Postbuile
336inputstr = NewSetPostbuild(inputstr, cfg_pass4_post_python_files, "../" + SRCDIR)
337
338WriteFile('./cfg_pass4/cfg_pass4.mtsp', inputstr)
339
340project.Open(wd_abs_path + r'\atk2-sc3.mtpj')
341project.Change(atk2_sc3_mtpj)
Note: See TracBrowser for help on using the repository browser.