source: rubycfg_asp/trunk/asp_dcre/arch/ccrx/configure_body.py@ 313

Last change on this file since 313 was 313, checked in by coas-nagasima, 7 years ago

ソースを追加

File size: 4.6 KB
Line 
1#!python
2# -*- coding: utf-8 -*-
3import os.path
4import os
5import shutil
6
7#
8# variable definition
9#
10INCLUDES = []
11CFG1_DEF_TABLES = []
12
13# call common file
14common.Source(src_abs_path + "/arch/ccrx/common.py")
15
16src_abs_path = os.path.abspath(SRCDIR)
17wd_abs_path = os.path.abspath('.')
18cfg_mtsp = wd_abs_path + r"\cfg\cfg.mtsp"
19kernel_mtsp = wd_abs_path + r"\kernel\kernel.mtsp"
20asp_mtpj = wd_abs_path + r"\asp.mtpj"
21
22
23if COPY_SAMPLE1:
24 shutil.copy(src_abs_path + r'/sample/sample1.c', '.')
25 shutil.copy(src_abs_path + r'/sample/sample1.h', '.')
26 shutil.copy(src_abs_path + r'/sample/sample1.cfg', '.')
27
28#
29# close project
30#
31#project.Close()
32print wd_abs_path + "\\asp_dcre"
33project.Create(wd_abs_path + "\\asp_dcre",
34 MicomType.RX,
35 TARGET_MCU,
36 ProjectKind.Empty,
37 Compiler.CC_RX,
38 False)
39
40project.Create(wd_abs_path + "\\cfg\\cfg",
41 MicomType.RX,
42 TARGET_MCU,
43 ProjectKind.Empty,
44 Compiler.CC_RX,
45 True)
46
47project.Create(wd_abs_path + "\\kernel\\kernel",
48 MicomType.RX,
49 TARGET_MCU,
50 ProjectKind.Library,
51 Compiler.CC_RX,
52 True)
53
54#
55# Change debug tool
56#
57#debugger.DebugTool.Change(DebugTool.Serial)
58
59#
60# Add files for asp
61#
62for file in asp_app_files:
63 project.File.Add(wd_abs_path + "\\" + file, u"app")
64
65for file in asp_syssvc_files:
66 project.File.Add(src_abs_path + "\\" + file, u"syssvc")
67
68for file in asp_library_files:
69 project.File.Add(src_abs_path + "\\" + file, u"library")
70
71for file in asp_configuration_files:
72 project.File.Add(wd_abs_path + "\\cfg\\" + file, u"configuration")
73
74str = src_abs_path + '\\' + statup_file
75project.File.Add(str, u"スタートアップ")
76
77#
78# Add files fot cfg
79#
80project.Change(cfg_mtsp)
81
82for file in cfg_configuration_files:
83 project.File.Add(wd_abs_path + "\\cfg\\" + file, u"configuration")
84
85#
86# Add files fot kernel
87#
88project.Change(kernel_mtsp)
89
90for file in kernel_kernel_files:
91 project.File.Add(src_abs_path + "\\" + file, u"kernel")
92
93for file in kernel_arch_files:
94 project.File.Add(src_abs_path + "\\" + file, u"arch")
95
96for file in kernel_target_files:
97 project.File.Add(src_abs_path + "\\" + file, u"target")
98
99for file in kernel_pdic_files:
100 project.File.Add(src_abs_path + "\\" + file, u"pdic")
101
102
103project.Close(True)
104
105
106#
107# Modify asp.mtpfj
108#
109inputstr = ReadFile('asp.mtpj')
110
111# Set ccrx include path
112inputstr = NewSetCcrxIncludes(inputstr, asp_rel_includes, INCLUDES, SRCDIR)
113# Set libary path and file
114inputstr = NewSetLibFiles(inputstr, asp_lib_files)
115# change Option
116inputstr = ChangeItemXml(inputstr, 'OutputMessageFormat-0', '%Program% %Options%')
117inputstr = ChangeItemXml(inputstr, 'LinkOptionStart-0', 'B_1,R_1,B_2,R_2,B,R,SI/00000000,C$VECT,P_START,C_1,C_2,C,D_1,D_2,D,P,W_1,W_2,W,L/FFF00000,FVECT/FFFFFFD0')
118inputstr = ChangeItemXml(inputstr, 'LinkOptionConvertFileName-0', '%ProjectName%.srec')
119inputstr = ChangeItemXml(inputstr, 'LinkOptionShowSymbol-0', 'True')
120inputstr = NewSetItemXml(inputstr, 'LinkOptionRom-0', 'D=R\nD_1=R_1\nD_2=R_2\n')
121# Set ccrx assembler include path
122inputstr = NewSetItemXml(inputstr, 'AsmOptionInclude-0', SRCDIR + "target/" + TARGET)
123# Set Prebuild/Postbuile
124inputstr = NewSetPostbuild(inputstr, asp_post_python_files, SRCDIR)
125
126WriteFile('asp.mtpj', inputstr)
127
128#
129# Modify ./cfg/cfg.mtsp
130#
131inputstr = ReadFile('./cfg/cfg.mtsp')
132
133# Set ccrx include path
134inputstr = NewSetCcrxIncludes(inputstr, cfg_rel_includes, INCLUDES, "../" + SRCDIR)
135# change Option
136inputstr = ChangeItemXml(inputstr, 'OutputMessageFormat-0', '%Program% %Options%')
137inputstr = ChangeItemXml(inputstr, 'LinkOptionConvertFileName-0', 'cfg1_out.srec')
138inputstr = ChangeItemXml(inputstr, 'LinkOptionConvertFolder-0', '.')
139inputstr = ChangeItemXml(inputstr, 'LinkOptionStart-0', 'C_1,C_2,C,P/0FFFF8100')
140inputstr = ChangeItemXml(inputstr, 'LinkOptionRom-0', '')
141inputstr = ChangeItemXml(inputstr, 'LinkOptionShowSymbol-0', 'True')
142# Set Prebuild/Postbuile
143inputstr = NewSetPrebuild(inputstr, cfg_pre_python_files, "../" + SRCDIR)
144inputstr = NewSetPostbuild(inputstr, cfg_post_python_files, "../" + SRCDIR)
145
146inputstr = NewSetDefine(inputstr, cfg_define)
147
148WriteFile('./cfg/cfg.mtsp', inputstr)
149
150#
151# Mofity ./kernel/kernel.mtsp
152#
153inputstr = ReadFile('./kernel/kernel.mtsp')
154
155# Set ccrx include path
156inputstr = NewSetCcrxIncludes(inputstr, kernel_rel_includes, INCLUDES, "../" + SRCDIR)
157# Set ccrx define
158inputstr = NewSetDefine(inputstr, kernel_define)
159# Set ccrx assembler include path
160inputstr = NewSetItemXml(inputstr, 'AsmOptionInclude-0', "../cfg")
161# change Option
162
163WriteFile('./kernel/kernel.mtsp', inputstr)
164
165project.Open(wd_abs_path + r'\asp.mtpj')
166project.Change(asp_mtpj)
Note: See TracBrowser for help on using the repository browser.