-
Notifications
You must be signed in to change notification settings - Fork 0
/
tms320c2000.jam
256 lines (206 loc) · 10.9 KB
/
tms320c2000.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
# Boost.Build support for the Texas Instruments TMS320C2000 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 : tms320c2000 ;
feature.extend architecture :
tms320c2000
;
feature.extend instruction-set :
tms320c2000
tms320c2800
;
# type.register H28 : h28 : H ;
# type.register S28 : s28 : ASM ;
# type.register O28 : o28 ;
# type.register A28 : a28 l28 ;
type.set-generated-target-suffix EXE : <toolset>tms320c2000 : out ;
type.set-generated-target-suffix OBJ : <toolset>tms320c2000 : obj ;
type.set-generated-target-suffix STATIC_LIB : <toolset>tms320c2000 : lib ;
generators.register-linker tms320c2000.link : OBJ STATIC_LIB : EXE : <toolset>tms320c2000 <target-os>baremetal ;
#generators.register-linker tms320c2000.link : OBJ O28 A28 STATIC_LIB : EXE : <toolset>tms320c2000 <architecture>tms320c2000 <instruction-set>tms320c2800 <target-os>baremetal ;
generators.register-archiver tms320c2000.archive : OBJ : STATIC_LIB : <toolset>tms320c2000 <target-os>baremetal ;
#generators.register-archiver tms320c2000.archive : OBJ O28 : STATIC_LIB : <toolset>tms320c2000 <architecture>tms320c2000 <instruction-set>tms320c2800 <target-os>baremetal ;
generators.register-c-compiler tms320c2000.compile.c++ : CPP : OBJ : <toolset>tms320c2000 <target-os>baremetal ;
generators.register-c-compiler tms320c2000.compile.c : C : OBJ : <toolset>tms320c2000 <target-os>baremetal ;
generators.register-c-compiler tms320c2000.compile.asm : ASM : OBJ : <toolset>tms320c2000 <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 tms320c2000 : cl2000 : $(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 "tms320c2000: no version detected" ;
}
if $(version)
{
if $(detected-version) != $(version)
{
errors.user-error "tms320c2000: detected version (" $(detected-version) ") does not match desired (" $(version) ")" ;
}
}
if $(detected-version)
{
version = $(detected-version) ;
}
}
else
{
errors.user-error "tms320c2000: cl2000 not found at" $(command) ;
}
root = [ common.get-absolute-tool-path $(command[-1]) ] ;
root = $(root:P) ;
local condition = [ common.check-init-parameters tms320c2000 : version $(version) ] ;
common.handle-options tms320c2000 : $(condition) : $(command) : $(options) ;
#toolset.add-requirements <toolset>tms320c2000:<testing.launcher>"$(root[0])/bin/load2000.exe" ;
toolset.add-requirements <toolset>tms320c2000:<testing.launcher>echo ;
if $(.debug-configuration)
{
ECHO "tms320c2000: using compiler" $(version) "at" $(root) ;
}
toolset.flags tms320c2000 .bin $(condition) : $(root)/bin ;
# Declare flags
toolset.flags tms320c2000.link OPTIONS $(condition)/<strip>off : ;
toolset.flags tms320c2000.link OPTIONS $(condition)/<strip>on : -s ;
toolset.flags tms320c2000.compile OPTIONS $(condition)/<debug-symbols>off : ;
toolset.flags tms320c2000.compile OPTIONS $(condition)/<debug-symbols>on : -g ;
toolset.flags tms320c2000.compile OPTIONS $(condition)/<optimization>off : ;
toolset.flags tms320c2000.compile OPTIONS $(condition)/<optimization>speed : -O3 ;
toolset.flags tms320c2000.compile OPTIONS $(condition)/<optimization>space : -ms ;
# @todo fill in completely
# toolset.flags tms320c2000.compile OPTIONS $(condition)/<profiling>off : ;
# toolset.flags tms320c2000.compile OPTIONS $(condition)/<profiling>on : ;
toolset.flags tms320c2000.compile OPTIONS $(condition)/<inlining>off : -pi ;
toolset.flags tms320c2000.compile OPTIONS $(condition)/<inlining>on : ;
toolset.flags tms320c2000.compile OPTIONS $(condition)/<inlining>full : ;
toolset.flags tms320c2000.compile.c++ OPTIONS $(condition)/<rtti>off : ;
toolset.flags tms320c2000.compile.c++ OPTIONS $(condition)/<rtti>on : -rtti ;
toolset.flags tms320c2000.compile.c++ OPTIONS $(condition)/<exception-handling>off : ;
toolset.flags tms320c2000.compile.c++ OPTIONS $(condition)/<exception-handling>on : --exceptions ;
toolset.flags tms320c2000.compile OPTIONS $(condition)/<warnings>off : -pdw ;
toolset.flags tms320c2000.compile OPTIONS $(condition)/<warnings>all : ;
toolset.flags tms320c2000.compile OPTIONS $(condition)/<warnings-as-errors>off : ;
toolset.flags tms320c2000.compile OPTIONS $(condition)/<warnings-as-errors>on : -pdew ;
toolset.flags tms320c2000.link OPTIONS $(condition) : <linkflags> ;
toolset.flags tms320c2000.archive AROPTIONS $(condition) : <archiveflags> ;
toolset.flags tms320c2000.compile OPTIONS $(condition) : <compileflags> ;
toolset.flags tms320c2000.compile.c OPTIONS $(condition) : <cflags> ;
toolset.flags tms320c2000.compile.c++ OPTIONS $(condition) : <cxxflags> ;
toolset.flags tms320c2000.compile.asm OPTIONS $(condition) : <asmflags> ;
toolset.flags tms320c2000.compile STDHDRS $(condition) : $(root)/include ;
toolset.flags tms320c2000.compile DEFINES $(condition) : <define> ;
toolset.flags tms320c2000.compile UNDEFINES $(condition) : <undef> ;
toolset.flags tms320c2000.compile INCLUDES $(condition) : <include> ;
toolset.flags tms320c2000.compile DEFINE_OPTION $(condition) : -D : unchecked ;
toolset.flags tms320c2000.compile UNDEFINE_OPTION $(condition) : -U : unchecked ;
toolset.flags tms320c2000.compile INCLUDE_PATH_OPTION $(condition) : -I : unchecked ;
toolset.flags tms320c2000.compile SYSTEM_INCLUDE_PATH_OPTION $(condition) : -I : unchecked ;
# @todo endianess left at default for now.
toolset.flags tms320c2000.link DEFAULTS $(condition) : -qq ;
toolset.flags tms320c2000.compile.c DEFAULTS $(condition) : -qq ;
toolset.flags tms320c2000.compile.c++ DEFAULTS $(condition) : -qq --static_template_instantiation ;
toolset.flags tms320c2000.compile.asm DEFAULTS $(condition) : -qq ;
toolset.flags tms320c2000.link DEFINES $(condition) : <define> ;
toolset.flags tms320c2000.link UNDEFINES $(condition) : <undef> ;
toolset.flags tms320c2000.link DEFINE_OPTION $(condition) : --define= : unchecked ;
toolset.flags tms320c2000.link UNDEFINE_OPTION $(condition) : --undefine= : unchecked ;
toolset.flags tms320c2000.link STDLIBPATH $(condition) : $(root)/lib ;
toolset.flags tms320c2000.link LIBRARY_PATH $(condition) : <library-path> ;
toolset.flags tms320c2000.link FINDLIBS_ST $(condition) : <find-static-library> ;
toolset.flags tms320c2000.link FINDLIBS_SA $(condition) : <find-shared-library> ;
toolset.flags tms320c2000.link LIBRARIES $(condition) : <library-file> ;
toolset.flags tms320c2000.link LIBRARY_PATH_OPTION $(condition) : -i : unchecked ;
toolset.flags tms320c2000.link LIBRARY_OPTION $(condition) : -l : unchecked ;
toolset.flags tms320c2000.link RUN_PATH $(condition) : $(root)/bin ;
toolset.flags tms320c2000.hex OPTIONS $(condition) : <flags> ;
toolset.flags tms320c2000.hex HEX_OUTPUT_OPTION $(condition) : -o ;
cpu-flags tms320c2000.compile OPTIONS : $(condition) : tms320c2000 : tms320c2000 : -v28 : default ;
cpu-flags tms320c2000.compile OPTIONS : $(condition) : tms320c2000 : tms320c2800 : -v28 ;
}
else
{
ECHO "tms320c2000: 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)/ar2000" $(AROPTIONS) qrv "$(<:W)" "$(>:W)"
}
# Hex Converter
# @todo Hex should become a top-level target type
actions hex
{
"$(.bin)/hex2000" -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) ;
}
}