-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtms320c6000.jam
285 lines (235 loc) · 13.1 KB
/
tms320c6000.jam
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
# Boost.Build support for the Texas Instruments TMS320C6000 Code Generation
# Tools.
#
# @todo add automatic library and runtime selection
# @todo add linker command file library
# @todo deal with dynamic linking
# @todo deal with multi-threaded?
import property ;
import generators ;
import os ;
import type ;
import toolset ;
import testing ;
import errors ;
import feature ;
import path ;
import common ;
import errors ;
import tms320_common ;
if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ]
{
.debug-configuration = true ;
}
feature.extend toolset : tms320c6000 ;
feature.extend architecture :
tms320c6000
;
feature.extend instruction-set :
tms320c6000
tms320c6200
tms320c6400
tms320c64x+
tms320c6700
tms320c6713
tms320c67x+
;
type.register H62 : h62 : H ;
type.register H64 : h64 : H ;
type.register H67 : h67 : H ;
type.register S62 : s62 : ASM ;
type.register S64 : s64 : ASM ;
type.register S67 : s67 : ASM ;
type.register O62 : o62 ;
type.register O64 : o64 ;
type.register O64P : o64P ;
type.register O67 : o67 ;
type.register O67P : o67P ;
type.register A62 : a62 l62 ;
type.register A64 : a64 l64 ;
type.register A64P : a64p a64P l64p l64P ;
type.register A67 : a67 l67 ;
type.register A67P : a67p a67P l67p l67P ;
type.set-generated-target-suffix EXE : <toolset>tms320c6000 : out ;
type.set-generated-target-suffix OBJ : <toolset>tms320c6000 : obj ;
type.set-generated-target-suffix STATIC_LIB : <toolset>tms320c6000 : lib ;
generators.register-linker tms320c6000.link : OBJ O62 A62 STATIC_LIB : EXE : <toolset>tms320c6000 <target-os>baremetal ;
generators.register-linker tms320c6000.link : OBJ O62 O64 O64P A62 A64 STATIC_LIB : EXE : <toolset>tms320c6000 <architecture>tms320c6000 <instruction-set>tms320c6400 <target-os>baremetal ;
generators.register-linker tms320c6000.link : OBJ O62 O64 O64P A62 A64 A64P STATIC_LIB : EXE : <toolset>tms320c6000 <architecture>tms320c6000 <instruction-set>tms320c64x+ <target-os>baremetal ;
generators.register-linker tms320c6000.link : OBJ O62 O67 O67P A62 A67 STATIC_LIB : EXE : <toolset>tms320c6000 <architecture>tms320c6000 <instruction-set>tms320c6700 <target-os>baremetal ;
generators.register-linker tms320c6000.link : OBJ O62 O67 O67P A62 A67 STATIC_LIB : EXE : <toolset>tms320c6000 <architecture>tms320c6000 <instruction-set>tms320c6713 <target-os>baremetal ;
generators.register-linker tms320c6000.link : OBJ O62 O67 O67P A62 A67 A67P STATIC_LIB : EXE : <toolset>tms320c6000 <architecture>tms320c6000 <instruction-set>tms320c67x+ <target-os>baremetal ;
generators.register-archiver tms320c6000.archive : OBJ O62 : STATIC_LIB : <toolset>tms320c6000 <target-os>baremetal ;
generators.register-archiver tms320c6000.archive : OBJ O62 O64 : STATIC_LIB : <toolset>tms320c6000 <architecture>tms320c6000 <instruction-set>tms320c6400 <target-os>baremetal ;
generators.register-archiver tms320c6000.archive : OBJ O62 O64 O64P : STATIC_LIB : <toolset>tms320c6000 <architecture>tms320c6000 <instruction-set>tms320c64x+ <target-os>baremetal ;
generators.register-archiver tms320c6000.archive : OBJ O62 O67 : STATIC_LIB : <toolset>tms320c6000 <architecture>tms320c6000 <instruction-set>tms320c6700 <target-os>baremetal ;
generators.register-archiver tms320c6000.archive : OBJ O62 O67 O67P : STATIC_LIB : <toolset>tms320c6000 <architecture>tms320c6000 <instruction-set>tms320c67x+ <target-os>baremetal ;
generators.register-c-compiler tms320c6000.compile.c++ : CPP : OBJ : <toolset>tms320c6000 <target-os>baremetal ;
generators.register-c-compiler tms320c6000.compile.c : C : OBJ : <toolset>tms320c6000 <target-os>baremetal ;
generators.register-c-compiler tms320c6000.compile.asm : ASM : OBJ : <toolset>tms320c6000 <target-os>baremetal ;
rule init ( version ? : command * : options * )
{
# Check that the host operating system is supported. If it is not,
# continue without configuring so we can still build targets that do
# not need this toolset.
if [ os.name ] = NT || [ os.name ] = CYGWIN || [ os.name ] = LINUX || [ os.name ] = MACOSX
{
command = [ common.get-invocation-command tms320c6000 : cl6x : $(command) ] ;
if $(command)
{
local output-lines = [ SPLIT_BY_CHARACTERS [ SHELL "\"$(command)\"" ] : "\n" ] ;
local detected-version-components = [ MATCH "([0-9]+\\.[0-9]+(\\.[0-9]+)?)" : $(output-lines[1]) ] ;
local detected-version = $(detected-version-components[1]) ;
if ! $(detected-version)
{
errors.user-error "tms320c6000: no version detected" ;
}
if $(version)
{
if $(detected-version) != $(version)
{
errors.user-error "tms320c6000: detected version (" $(detected-version) ") does not match desired (" $(version) ")" ;
}
}
if $(detected-version)
{
version = $(detected-version) ;
}
}
else
{
errors.user-error "tms320c6000: cl6x not found at" $(command) ;
}
root = [ common.get-absolute-tool-path $(command[-1]) ] ;
root = $(root:P) ;
local condition = [ common.check-init-parameters tms320c6000 : version $(version) ] ;
common.handle-options tms320c6000 : $(condition) : $(command) : $(options) ;
#toolset.add-requirements <toolset>tms320c6000:<testing.launcher>"$(root[0])/bin/load6x.exe" ;
toolset.add-requirements <toolset>tms320c6000:<testing.launcher>echo ;
if $(.debug-configuration)
{
ECHO "tms320c6000: using compiler" $(version) "at" $(root) ;
}
toolset.flags tms320c6000 .bin $(condition) : $(root)/bin ;
# Declare flags
toolset.flags tms320c6000.link OPTIONS $(condition)/<strip>off : ;
toolset.flags tms320c6000.link OPTIONS $(condition)/<strip>on : -s ;
toolset.flags tms320c6000.compile OPTIONS $(condition)/<debug-symbols>off : ;
toolset.flags tms320c6000.compile OPTIONS $(condition)/<debug-symbols>on : -g ;
toolset.flags tms320c6000.compile OPTIONS $(condition)/<optimization>off : ;
toolset.flags tms320c6000.compile OPTIONS $(condition)/<optimization>speed : -O3 ;
toolset.flags tms320c6000.compile OPTIONS $(condition)/<optimization>space : -ms=3 ;
# @todo fill in completely
# toolset.flags tms320c6000.compile OPTIONS $(condition)/<profiling>off : ;
# toolset.flags tms320c6000.compile OPTIONS $(condition)/<profiling>on : ;
toolset.flags tms320c6000.compile OPTIONS $(condition)/<inlining>off : -pi ;
toolset.flags tms320c6000.compile OPTIONS $(condition)/<inlining>on : ;
toolset.flags tms320c6000.compile OPTIONS $(condition)/<inlining>full : ;
toolset.flags tms320c6000.compile.c++ OPTIONS $(condition)/<rtti>off : ;
toolset.flags tms320c6000.compile.c++ OPTIONS $(condition)/<rtti>on : -rtti ;
toolset.flags tms320c6000.compile.c++ OPTIONS $(condition)/<exception-handling>off : ;
toolset.flags tms320c6000.compile.c++ OPTIONS $(condition)/<exception-handling>on : --exceptions ;
toolset.flags tms320c6000.compile OPTIONS $(condition)/<warnings>off : -pdw ;
toolset.flags tms320c6000.compile OPTIONS $(condition)/<warnings>all : ;
toolset.flags tms320c6000.compile OPTIONS $(condition)/<warnings-as-errors>off : ;
toolset.flags tms320c6000.compile OPTIONS $(condition)/<warnings-as-errors>on : -pdew ;
toolset.flags tms320c6000.link OPTIONS $(condition) : <linkflags> ;
toolset.flags tms320c6000.archive AROPTIONS $(condition) : <archiveflags> ;
toolset.flags tms320c6000.compile OPTIONS $(condition) : <compileflags> ;
toolset.flags tms320c6000.compile.c OPTIONS $(condition) : <cflags> ;
toolset.flags tms320c6000.compile.c++ OPTIONS $(condition) : <cxxflags> ;
toolset.flags tms320c6000.compile.asm OPTIONS $(condition) : <asmflags> ;
toolset.flags tms320c6000.compile STDHDRS $(condition) : $(root)/include ;
toolset.flags tms320c6000.compile DEFINES $(condition) : <define> ;
toolset.flags tms320c6000.compile UNDEFINES $(condition) : <undef> ;
toolset.flags tms320c6000.compile INCLUDES $(condition) : <include> ;
toolset.flags tms320c6000.compile DEFINE_OPTION $(condition) : -D : unchecked ;
toolset.flags tms320c6000.compile UNDEFINE_OPTION $(condition) : -U : unchecked ;
toolset.flags tms320c6000.compile INCLUDE_PATH_OPTION $(condition) : -I : unchecked ;
toolset.flags tms320c6000.compile SYSTEM_INCLUDE_PATH_OPTION $(condition) : -I : unchecked ;
# @todo endianess left at default for now.
toolset.flags tms320c6000.link DEFAULTS $(condition) : -qq ;
toolset.flags tms320c6000.compile.c DEFAULTS $(condition) : -qq ;
toolset.flags tms320c6000.compile.c++ DEFAULTS $(condition) : -qq --static_template_instantiation ;
toolset.flags tms320c6000.compile.asm DEFAULTS $(condition) : -qq ;
toolset.flags tms320c6000.link DEFINES $(condition) : <define> ;
toolset.flags tms320c6000.link UNDEFINES $(condition) : <undef> ;
toolset.flags tms320c6000.link DEFINE_OPTION $(condition) : --define= : unchecked ;
toolset.flags tms320c6000.link UNDEFINE_OPTION $(condition) : --undefine= : unchecked ;
toolset.flags tms320c6000.link STDLIBPATH $(condition) : $(root)/lib ;
toolset.flags tms320c6000.link LIBRARY_PATH $(condition) : <library-path> ;
toolset.flags tms320c6000.link FINDLIBS_ST $(condition) : <find-static-library> ;
toolset.flags tms320c6000.link FINDLIBS_SA $(condition) : <find-shared-library> ;
toolset.flags tms320c6000.link LIBRARIES $(condition) : <library-file> ;
toolset.flags tms320c6000.link LIBRARY_PATH_OPTION $(condition) : -i : unchecked ;
toolset.flags tms320c6000.link LIBRARY_OPTION $(condition) : -l : unchecked ;
toolset.flags tms320c6000.link RUN_PATH $(condition) : $(root)/bin ;
toolset.flags tms320c6000.hex OPTIONS $(condition) : <flags> ;
toolset.flags tms320c6000.hex HEX_OUTPUT_OPTION $(condition) : -o ;
cpu-flags tms320c6000.compile OPTIONS : $(condition) : tms320c6000 : tms320c6000 : -mv6200 : default ;
cpu-flags tms320c6000.compile OPTIONS : $(condition) : tms320c6000 : tms320c6200 : -mv6200 ;
cpu-flags tms320c6000.compile OPTIONS : $(condition) : tms320c6000 : tms320c6400 : -mv6400 ;
cpu-flags tms320c6000.compile OPTIONS : $(condition) : tms320c6000 : tms320c64x+ : -mv6400+ ;
cpu-flags tms320c6000.compile OPTIONS : $(condition) : tms320c6000 : tms320c6700 : -mv6700 ;
cpu-flags tms320c6000.compile OPTIONS : $(condition) : tms320c6000 : tms320c6713 : -mv6713 ;
cpu-flags tms320c6000.compile OPTIONS : $(condition) : tms320c6000 : tms320c67x+ : -mv6700+ ;
}
else
{
ECHO "tms320c6000: warning: unsupported operating system" os.name ;
}
}
# @todo put all these options in a variable or a response file.
actions compile.c
{
"$(CONFIG_COMMAND)" $(DEFAULTS) -eo $(<:S) -ec $(>:S) -c $(OPTIONS) $(DEFINE_OPTION)$(DEFINES) $(UNDEFINE_OPTION)$(UNDEFINES) $(SYSTEM_INCLUDE_PATH_OPTION)"$(STDHDRS:W)" $(INCLUDE_PATH_OPTION)"$(INCLUDES:W)" -fr "$(<:DW)" -fs "$(<:DW)" -ft "$(<:DW)" --pp_directory "$(<:DW)" "$(>:W)"
}
actions compile.c++
{
"$(CONFIG_COMMAND)" $(DEFAULTS) -eo $(<:S) -ep $(>:S) -c $(OPTIONS) $(DEFINE_OPTION)$(DEFINES) $(UNDEFINE_OPTION)$(UNDEFINES) $(SYSTEM_INCLUDE_PATH_OPTION)"$(STDHDRS:W)" $(INCLUDE_PATH_OPTION)"$(INCLUDES:W)" -fr "$(<:DW)" -fs "$(<:DW)" -ft "$(<:DW)" --pp_directory "$(<:DW)" "$(>:W)"
}
actions compile.asm
{
"$(CONFIG_COMMAND)" $(DEFAULTS) -eo $(<:S) -ea $(>:S) -c $(OPTIONS) $(DEFINE_OPTION)$(DEFINES) $(UNDEFINE_OPTION)$(UNDEFINES) $(SYSTEM_INCLUDE_PATH_OPTION)"$(STDHDRS:W)" $(INCLUDE_PATH_OPTION)"$(INCLUDES:W)" -fr "$(<:DW)" -fs "$(<:DW)" -ft "$(<:DW)" --pp_directory "$(<:DW)" "$(>:W)"
}
actions link
{
"$(CONFIG_COMMAND)" $(DEFAULTS) -z -w -x $(OPTIONS) $(DEFINE_OPTION)$(DEFINES) $(UNDEFINE_OPTION)$(UNDEFINES) $(LIBRARY_PATH_OPTION)"$(LIBRARY_PATH:W)" $(LIBRARY_PATH_OPTION)"$(STDLIBPATH:W)" -o "$(<:W)" -m "$(<:S=.map)" "$(>:W)" $(LIBRARY_OPTION)"$(LIBRARIES:W)" $(LIBRARY_OPTION)"$(STDLIBRARIES:W)"
}
RM = [ common.rm-command ] ;
actions together piecemeal archive
{
$(RM) "$(<)"
"$(.bin)/ar6x" $(AROPTIONS) qrv "$(<:W)" "$(>:W)"
}
# Hex Converter
# @todo Hex should become a top-level target type
actions hex
{
"$(.bin)/hex6x" -q $(OPTIONS) $(HEX_OUTPUT_OPTION)"$(<)" -map "$(<:S=.hex.map)" "$(>)"
}
local rule cpu-flags ( toolset variable : condition ? : architecture : instruction-set + : values * : default ? )
{
if $(condition)
{
if $(default)
{
# architecture and instruction-set are not set
toolset.flags $(toolset) $(variable) $(condition)/<architecture>/<instruction-set> : $(values) ;
# instruction-set is not set
toolset.flags $(toolset) $(variable) $(condition)/<architecture>$(architecture)/<instruction-set> : $(values) ;
}
toolset.flags $(toolset) $(variable) $(condition)/<architecture>/<instruction-set>$(instruction-set) $(condition)/<architecture>$(architecture)/<instruction-set>$(instruction-set) : $(values) ;
}
else
{
if $(default)
{
# architecture and instruction-set are not set
toolset.flags $(toolset) $(variable) <architecture>/<instruction-set> : $(values) ;
# instruction-set is not set
toolset.flags $(toolset) $(variable) <architecture>$(architecture)/<instruction-set> : $(values) ;
}
toolset.flags $(toolset) $(variable) <architecture>/<instruction-set>$(instruction-set) <architecture>$(architecture)/<instruction-set>$(instruction-set) : $(values) ;
}
}