ebngen 1.0.5 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/ebngen/adapter/_assert.rb +25 -25
- data/lib/ebngen/adapter/_base.rb +24 -24
- data/lib/ebngen/adapter/_path_modifier.rb +29 -29
- data/lib/ebngen/adapter/_yml_helper.rb +48 -48
- data/lib/ebngen/adapter/cmake.rb +304 -304
- data/lib/ebngen/adapter/iar/ewd.rb +5 -5
- data/lib/ebngen/adapter/iar/ewp.rb +269 -269
- data/lib/ebngen/adapter/iar/eww.rb +61 -61
- data/lib/ebngen/adapter/iar.rb +459 -459
- data/lib/ebngen/assembly.rb +22 -22
- data/lib/ebngen/generate.rb +47 -47
- data/lib/ebngen/settings/target_types.rb +1 -1
- data/lib/ebngen/settings/tool_chains.rb +4 -4
- data/lib/ebngen/translate.rb +249 -249
- data/lib/ebngen/unifmt.rb +290 -290
- metadata +3 -3
data/lib/ebngen/adapter/cmake.rb
CHANGED
@@ -1,305 +1,305 @@
|
|
1
|
-
|
2
|
-
require_relative '_base'
|
3
|
-
require_relative '_yml_helper'
|
4
|
-
require_relative '_path_modifier'
|
5
|
-
require_relative 'cmake/txt'
|
6
|
-
|
7
|
-
|
8
|
-
#replace me when yml_merger becomes gem
|
9
|
-
require 'yml_merger'
|
10
|
-
require 'nokogiri'
|
11
|
-
require 'uri'
|
12
|
-
require 'open-uri'
|
13
|
-
|
14
|
-
module CMAKE
|
15
|
-
class Project
|
16
|
-
TOOLCHAIN='cmake'
|
17
|
-
include Base
|
18
|
-
include TXT
|
19
|
-
include UNI_Project
|
20
|
-
|
21
|
-
def initialize(project_data, generator_variable, logger = nil)
|
22
|
-
@logger = logger
|
23
|
-
unless (logger)
|
24
|
-
@logger = Logger.new(STDOUT)
|
25
|
-
@logger.level = Logger::WARN
|
26
|
-
end
|
27
|
-
set_hash(project_data)
|
28
|
-
@project_name = get_project_name()
|
29
|
-
@board = get_board()
|
30
|
-
@paths = PathModifier.new(generator_variable["paths"])
|
31
|
-
@cmake_project_files = {".txt" => nil, ".bat" => nil, ".sh" => nil}
|
32
|
-
@project = Hash.new if @project.nil?
|
33
|
-
@project["document"] = {"project_name" => @project_name, "board" => @board }
|
34
|
-
end
|
35
|
-
|
36
|
-
def generator(filter, project_data)
|
37
|
-
return if not is_toolchain_support(Project::TOOLCHAIN)
|
38
|
-
create_method(Project::TOOLCHAIN)
|
39
|
-
send(Project::TOOLCHAIN.to_sym, project_data)
|
40
|
-
save_project()
|
41
|
-
end
|
42
|
-
|
43
|
-
def source()
|
44
|
-
#add sources to target
|
45
|
-
sources = get_src_list(Project::TOOLCHAIN)
|
46
|
-
o_path = get_output_dir(Project::TOOLCHAIN, @paths.rootdir_table)
|
47
|
-
proj_path = File.join(@paths.rootdir_table['output_root'], o_path)
|
48
|
-
@project['sources'] = Array.new
|
49
|
-
sources.each do |
|
50
|
-
if file['rootdir']
|
51
|
-
if file.has_key? 'path'
|
52
|
-
full_path =
|
53
|
-
else
|
54
|
-
full_path =
|
55
|
-
end
|
56
|
-
else
|
57
|
-
if file.has_key? 'path'
|
58
|
-
full_path =
|
59
|
-
else
|
60
|
-
full_path =
|
61
|
-
end
|
62
|
-
end
|
63
|
-
ipath = File.join("$ProjDirPath$", @paths.relpath(proj_path, full_path))
|
64
|
-
@project['sources'].insert(-1, ipath)
|
65
|
-
end
|
66
|
-
|
67
|
-
end
|
68
|
-
|
69
|
-
def templates()
|
70
|
-
#load tempaltes
|
71
|
-
end
|
72
|
-
|
73
|
-
def type()
|
74
|
-
@project['type'] = get_type(Project::TOOLCHAIN)
|
75
|
-
end
|
76
|
-
|
77
|
-
def outdir()
|
78
|
-
@logger.info "#{get_output_dir(Project::TOOLCHAIN, @paths.rootdir_table)}"
|
79
|
-
end
|
80
|
-
|
81
|
-
def targets()
|
82
|
-
get_targets(Project::TOOLCHAIN).each do |key, value|
|
83
|
-
return if value.nil?
|
84
|
-
@project["target"] = Hash.new if @project["target"].nil?
|
85
|
-
ta = key.upcase
|
86
|
-
@project["target"][ta] = Hash.new if @project["target"][ta].nil?
|
87
|
-
#do the target settings
|
88
|
-
value.each_key do |subkey|
|
89
|
-
methods = self.class.instance_methods(false)
|
90
|
-
if methods.include?("target_#{subkey}".to_sym)
|
91
|
-
send("target_#{subkey}".to_sym, key, value[subkey])
|
92
|
-
else
|
93
|
-
@logger.info "#{key} is not processed"
|
94
|
-
end
|
95
|
-
end
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
# tool_chain_specific attribute for each target
|
100
|
-
# Params:
|
101
|
-
# - target: the name for the target
|
102
|
-
# - doc: the hash that holds the data
|
103
|
-
def target_tool_chain_specific(target, doc)
|
104
|
-
#no specific for cmake
|
105
|
-
end
|
106
|
-
|
107
|
-
def save_project()
|
108
|
-
path = get_output_dir(Project::TOOLCHAIN, @paths.rootdir_table)
|
109
|
-
save(File.join(@paths.rootdir_table['output_root'], path, "CMakeLists.txt"), @project)
|
110
|
-
end
|
111
|
-
|
112
|
-
def target_cp_defines(target, doc)
|
113
|
-
ta = target.upcase
|
114
|
-
@project["target"][ta]['cp_defines'] = Array.new
|
115
|
-
doc.each do |d, v|
|
116
|
-
if v.nil?
|
117
|
-
st_def = "SET(CMAKE_C_FLAGS_#{ta} \"${CMAKE_C_FLAGS_#{ta}} -D#{d} \""
|
118
|
-
else
|
119
|
-
st_def = "SET(CMAKE_C_FLAGS_#{ta} \"${CMAKE_C_FLAGS_#{ta}} -D#{d}=#{v} \""
|
120
|
-
end
|
121
|
-
@project["target"][ta]['cp_defines'].insert(-1, st_def)
|
122
|
-
end
|
123
|
-
end
|
124
|
-
|
125
|
-
def target_as_predefines(target, doc)
|
126
|
-
|
127
|
-
end
|
128
|
-
|
129
|
-
def target_as_defines(target, doc)
|
130
|
-
ta = target.upcase
|
131
|
-
@project["target"][ta]['as_defines'] = Array.new
|
132
|
-
doc.each do | d, v|
|
133
|
-
if v.nil?
|
134
|
-
st_def = "SET(CMAKE_ASM_FLAGS_#{ta} \"${CMAKE_ASM_FLAGS_#{ta}} -D#{d} \""
|
135
|
-
else
|
136
|
-
st_def = "SET(CMAKE_ASM_FLAGS_#{ta} \"${CMAKE_ASM_FLAGS_#{ta}} -D#{d}=#{v} \""
|
137
|
-
end
|
138
|
-
@project["target"][ta]['as_defines'].insert(-1, st_def)
|
139
|
-
end
|
140
|
-
end
|
141
|
-
|
142
|
-
def target_as_include(target, doc)
|
143
|
-
ta = target.upcase
|
144
|
-
o_path = get_output_dir(Project::TOOLCHAIN, @paths.rootdir_table)
|
145
|
-
proj_path = File.join(@paths.rootdir_table['output_root'], o_path)
|
146
|
-
@project["target"][ta]['as_include'] = Array.new
|
147
|
-
doc.each do |inc|
|
148
|
-
if inc['rootdir']
|
149
|
-
full_path = @paths.fullpath(inc['rootdir'],inc['path'])
|
150
|
-
else
|
151
|
-
full_path = @paths.fullpath('default_path',inc['path'])
|
152
|
-
end
|
153
|
-
ipath = File.join("$ProjDirPath$", @paths.relpath(proj_path, full_path))
|
154
|
-
inc_str = "include_directories(#{ipath})"
|
155
|
-
@project["target"][ta]['as_include'].insert(-1, inc_str)
|
156
|
-
end
|
157
|
-
end
|
158
|
-
|
159
|
-
def target_as_flags(target, doc)
|
160
|
-
ta = target.upcase
|
161
|
-
@project["target"][ta]['as_flags'] = Array.new
|
162
|
-
doc.each do |flag|
|
163
|
-
@project["target"][ta]['as_flags'].insert(-1, "SET(CMAKE_ASM_FLAGS_#{ta} \"\$\{CMAKE_ASM_FLAGS_#{ta}\} #{flag}\")")
|
164
|
-
end
|
165
|
-
end
|
166
|
-
|
167
|
-
def target_cc_predefines(target, doc)
|
168
|
-
|
169
|
-
end
|
170
|
-
|
171
|
-
def target_cc_preincludes(target, doc)
|
172
|
-
|
173
|
-
end
|
174
|
-
|
175
|
-
def target_cc_defines(target, doc)
|
176
|
-
ta = target.upcase
|
177
|
-
@project["target"][ta]['cc_defines'] = Array.new
|
178
|
-
doc.each do |d, v|
|
179
|
-
if v.nil?
|
180
|
-
st_def = "SET(CMAKE_C_FLAGS_#{ta} \"${CMAKE_C_FLAGS_#{ta}} -D#{d} \""
|
181
|
-
else
|
182
|
-
st_def = "SET(CMAKE_C_FLAGS_#{ta} \"${CMAKE_C_FLAGS_#{ta}} -D#{d}=#{v} \""
|
183
|
-
end
|
184
|
-
@project["target"][ta]['cc_defines'].insert(-1, st_def)
|
185
|
-
end
|
186
|
-
end
|
187
|
-
|
188
|
-
def target_cc_include(target, doc)
|
189
|
-
ta = target.upcase
|
190
|
-
o_path = get_output_dir(Project::TOOLCHAIN, @paths.rootdir_table)
|
191
|
-
proj_path = File.join(@paths.rootdir_table['output_root'], o_path)
|
192
|
-
@project["target"][ta]['cc_include'] = Array.new
|
193
|
-
doc.each do |inc|
|
194
|
-
if inc['rootdir']
|
195
|
-
full_path = @paths.fullpath(inc['rootdir'],inc['path'])
|
196
|
-
else
|
197
|
-
full_path = @paths.fullpath('default_path',inc['path'])
|
198
|
-
end
|
199
|
-
ipath = File.join("$ProjDirPath$", @paths.relpath(proj_path, full_path))
|
200
|
-
inc_str = "include_directories(#{ipath})"
|
201
|
-
@project["target"][ta]['cc_include'].insert(-1, inc_str)
|
202
|
-
end
|
203
|
-
end
|
204
|
-
|
205
|
-
def target_cc_flags(target, doc)
|
206
|
-
ta = target.upcase
|
207
|
-
@project["target"][ta]['cc_flags'] = Array.new
|
208
|
-
doc.each do |flag|
|
209
|
-
@project["target"][ta]['cc_flags'].insert(-1, "SET(CMAKE_C_FLAGS_#{ta} \"\$\{CMAKE_C_FLAGS_#{ta}\} #{flag}\")")
|
210
|
-
end
|
211
|
-
end
|
212
|
-
|
213
|
-
def target_cxx_predefines(target, doc)
|
214
|
-
|
215
|
-
end
|
216
|
-
|
217
|
-
def target_cxx_preincludes(target, doc)
|
218
|
-
|
219
|
-
end
|
220
|
-
|
221
|
-
def target_cxx_defines(target, doc)
|
222
|
-
ta = target.upcase
|
223
|
-
@project["target"][ta]['cxx_defines'] = Array.new
|
224
|
-
doc.each do |d, v|
|
225
|
-
if v.nil?
|
226
|
-
st_def = "SET(CMAKE_CXX_FLAGS_#{ta} \"${CMAKE_CXX_FLAGS_#{ta}} -D#{d} \""
|
227
|
-
else
|
228
|
-
st_def = "SET(CMAKE_CXX_FLAGS_#{ta} \"${CMAKE_CXX_FLAGS_#{ta}} -D#{d}=#{v} \""
|
229
|
-
end
|
230
|
-
@project["target"][ta]['cxx_defines'].insert(-1, st_def)
|
231
|
-
end
|
232
|
-
end
|
233
|
-
|
234
|
-
def target_cxx_include(target, doc)
|
235
|
-
ta = target.upcase
|
236
|
-
o_path = get_output_dir(Project::TOOLCHAIN, @paths.rootdir_table)
|
237
|
-
proj_path = File.join(@paths.rootdir_table['output_root'], o_path)
|
238
|
-
@project["target"][ta]['cxx_include'] = Array.new
|
239
|
-
doc.each do |inc|
|
240
|
-
if inc['rootdir']
|
241
|
-
full_path = @paths.fullpath(inc['rootdir'],inc['path'])
|
242
|
-
else
|
243
|
-
full_path = @paths.fullpath('default_path',inc['path'])
|
244
|
-
end
|
245
|
-
ipath = File.join("$ProjDirPath$", @paths.relpath(proj_path, full_path))
|
246
|
-
inc_str = "include_directories(#{ipath})"
|
247
|
-
@project["target"][ta]['cxx_include'].insert(-1, inc_str)
|
248
|
-
end
|
249
|
-
end
|
250
|
-
|
251
|
-
def target_cxx_flags(target, doc)
|
252
|
-
ta = target.upcase
|
253
|
-
@project["target"][ta]['cxx_flags'] = Array.new
|
254
|
-
doc.each do |flag|
|
255
|
-
@project["target"][ta]['cxx_flags'].insert(-1, "SET(CMAKE_CXX_FLAGS_#{ta} \"\$\{CMAKE_CXX_FLAGS_#{ta}\} #{flag}\")")
|
256
|
-
end
|
257
|
-
end
|
258
|
-
|
259
|
-
def target_ld_flags(target, doc)
|
260
|
-
ta = target.upcase
|
261
|
-
@project["target"][ta]['ld_flags'] = Array.new
|
262
|
-
doc.each do |flag|
|
263
|
-
@project["target"][ta]['ld_flags'].insert(-1, "SET(CMAKE_EXE_LINKER_FLAGS_#{ta} \"\$\{CMAKE_EXE_LINKER_FLAGS_#{ta}\} #{flag}\")")
|
264
|
-
end
|
265
|
-
end
|
266
|
-
|
267
|
-
def target_libraries(target, doc)
|
268
|
-
ta = target.upcase
|
269
|
-
convert_string = {'DEBUG' => 'debug', 'RELEASE' => 'optimized'}
|
270
|
-
@project["target"][ta]['libraries'] = Array.new
|
271
|
-
header = "TARGET_LINK_LIBRARIES(#{project_name}.elf -Wl,--start-group)"
|
272
|
-
@project["target"][ta]['libraries'].insert(-1, header)
|
273
|
-
doc.each do |library|
|
274
|
-
lib = "target_link_libraries(#{project_name}.elf #{convert_string[ta]} #{library})"
|
275
|
-
@project["target"][ta]['libraries'].insert(-1, lib)
|
276
|
-
end
|
277
|
-
footer = "TARGET_LINK_LIBRARIES(#{project_name}.elf -Wl,--end-group)"
|
278
|
-
@project["target"][ta]['libraries'].insert(-1, footer)
|
279
|
-
end
|
280
|
-
|
281
|
-
def target_linker_file(target, doc)
|
282
|
-
ta = target.upcase
|
283
|
-
o_path = get_output_dir(Project::TOOLCHAIN, @paths.rootdir_table)
|
284
|
-
proj_path = File.join(@paths.rootdir_table['output_root'], o_path)
|
285
|
-
@project["target"][ta]['linker_file'] = Array.new
|
286
|
-
if doc['rootdir']
|
287
|
-
full_path = @paths.fullpath(doc['rootdir'],doc['path'])
|
288
|
-
else
|
289
|
-
full_path = @paths.fullpath('default_path',doc['path'])
|
290
|
-
end
|
291
|
-
link = File.join("${ProjDirPath}", @paths.relpath(proj_path, full_path))
|
292
|
-
linkstr = "set(CMAKE_EXE_LINKER_FLAGS_#{ta} \"${CMAKE_EXE_LINKER_FLAGS_#{ta}} -T#{link} -static\")"
|
293
|
-
@project["target"][ta]['linker_file'].insert(-1, linkstr)
|
294
|
-
end
|
295
|
-
|
296
|
-
def target_binary_file(target, doc)
|
297
|
-
ta= target.upcase
|
298
|
-
@project["target"][ta]["binary_file"] = doc
|
299
|
-
end
|
300
|
-
|
301
|
-
def target_outdir(target, doc)
|
302
|
-
|
303
|
-
end
|
304
|
-
end
|
1
|
+
|
2
|
+
require_relative '_base'
|
3
|
+
require_relative '_yml_helper'
|
4
|
+
require_relative '_path_modifier'
|
5
|
+
require_relative 'cmake/txt'
|
6
|
+
|
7
|
+
|
8
|
+
#replace me when yml_merger becomes gem
|
9
|
+
require 'yml_merger'
|
10
|
+
require 'nokogiri'
|
11
|
+
require 'uri'
|
12
|
+
require 'open-uri'
|
13
|
+
|
14
|
+
module CMAKE
|
15
|
+
class Project
|
16
|
+
TOOLCHAIN='cmake'
|
17
|
+
include Base
|
18
|
+
include TXT
|
19
|
+
include UNI_Project
|
20
|
+
|
21
|
+
def initialize(project_data, generator_variable, logger = nil)
|
22
|
+
@logger = logger
|
23
|
+
unless (logger)
|
24
|
+
@logger = Logger.new(STDOUT)
|
25
|
+
@logger.level = Logger::WARN
|
26
|
+
end
|
27
|
+
set_hash(project_data)
|
28
|
+
@project_name = get_project_name()
|
29
|
+
@board = get_board()
|
30
|
+
@paths = PathModifier.new(generator_variable["paths"])
|
31
|
+
@cmake_project_files = {".txt" => nil, ".bat" => nil, ".sh" => nil}
|
32
|
+
@project = Hash.new if @project.nil?
|
33
|
+
@project["document"] = {"project_name" => @project_name, "board" => @board }
|
34
|
+
end
|
35
|
+
|
36
|
+
def generator(filter, project_data)
|
37
|
+
return if not is_toolchain_support(Project::TOOLCHAIN)
|
38
|
+
create_method(Project::TOOLCHAIN)
|
39
|
+
send(Project::TOOLCHAIN.to_sym, project_data)
|
40
|
+
save_project()
|
41
|
+
end
|
42
|
+
|
43
|
+
def source()
|
44
|
+
#add sources to target
|
45
|
+
sources = get_src_list(Project::TOOLCHAIN)
|
46
|
+
o_path = get_output_dir(Project::TOOLCHAIN, @paths.rootdir_table)
|
47
|
+
proj_path = File.join(@paths.rootdir_table['output_root'], o_path)
|
48
|
+
@project['sources'] = Array.new
|
49
|
+
sources.each do |file|
|
50
|
+
if file['rootdir']
|
51
|
+
if file.has_key? 'path'
|
52
|
+
full_path = @paths.fullpath(file['rootdir'],file['path'])
|
53
|
+
else
|
54
|
+
full_path = @paths.fullpath(file['rootdir'],file['source'])
|
55
|
+
end
|
56
|
+
else
|
57
|
+
if file.has_key? 'path'
|
58
|
+
full_path = @paths.fullpath('default_path',file['path'])
|
59
|
+
else
|
60
|
+
full_path = @paths.fullpath('default_path',file['source'])
|
61
|
+
end
|
62
|
+
end
|
63
|
+
ipath = File.join("$ProjDirPath$", @paths.relpath(proj_path, full_path))
|
64
|
+
@project['sources'].insert(-1, ipath)
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
|
69
|
+
def templates()
|
70
|
+
#load tempaltes
|
71
|
+
end
|
72
|
+
|
73
|
+
def type()
|
74
|
+
@project['type'] = get_type(Project::TOOLCHAIN)
|
75
|
+
end
|
76
|
+
|
77
|
+
def outdir()
|
78
|
+
@logger.info "#{get_output_dir(Project::TOOLCHAIN, @paths.rootdir_table)}"
|
79
|
+
end
|
80
|
+
|
81
|
+
def targets()
|
82
|
+
get_targets(Project::TOOLCHAIN).each do |key, value|
|
83
|
+
return if value.nil?
|
84
|
+
@project["target"] = Hash.new if @project["target"].nil?
|
85
|
+
ta = key.upcase
|
86
|
+
@project["target"][ta] = Hash.new if @project["target"][ta].nil?
|
87
|
+
#do the target settings
|
88
|
+
value.each_key do |subkey|
|
89
|
+
methods = self.class.instance_methods(false)
|
90
|
+
if methods.include?("target_#{subkey}".to_sym)
|
91
|
+
send("target_#{subkey}".to_sym, key, value[subkey])
|
92
|
+
else
|
93
|
+
@logger.info "#{key} is not processed"
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
# tool_chain_specific attribute for each target
|
100
|
+
# Params:
|
101
|
+
# - target: the name for the target
|
102
|
+
# - doc: the hash that holds the data
|
103
|
+
def target_tool_chain_specific(target, doc)
|
104
|
+
#no specific for cmake
|
105
|
+
end
|
106
|
+
|
107
|
+
def save_project()
|
108
|
+
path = get_output_dir(Project::TOOLCHAIN, @paths.rootdir_table)
|
109
|
+
save(File.join(@paths.rootdir_table['output_root'], path, "CMakeLists.txt"), @project)
|
110
|
+
end
|
111
|
+
|
112
|
+
def target_cp_defines(target, doc)
|
113
|
+
ta = target.upcase
|
114
|
+
@project["target"][ta]['cp_defines'] = Array.new
|
115
|
+
doc.each do |d, v|
|
116
|
+
if v.nil?
|
117
|
+
st_def = "SET(CMAKE_C_FLAGS_#{ta} \"${CMAKE_C_FLAGS_#{ta}} -D#{d} \""
|
118
|
+
else
|
119
|
+
st_def = "SET(CMAKE_C_FLAGS_#{ta} \"${CMAKE_C_FLAGS_#{ta}} -D#{d}=#{v} \""
|
120
|
+
end
|
121
|
+
@project["target"][ta]['cp_defines'].insert(-1, st_def)
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
def target_as_predefines(target, doc)
|
126
|
+
|
127
|
+
end
|
128
|
+
|
129
|
+
def target_as_defines(target, doc)
|
130
|
+
ta = target.upcase
|
131
|
+
@project["target"][ta]['as_defines'] = Array.new
|
132
|
+
doc.each do | d, v|
|
133
|
+
if v.nil?
|
134
|
+
st_def = "SET(CMAKE_ASM_FLAGS_#{ta} \"${CMAKE_ASM_FLAGS_#{ta}} -D#{d} \""
|
135
|
+
else
|
136
|
+
st_def = "SET(CMAKE_ASM_FLAGS_#{ta} \"${CMAKE_ASM_FLAGS_#{ta}} -D#{d}=#{v} \""
|
137
|
+
end
|
138
|
+
@project["target"][ta]['as_defines'].insert(-1, st_def)
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
def target_as_include(target, doc)
|
143
|
+
ta = target.upcase
|
144
|
+
o_path = get_output_dir(Project::TOOLCHAIN, @paths.rootdir_table)
|
145
|
+
proj_path = File.join(@paths.rootdir_table['output_root'], o_path)
|
146
|
+
@project["target"][ta]['as_include'] = Array.new
|
147
|
+
doc.each do |inc|
|
148
|
+
if inc['rootdir']
|
149
|
+
full_path = @paths.fullpath(inc['rootdir'],inc['path'])
|
150
|
+
else
|
151
|
+
full_path = @paths.fullpath('default_path',inc['path'])
|
152
|
+
end
|
153
|
+
ipath = File.join("$ProjDirPath$", @paths.relpath(proj_path, full_path))
|
154
|
+
inc_str = "include_directories(#{ipath})"
|
155
|
+
@project["target"][ta]['as_include'].insert(-1, inc_str)
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
def target_as_flags(target, doc)
|
160
|
+
ta = target.upcase
|
161
|
+
@project["target"][ta]['as_flags'] = Array.new
|
162
|
+
doc.each do |flag|
|
163
|
+
@project["target"][ta]['as_flags'].insert(-1, "SET(CMAKE_ASM_FLAGS_#{ta} \"\$\{CMAKE_ASM_FLAGS_#{ta}\} #{flag}\")")
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
def target_cc_predefines(target, doc)
|
168
|
+
|
169
|
+
end
|
170
|
+
|
171
|
+
def target_cc_preincludes(target, doc)
|
172
|
+
|
173
|
+
end
|
174
|
+
|
175
|
+
def target_cc_defines(target, doc)
|
176
|
+
ta = target.upcase
|
177
|
+
@project["target"][ta]['cc_defines'] = Array.new
|
178
|
+
doc.each do |d, v|
|
179
|
+
if v.nil?
|
180
|
+
st_def = "SET(CMAKE_C_FLAGS_#{ta} \"${CMAKE_C_FLAGS_#{ta}} -D#{d} \""
|
181
|
+
else
|
182
|
+
st_def = "SET(CMAKE_C_FLAGS_#{ta} \"${CMAKE_C_FLAGS_#{ta}} -D#{d}=#{v} \""
|
183
|
+
end
|
184
|
+
@project["target"][ta]['cc_defines'].insert(-1, st_def)
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
188
|
+
def target_cc_include(target, doc)
|
189
|
+
ta = target.upcase
|
190
|
+
o_path = get_output_dir(Project::TOOLCHAIN, @paths.rootdir_table)
|
191
|
+
proj_path = File.join(@paths.rootdir_table['output_root'], o_path)
|
192
|
+
@project["target"][ta]['cc_include'] = Array.new
|
193
|
+
doc.each do |inc|
|
194
|
+
if inc['rootdir']
|
195
|
+
full_path = @paths.fullpath(inc['rootdir'],inc['path'])
|
196
|
+
else
|
197
|
+
full_path = @paths.fullpath('default_path',inc['path'])
|
198
|
+
end
|
199
|
+
ipath = File.join("$ProjDirPath$", @paths.relpath(proj_path, full_path))
|
200
|
+
inc_str = "include_directories(#{ipath})"
|
201
|
+
@project["target"][ta]['cc_include'].insert(-1, inc_str)
|
202
|
+
end
|
203
|
+
end
|
204
|
+
|
205
|
+
def target_cc_flags(target, doc)
|
206
|
+
ta = target.upcase
|
207
|
+
@project["target"][ta]['cc_flags'] = Array.new
|
208
|
+
doc.each do |flag|
|
209
|
+
@project["target"][ta]['cc_flags'].insert(-1, "SET(CMAKE_C_FLAGS_#{ta} \"\$\{CMAKE_C_FLAGS_#{ta}\} #{flag}\")")
|
210
|
+
end
|
211
|
+
end
|
212
|
+
|
213
|
+
def target_cxx_predefines(target, doc)
|
214
|
+
|
215
|
+
end
|
216
|
+
|
217
|
+
def target_cxx_preincludes(target, doc)
|
218
|
+
|
219
|
+
end
|
220
|
+
|
221
|
+
def target_cxx_defines(target, doc)
|
222
|
+
ta = target.upcase
|
223
|
+
@project["target"][ta]['cxx_defines'] = Array.new
|
224
|
+
doc.each do |d, v|
|
225
|
+
if v.nil?
|
226
|
+
st_def = "SET(CMAKE_CXX_FLAGS_#{ta} \"${CMAKE_CXX_FLAGS_#{ta}} -D#{d} \""
|
227
|
+
else
|
228
|
+
st_def = "SET(CMAKE_CXX_FLAGS_#{ta} \"${CMAKE_CXX_FLAGS_#{ta}} -D#{d}=#{v} \""
|
229
|
+
end
|
230
|
+
@project["target"][ta]['cxx_defines'].insert(-1, st_def)
|
231
|
+
end
|
232
|
+
end
|
233
|
+
|
234
|
+
def target_cxx_include(target, doc)
|
235
|
+
ta = target.upcase
|
236
|
+
o_path = get_output_dir(Project::TOOLCHAIN, @paths.rootdir_table)
|
237
|
+
proj_path = File.join(@paths.rootdir_table['output_root'], o_path)
|
238
|
+
@project["target"][ta]['cxx_include'] = Array.new
|
239
|
+
doc.each do |inc|
|
240
|
+
if inc['rootdir']
|
241
|
+
full_path = @paths.fullpath(inc['rootdir'],inc['path'])
|
242
|
+
else
|
243
|
+
full_path = @paths.fullpath('default_path',inc['path'])
|
244
|
+
end
|
245
|
+
ipath = File.join("$ProjDirPath$", @paths.relpath(proj_path, full_path))
|
246
|
+
inc_str = "include_directories(#{ipath})"
|
247
|
+
@project["target"][ta]['cxx_include'].insert(-1, inc_str)
|
248
|
+
end
|
249
|
+
end
|
250
|
+
|
251
|
+
def target_cxx_flags(target, doc)
|
252
|
+
ta = target.upcase
|
253
|
+
@project["target"][ta]['cxx_flags'] = Array.new
|
254
|
+
doc.each do |flag|
|
255
|
+
@project["target"][ta]['cxx_flags'].insert(-1, "SET(CMAKE_CXX_FLAGS_#{ta} \"\$\{CMAKE_CXX_FLAGS_#{ta}\} #{flag}\")")
|
256
|
+
end
|
257
|
+
end
|
258
|
+
|
259
|
+
def target_ld_flags(target, doc)
|
260
|
+
ta = target.upcase
|
261
|
+
@project["target"][ta]['ld_flags'] = Array.new
|
262
|
+
doc.each do |flag|
|
263
|
+
@project["target"][ta]['ld_flags'].insert(-1, "SET(CMAKE_EXE_LINKER_FLAGS_#{ta} \"\$\{CMAKE_EXE_LINKER_FLAGS_#{ta}\} #{flag}\")")
|
264
|
+
end
|
265
|
+
end
|
266
|
+
|
267
|
+
def target_libraries(target, doc)
|
268
|
+
ta = target.upcase
|
269
|
+
convert_string = {'DEBUG' => 'debug', 'RELEASE' => 'optimized'}
|
270
|
+
@project["target"][ta]['libraries'] = Array.new
|
271
|
+
header = "TARGET_LINK_LIBRARIES(#{@project_name}.elf -Wl,--start-group)"
|
272
|
+
@project["target"][ta]['libraries'].insert(-1, header)
|
273
|
+
doc.each do |library|
|
274
|
+
lib = "target_link_libraries(#{@project_name}.elf #{convert_string[ta]} #{library})"
|
275
|
+
@project["target"][ta]['libraries'].insert(-1, lib)
|
276
|
+
end
|
277
|
+
footer = "TARGET_LINK_LIBRARIES(#{@project_name}.elf -Wl,--end-group)"
|
278
|
+
@project["target"][ta]['libraries'].insert(-1, footer)
|
279
|
+
end
|
280
|
+
|
281
|
+
def target_linker_file(target, doc)
|
282
|
+
ta = target.upcase
|
283
|
+
o_path = get_output_dir(Project::TOOLCHAIN, @paths.rootdir_table)
|
284
|
+
proj_path = File.join(@paths.rootdir_table['output_root'], o_path)
|
285
|
+
@project["target"][ta]['linker_file'] = Array.new
|
286
|
+
if doc['rootdir']
|
287
|
+
full_path = @paths.fullpath(doc['rootdir'],doc['path'])
|
288
|
+
else
|
289
|
+
full_path = @paths.fullpath('default_path',doc['path'])
|
290
|
+
end
|
291
|
+
link = File.join("${ProjDirPath}", @paths.relpath(proj_path, full_path))
|
292
|
+
linkstr = "set(CMAKE_EXE_LINKER_FLAGS_#{ta} \"${CMAKE_EXE_LINKER_FLAGS_#{ta}} -T#{link} -static\")"
|
293
|
+
@project["target"][ta]['linker_file'].insert(-1, linkstr)
|
294
|
+
end
|
295
|
+
|
296
|
+
def target_binary_file(target, doc)
|
297
|
+
ta= target.upcase
|
298
|
+
@project["target"][ta]["binary_file"] = doc
|
299
|
+
end
|
300
|
+
|
301
|
+
def target_outdir(target, doc)
|
302
|
+
|
303
|
+
end
|
304
|
+
end
|
305
305
|
end # end Module IAR
|
@@ -1,6 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
module EWD
|
4
|
-
|
5
|
-
|
1
|
+
|
2
|
+
|
3
|
+
module EWD
|
4
|
+
|
5
|
+
|
6
6
|
end
|