source: atk2-sc3_fl850f1l/arch/ccrh/post_cfg.py@ 117

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

ATK2-SC3 1.3.2 FL850F1L(RH850F1L)依存部(GCC/GHS/CCRH)を追加

File size: 5.1 KB
Line 
1#!python
2# -*- coding: euc-jp -*-
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# 上記著作権者は,以下の(1)〜(4)の条件を満たす場合に限り,本ソフトウェ
18# ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
19# 変・再配布(以下,利用と呼ぶ)することを無償で許諾する.
20# (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
21# 権表示,この利用条件および下記の無保証規定が,そのままの形でソー
22# スコード中に含まれていること.
23# (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
24# 用できる形で再配布する場合には,再配布に伴うドキュメント(利用
25# 者マニュアルなど)に,上記の著作権表示,この利用条件および下記
26# の無保証規定を掲載すること.
27# (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
28# 用できない形で再配布する場合には,次のいずれかの条件を満たすこ
29# と.
30# (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
31# 作権表示,この利用条件および下記の無保証規定を掲載すること.
32# (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
33# 報告すること.
34# (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
35# 害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
36# また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理
37# 由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
38# 免責すること.
39#
40# 本ソフトウェアは,AUTOSAR(AUTomotive Open System ARchitecture)仕
41# 様に基づいている.上記の許諾は,AUTOSARの知的財産権を許諾するもので
42# はない.AUTOSARは,AUTOSAR仕様に基づいたソフトウェアを商用目的で利
43# 用する者に対して,AUTOSARパートナーになることを求めている.
44#
45# 本ソフトウェアは,無保証で提供されているものである.上記著作権者お
46# よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
47# に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ
48# アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
49# の責任を負わない.
50#
51# $Id: post_cfg.py 181 2015-06-12 10:02:03Z t_ishikawa $
52#
53
54import subprocess
55import os
56import sys
57import re # for regular expression
58import shutil
59import os.path
60
61# set relative path from top proj
62proj_rel_dir = "../"
63
64# call definition file
65common.Source(proj_rel_dir + "def.py")
66
67# path
68src_abs_path = os.path.abspath(proj_rel_dir + SRCDIR)
69
70# call common file
71common.Source(src_abs_path + "/arch/ccrh/common.py")
72
73#
74# convert map file
75#
76inputfile = open("./DefaultBuild/cfg.map")
77outputfile = open("cfg1_out.syms", 'w')
78
79r = re.compile("^\s+([0-9a-f]+)\s+[0-9a-f]+\s+\w+\s+,\w+\s+\*\s+")
80line = inputfile.readline()
81pre_line = line
82while line:
83 line = line.replace('\r\n','') #delete newline
84 m = r.search(line)
85 if m:
86 outputfile.write(m.group(1) + " T " + pre_line + "\n")
87 pre_line = line
88 line = inputfile.readline()
89
90inputfile.close()
91outputfile.close()
92
93# remove Os_Lcfg.c
94if os.path.isfile('Os_Lcfg.c'):
95 os.remove('Os_Lcfg.c')
96
97#
98# Execute cfg path 2
99#
100# make command
101cfg_command = cfg + " --pass 2 " + "--kernel " + CFG_KERNEL
102cfg_command += " --api-table " + cfg_api_table
103cfg_command += " " + cfg_cfg1_def_tables + cfg_includes
104cfg_command += " -T " + cfg_tf
105cfg_command += " --ini-file " + cfg_ini_file
106cfg_command += " " + cfg_input_str
107
108print cfg_command
109
110# Execute
111try:
112 output = subprocess.check_output(cfg_command, stderr=subprocess.STDOUT,)
113except subprocess.CalledProcessError, e:
114 print "ERROR!! : ", e.output
115 sys.exit()
116
117output.replace('\r','')
118print output
119
120#
121# mov Os_Cfg_tmp.h Os_Cfg.h
122#
123import filecmp
124if not os.path.isfile(r'Os_Cfg.h'):
125 print "Rename Os_Cfg_tmp.h to Os_Cfg.h"
126 shutil.move("Os_Cfg_tmp.h", "Os_Cfg.h")
127else:
128 print "compare Os_Cfg_tmp.h and Os_Cfg.h"
129 if not filecmp.cmp(r'Os_Cfg_tmp.h', r'Os_Cfg.h'):
130 print "Rename Os_Cfg_tmp.h to Os_Cfg.h"
131 shutil.move("Os_Cfg_tmp.h", "Os_Cfg.h")
132 else:
133 print "Delete Os_Cfg_tmp.h"
134 os.remove("Os_Cfg_tmp.h")
135
136#
137# Execute cfg path 3
138#
139# make command
140cfg_command = cfg + " --pass 3 " + "--kernel " + CFG_KERNEL
141cfg_command += " --api-table " + cfg_api_table
142cfg_command += " " + cfg_cfg1_def_tables + cfg_includes
143cfg_command += " --rom-image cfg1_out.srec --symbol-table cfg1_out.syms"
144cfg_command += " -T " + cfg_offset_tf
145cfg_command += " --ini-file " + cfg_ini_file
146cfg_command += " " + cfg_input_str
147
148
149print cfg_command
150
151# Execute
152try:
153 output = subprocess.check_output(cfg_command, stderr=subprocess.STDOUT,)
154except subprocess.CalledProcessError, e:
155 print "ERROR!! : ", e.output
156 sys.exit()
157
158output.replace('\r','')
159print output
160
161common.Source("./ldscript.py")
162
Note: See TracBrowser for help on using the repository browser.