source: atk2-sc3-1.4.0-ntisr/arch/ccrh/post_cfg.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: 5.8 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-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.py 181 2015-06-12 10:02:03Z t_ishikawa $
68#
69
70import subprocess
71import os
72import sys
73import re # for regular expression
74import shutil
75import os.path
76
77# set relative path from top proj
78proj_rel_dir = "../"
79
80# call definition file
81common.Source(proj_rel_dir + "def.py")
82
83# path
84src_abs_path = os.path.abspath(proj_rel_dir + SRCDIR)
85
86# call common file
87common.Source(src_abs_path + "/arch/ccrh/common.py")
88
89#
90# convert map file
91#
92inputfile = open("./DefaultBuild/cfg.map")
93outputfile = open("cfg1_out.syms", 'w')
94
95r = re.compile("^\s+([0-9a-f]+)\s+[0-9a-f]+\s+\w+\s+,\w+\s+\*\s+")
96line = inputfile.readline()
97pre_line = line
98while line:
99 line = line.replace('\r\n','') #delete newline
100 m = r.search(line)
101 if m:
102 outputfile.write(m.group(1) + " T " + pre_line + "\n")
103 pre_line = line
104 line = inputfile.readline()
105
106inputfile.close()
107outputfile.close()
108
109# remove Os_Lcfg.c
110if os.path.isfile('Os_Lcfg.c'):
111 os.remove('Os_Lcfg.c')
112
113#
114# Execute cfg path 2
115#
116# make command
117cfg_command = cfg + " --pass 2 " + "--kernel " + CFG_KERNEL
118cfg_command += " --api-table " + cfg_api_table
119cfg_command += " " + cfg_cfg1_def_tables + cfg_includes
120cfg_command += " -T " + cfg_tf
121cfg_command += " --ini-file " + cfg_ini_file
122cfg_command += " " + cfg_input_str
123
124print cfg_command
125
126# Execute
127try:
128 output = subprocess.check_output(cfg_command, stderr=subprocess.STDOUT,)
129except subprocess.CalledProcessError, e:
130 print "ERROR!! : ", e.output
131 sys.exit()
132
133output.replace('\r','')
134print output
135
136#
137# mov Os_Cfg_tmp.h Os_Cfg.h
138#
139import filecmp
140if not os.path.isfile(r'Os_Cfg.h'):
141 print "Rename Os_Cfg_tmp.h to Os_Cfg.h"
142 shutil.move("Os_Cfg_tmp.h", "Os_Cfg.h")
143else:
144 print "compare Os_Cfg_tmp.h and Os_Cfg.h"
145 if not filecmp.cmp(r'Os_Cfg_tmp.h', r'Os_Cfg.h'):
146 print "Rename Os_Cfg_tmp.h to Os_Cfg.h"
147 shutil.move("Os_Cfg_tmp.h", "Os_Cfg.h")
148 else:
149 print "Delete Os_Cfg_tmp.h"
150 os.remove("Os_Cfg_tmp.h")
151
152#
153# Execute cfg path 3
154#
155# make command
156cfg_command = cfg + " --pass 3 " + "--kernel " + CFG_KERNEL
157cfg_command += " --api-table " + cfg_api_table
158cfg_command += " " + cfg_cfg1_def_tables + cfg_includes
159cfg_command += " --rom-image cfg1_out.srec --symbol-table cfg1_out.syms"
160cfg_command += " -T " + cfg_offset_tf
161cfg_command += " --ini-file " + cfg_ini_file
162cfg_command += " " + cfg_input_str
163
164
165print cfg_command
166
167# Execute
168try:
169 output = subprocess.check_output(cfg_command, stderr=subprocess.STDOUT,)
170except subprocess.CalledProcessError, e:
171 print "ERROR!! : ", e.output
172 sys.exit()
173
174output.replace('\r','')
175print output
176
177common.Source("./ldscript.py")
178
Note: See TracBrowser for help on using the repository browser.