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