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