rake_embedded 0.1.1
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 +7 -0
- data/.gitignore +9 -0
- data/.travis.yml +14 -0
- data/Gemfile +5 -0
- data/LICENSE +621 -0
- data/README.md +150 -0
- data/Rakefile +2 -0
- data/machine_conf/8051/8051.rb +23 -0
- data/machine_conf/8051/C8051FXXX.rb +22 -0
- data/machine_conf/8051/nrf24le1_24.rb +25 -0
- data/machine_conf/8051/nrf24le1_32.rb +24 -0
- data/machine_conf/8051/nrf24le1_48.rb +24 -0
- data/machine_conf/arm/arm.rb +24 -0
- data/machine_conf/arm/stm32f1.rb +24 -0
- data/machine_conf/arm/stm32f3.rb +28 -0
- data/machine_conf/arm/stm32f4.rb +28 -0
- data/machine_conf/avr/atmega168.rb +24 -0
- data/machine_conf/avr/avr.rb +25 -0
- data/machine_conf/mips/PIC32.rb +24 -0
- data/machine_conf/mips/pic32mx2.rb +24 -0
- data/machine_conf/mips/pic32mz2048.rb +24 -0
- data/machine_conf/native/linux.rb +24 -0
- data/machine_conf/native/native.rb +24 -0
- data/rake_embedded/version.rb +3 -0
- data/rake_embedded.gemspec +28 -0
- data/rem +34 -0
- data/rem.png +0 -0
- data/rem_core.rb +446 -0
- data/rem_path.rb +23 -0
- data/scripts/build_functions/package_build_functions.rb +121 -0
- data/scripts/compile_tasks/common/gcc_LinkPrepare.rb +35 -0
- data/scripts/compile_tasks/common/sdcc_LinkPrepare.rb +30 -0
- data/scripts/compile_tasks/gcc_tasks/DefaultTasks.rb +77 -0
- data/scripts/compile_tasks/make_tasks/MakeTasks.rb +86 -0
- data/scripts/compile_tasks/sdcc_tasks/DefaultTasks.rb +80 -0
- data/scripts/dependency_functions/dependency_graph.rb +68 -0
- data/scripts/dependency_functions/dependency_tasks.rb +67 -0
- data/scripts/download_tasks/DefaultTasks.rb +44 -0
- data/scripts/global_config/config_helper/check_env.rb +57 -0
- data/scripts/global_config/config_helper/config.rb +27 -0
- data/scripts/global_config/global_config.rb +230 -0
- data/scripts/misc/helper.rb +122 -0
- data/scripts/misc/helper_string_parse.rb +40 -0
- data/scripts/misc/print_functions.rb +53 -0
- data/scripts/package.rb +343 -0
- data/scripts/patch_tasks/DefaultTasks.rb +33 -0
- data/scripts/prepare_tasks/DefaultTasks.rb +74 -0
- data/scripts/recipe_handling/recipes.rb +151 -0
- data/scripts/remfile_functions/remfile_gen.rb +39 -0
- data/shell_scripts/check_deps.sh +214 -0
- data/shell_scripts/comment_unused_functions_cppcheck.sh +44 -0
- data/shell_scripts/find_func_and_comment.sh +61 -0
- data/tests/docker/dockerfile_debian_8.dockertest +18 -0
- data/tests/docker/dockerfile_ubuntu_14_04.dockertest +20 -0
- data/tests/run_all_rem_tests.sh +26 -0
- data/tests/run_docker_test.sh +5 -0
- data/tests/run_docker_tests.sh +26 -0
- data/tests/tests/TEST_append_features.sh +15 -0
- data/tests/tests/TEST_build_test_project.sh +28 -0
- data/tests/tests/TEST_check_deps_test_project.sh +16 -0
- data/tests/tests/TEST_remove_unused_functions.sh +17 -0
- metadata +149 -0
@@ -0,0 +1,230 @@
|
|
1
|
+
=begin
|
2
|
+
|
3
|
+
Copyright (C) 2015 Franz Flasch <franz.flasch@gmx.at>
|
4
|
+
|
5
|
+
This file is part of REM - Rake for EMbedded Systems and Microcontrollers.
|
6
|
+
|
7
|
+
REM is free software: you can redistribute it and/or modify
|
8
|
+
it under the terms of the GNU General Public License as published by
|
9
|
+
the Free Software Foundation, either version 3 of the License, or
|
10
|
+
(at your option) any later version.
|
11
|
+
|
12
|
+
REM is distributed in the hope that it will be useful,
|
13
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
GNU General Public License for more details.
|
16
|
+
|
17
|
+
You should have received a copy of the GNU General Public License
|
18
|
+
along with REM. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
=end
|
20
|
+
|
21
|
+
require_relative "./config_helper/check_env"
|
22
|
+
require_relative "./config_helper/config"
|
23
|
+
|
24
|
+
|
25
|
+
class GlobalConfig
|
26
|
+
attr_reader :rakefile_dir
|
27
|
+
|
28
|
+
attr_reader :arch
|
29
|
+
attr_reader :mach
|
30
|
+
|
31
|
+
attr_reader :project_folder
|
32
|
+
|
33
|
+
attr_reader :build_dir
|
34
|
+
attr_reader :state_dir
|
35
|
+
attr_reader :deploy_dir
|
36
|
+
|
37
|
+
attr_reader :download_dir
|
38
|
+
attr_reader :download_state_dir
|
39
|
+
|
40
|
+
attr_reader :remfile
|
41
|
+
|
42
|
+
attr_reader :prefix
|
43
|
+
attr_reader :compiler
|
44
|
+
attr_reader :obj_cp
|
45
|
+
attr_reader :defines
|
46
|
+
attr_reader :compile_flags
|
47
|
+
attr_reader :link_flags
|
48
|
+
attr_reader :compiler_obj_extension
|
49
|
+
attr_reader :obj_copy_flags
|
50
|
+
|
51
|
+
attr_reader :cc_prefix
|
52
|
+
|
53
|
+
def initialize()
|
54
|
+
@rakefile_dir = ""
|
55
|
+
|
56
|
+
@arch = ARCH
|
57
|
+
@mach = MACH
|
58
|
+
|
59
|
+
@project_folder = PROJECT_FOLDER
|
60
|
+
|
61
|
+
@build_dir = BUILD_DIR
|
62
|
+
@state_dir = STATE_DIR
|
63
|
+
@deploy_dir = DEPLOY_DIR
|
64
|
+
|
65
|
+
@download_dir = DL_DIR
|
66
|
+
@download_state_dir = DL_STATE_DIR
|
67
|
+
|
68
|
+
@remfile = "#{BUILD_DIR}/pkgs.rem_file"
|
69
|
+
|
70
|
+
@prefix = ""
|
71
|
+
@compiler = ""
|
72
|
+
@obj_cp = ""
|
73
|
+
@defines = []
|
74
|
+
@compile_flags = []
|
75
|
+
@link_flags = []
|
76
|
+
@compiler_obj_extension = "o"
|
77
|
+
@obj_copy_flags = []
|
78
|
+
|
79
|
+
@cc_prefix = ""
|
80
|
+
end
|
81
|
+
|
82
|
+
# The getter methods should be considered as 'public' and
|
83
|
+
# can be called from anywhere:
|
84
|
+
|
85
|
+
def get_rakefile_dir
|
86
|
+
return rakefile_dir
|
87
|
+
end
|
88
|
+
|
89
|
+
def get_arch
|
90
|
+
return arch
|
91
|
+
end
|
92
|
+
|
93
|
+
def get_mach
|
94
|
+
return mach
|
95
|
+
end
|
96
|
+
|
97
|
+
def get_project_folder
|
98
|
+
return project_folder
|
99
|
+
end
|
100
|
+
|
101
|
+
def get_build_dir
|
102
|
+
return build_dir
|
103
|
+
end
|
104
|
+
|
105
|
+
def get_state_dir
|
106
|
+
return state_dir
|
107
|
+
end
|
108
|
+
|
109
|
+
def get_deploy_dir
|
110
|
+
return deploy_dir
|
111
|
+
end
|
112
|
+
|
113
|
+
def get_dl_dir
|
114
|
+
return download_dir
|
115
|
+
end
|
116
|
+
|
117
|
+
def get_dl_state_dir
|
118
|
+
return download_state_dir
|
119
|
+
end
|
120
|
+
|
121
|
+
def get_remfile
|
122
|
+
return remfile
|
123
|
+
end
|
124
|
+
|
125
|
+
def get_compiler_prefix()
|
126
|
+
return prefix
|
127
|
+
end
|
128
|
+
|
129
|
+
def get_compiler
|
130
|
+
if prefix.nil? || prefix.empty?
|
131
|
+
return "#{compiler}"
|
132
|
+
else
|
133
|
+
return "#{prefix}-#{compiler}"
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
def get_obj_cp
|
138
|
+
if prefix.nil? || prefix.empty?
|
139
|
+
return "#{obj_cp}"
|
140
|
+
else
|
141
|
+
return "#{prefix}-#{obj_cp}"
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
def get_defines
|
146
|
+
defines_string = ""
|
147
|
+
defines.each do |e|
|
148
|
+
defines_string << "-D#{e} "
|
149
|
+
end
|
150
|
+
return defines_string
|
151
|
+
end
|
152
|
+
|
153
|
+
def get_compile_flags
|
154
|
+
compile_flags_combined = ""
|
155
|
+
compile_flags.each do |e|
|
156
|
+
compile_flags_combined << "#{e} "
|
157
|
+
end
|
158
|
+
|
159
|
+
return compile_flags_combined
|
160
|
+
end
|
161
|
+
|
162
|
+
def get_link_flags
|
163
|
+
link_flags_combined = ""
|
164
|
+
link_flags.each do |e|
|
165
|
+
link_flags_combined << "#{e} "
|
166
|
+
end
|
167
|
+
|
168
|
+
return link_flags_combined
|
169
|
+
end
|
170
|
+
|
171
|
+
def get_obj_extension
|
172
|
+
return compiler_obj_extension
|
173
|
+
end
|
174
|
+
|
175
|
+
def get_obj_copy_flags
|
176
|
+
obj_copy_flags_combined = ""
|
177
|
+
obj_copy_flags.each do |e|
|
178
|
+
obj_copy_flags_combined << "#{e} "
|
179
|
+
end
|
180
|
+
|
181
|
+
return obj_copy_flags_combined
|
182
|
+
end
|
183
|
+
|
184
|
+
|
185
|
+
|
186
|
+
# These are the setter methods. They should be considered as 'private'
|
187
|
+
# and should only be called from dedicated configure files.
|
188
|
+
|
189
|
+
def set_rakefile_dir(dir)
|
190
|
+
@rakefile_dir = dir
|
191
|
+
end
|
192
|
+
|
193
|
+
def set_compiler_prefix(prefix)
|
194
|
+
@prefix = prefix
|
195
|
+
end
|
196
|
+
|
197
|
+
def set_compiler(compiler)
|
198
|
+
@compiler = compiler
|
199
|
+
end
|
200
|
+
|
201
|
+
def set_obj_cp(obj_cp)
|
202
|
+
@obj_cp = obj_cp
|
203
|
+
end
|
204
|
+
|
205
|
+
def set_define(define)
|
206
|
+
@defines.push(define)
|
207
|
+
end
|
208
|
+
|
209
|
+
def set_compile_flag(flags)
|
210
|
+
@compile_flags.push(flags)
|
211
|
+
end
|
212
|
+
|
213
|
+
def set_link_flag(flags)
|
214
|
+
@link_flags.push(flags)
|
215
|
+
end
|
216
|
+
|
217
|
+
def set_obj_extension(extension)
|
218
|
+
@compiler_obj_extension = "#{extension}"
|
219
|
+
end
|
220
|
+
|
221
|
+
def set_objcopy_flag(flags)
|
222
|
+
@obj_copy_flags.push(flags)
|
223
|
+
end
|
224
|
+
end
|
225
|
+
|
226
|
+
$global_config = GlobalConfig.new()
|
227
|
+
|
228
|
+
def global_config
|
229
|
+
return $global_config
|
230
|
+
end
|
@@ -0,0 +1,122 @@
|
|
1
|
+
=begin
|
2
|
+
|
3
|
+
Copyright (C) 2015 Franz Flasch <franz.flasch@gmx.at>
|
4
|
+
|
5
|
+
This file is part of REM - Rake for EMbedded Systems and Microcontrollers.
|
6
|
+
|
7
|
+
REM is free software: you can redistribute it and/or modify
|
8
|
+
it under the terms of the GNU General Public License as published by
|
9
|
+
the Free Software Foundation, either version 3 of the License, or
|
10
|
+
(at your option) any later version.
|
11
|
+
|
12
|
+
REM is distributed in the hope that it will be useful,
|
13
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
GNU General Public License for more details.
|
16
|
+
|
17
|
+
You should have received a copy of the GNU General Public License
|
18
|
+
along with REM. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
=end
|
20
|
+
|
21
|
+
require 'open3'
|
22
|
+
|
23
|
+
### Searches for files with ending in folderlist
|
24
|
+
### Returns files as array
|
25
|
+
def find_files_with_ending(folder_list, ending)
|
26
|
+
files = []
|
27
|
+
folders = folder_list
|
28
|
+
|
29
|
+
# check if folder_list is array or string
|
30
|
+
unless folder_list.is_a?(Array)
|
31
|
+
folders = folder_list.split(" ")
|
32
|
+
end
|
33
|
+
|
34
|
+
folders.each do |e|
|
35
|
+
if File.exist?("#{e}")
|
36
|
+
Find.find("#{e}") do |path|
|
37
|
+
files << path if path =~ /.*\.#{ending}$/
|
38
|
+
end
|
39
|
+
else
|
40
|
+
print_abort("Error: path #{e} does not exist!")
|
41
|
+
end
|
42
|
+
end
|
43
|
+
return files
|
44
|
+
end
|
45
|
+
|
46
|
+
### Searches for files with ending in folderlist
|
47
|
+
### Returns files as string
|
48
|
+
def find_files_with_ending_str(folder_list, ending)
|
49
|
+
list = find_files_with_ending(folder_list, ending)
|
50
|
+
return list.join(" ")
|
51
|
+
end
|
52
|
+
|
53
|
+
def get_duplicates_in_array(array)
|
54
|
+
return array.select{|element| array.count(element) > 1 }
|
55
|
+
end
|
56
|
+
|
57
|
+
def check_duplicates_exit_with_error(array, list_name)
|
58
|
+
# Now put warning if there are any duplicate recipes
|
59
|
+
duplicates = get_duplicates_in_array(array)
|
60
|
+
if duplicates.uniq.any?
|
61
|
+
print_abort ("ERROR: Duplicates in #{list_name}, duplicates: #{duplicates.uniq}")
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
def execute(cmd)
|
66
|
+
Open3.popen2e(cmd) do |stdin, stdout_err, wait_thr|
|
67
|
+
cmd_std_message = ""
|
68
|
+
print_debug(cmd)
|
69
|
+
stdout_err.each do |line|
|
70
|
+
print_debug(line)
|
71
|
+
cmd_std_message << line
|
72
|
+
end
|
73
|
+
exit_status = wait_thr.value
|
74
|
+
unless exit_status.success?
|
75
|
+
print_any_red("Error when calling #{cmd} - exit code: #{exit_status} - STDOUT/STDERR:")
|
76
|
+
print_any_red(cmd_std_message)
|
77
|
+
abort
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
### Removes leading and trailing spaces as well as removing superflous
|
83
|
+
### spaces between strings
|
84
|
+
def string_strip(val)
|
85
|
+
return "#{val.gsub(/\s+/, " ").strip} "
|
86
|
+
end
|
87
|
+
|
88
|
+
### Does the same as string_strip plus converts it to an array
|
89
|
+
def string_strip_to_array(val)
|
90
|
+
tmp = string_strip(val)
|
91
|
+
tmp = tmp.split(" ")
|
92
|
+
return tmp
|
93
|
+
end
|
94
|
+
|
95
|
+
### Cuts the directory and the extension from the given uri
|
96
|
+
def get_filename_without_extension_from_uri(uri)
|
97
|
+
#return File.basename(uri, extension)
|
98
|
+
return File.basename(uri, File.extname(uri))
|
99
|
+
end
|
100
|
+
|
101
|
+
### Cuts the extension from the given uri
|
102
|
+
def get_uri_without_extension(uri)
|
103
|
+
return File.join(File.dirname(uri), File.basename(uri, '.*'))
|
104
|
+
end
|
105
|
+
|
106
|
+
### Cuts the filename from the given uri
|
107
|
+
def get_dirname_from_uri(uri)
|
108
|
+
return File.dirname(uri)
|
109
|
+
end
|
110
|
+
|
111
|
+
### Cuts the directory from the given uri
|
112
|
+
def get_filename_from_uri(uri)
|
113
|
+
return File.basename(uri)
|
114
|
+
end
|
115
|
+
|
116
|
+
### Returns the file extension from the given uri
|
117
|
+
def get_extension_from_uri(uri)
|
118
|
+
tmp = File.extname(uri)
|
119
|
+
# return the "."
|
120
|
+
tmp.slice!(0)
|
121
|
+
return tmp
|
122
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
=begin
|
2
|
+
|
3
|
+
Copyright (C) 2016 Franz Flasch <franz.flasch@gmx.at>
|
4
|
+
|
5
|
+
This file is part of REM - Rake for EMbedded Systems and Microcontrollers.
|
6
|
+
|
7
|
+
REM is free software: you can redistribute it and/or modify
|
8
|
+
it under the terms of the GNU General Public License as published by
|
9
|
+
the Free Software Foundation, either version 3 of the License, or
|
10
|
+
(at your option) any later version.
|
11
|
+
|
12
|
+
REM is distributed in the hope that it will be useful,
|
13
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
GNU General Public License for more details.
|
16
|
+
|
17
|
+
You should have received a copy of the GNU General Public License
|
18
|
+
along with REM. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
=end
|
20
|
+
|
21
|
+
def parse_string(str_input_array, what)
|
22
|
+
found = 0
|
23
|
+
ret_str = ""
|
24
|
+
tmp_str_arr = str_input_array
|
25
|
+
tmp_str = tmp_str_arr.split(";")
|
26
|
+
|
27
|
+
tmp_str.each do |e|
|
28
|
+
if(e[/#{what}(.*)/])
|
29
|
+
e.slice! "#{what}"
|
30
|
+
ret_str = e
|
31
|
+
found = 1
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
if(found == 1)
|
36
|
+
return ret_str
|
37
|
+
else
|
38
|
+
return "undefined"
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
=begin
|
2
|
+
|
3
|
+
Copyright (C) 2016 Franz Flasch <franz.flasch@gmx.at>
|
4
|
+
|
5
|
+
This file is part of REM - Rake for EMbedded Systems and Microcontrollers.
|
6
|
+
|
7
|
+
REM is free software: you can redistribute it and/or modify
|
8
|
+
it under the terms of the GNU General Public License as published by
|
9
|
+
the Free Software Foundation, either version 3 of the License, or
|
10
|
+
(at your option) any later version.
|
11
|
+
|
12
|
+
REM is distributed in the hope that it will be useful,
|
13
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
GNU General Public License for more details.
|
16
|
+
|
17
|
+
You should have received a copy of the GNU General Public License
|
18
|
+
along with REM. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
=end
|
20
|
+
|
21
|
+
def print_debug(text)
|
22
|
+
if(VERBOSE == "1")
|
23
|
+
puts text
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def print_any_cyan(text)
|
28
|
+
puts "\033[36m#{text}\033[0m\n"
|
29
|
+
end
|
30
|
+
|
31
|
+
def print_any_green(text)
|
32
|
+
puts "\033[32m#{text}\033[0m\n"
|
33
|
+
end
|
34
|
+
|
35
|
+
def print_any_yellow(text)
|
36
|
+
# will produce yellow text color
|
37
|
+
puts "\033[33m#{text}\033[0m\n"
|
38
|
+
end
|
39
|
+
|
40
|
+
def print_any_red(text)
|
41
|
+
# will produce red text color
|
42
|
+
puts "\033[31m#{text}\033[0m\n"
|
43
|
+
end
|
44
|
+
|
45
|
+
def print_any(text)
|
46
|
+
puts text
|
47
|
+
end
|
48
|
+
|
49
|
+
def print_abort(text)
|
50
|
+
# will produce red text color
|
51
|
+
print_any_red(text)
|
52
|
+
abort
|
53
|
+
end
|