| 1 |
# Cross Compiling configuration for Intel Galileo on Arduino environment |
| 2 |
# https://arduino.cc/en/ArduinoCertified/IntelGalileo |
| 3 |
# |
| 4 |
# Requires Arduino IDE for Intel Galileo |
| 5 |
MRuby::CrossBuild.new("Galileo") do |conf| |
| 6 |
toolchain :gcc |
| 7 |
|
| 8 |
# Mac OS X |
| 9 |
# Assume you renamed Arduino.app to Arduino_Galileo.app |
| 10 |
GALILEO_ARDUINO_PATH = '/Applications/Arduino_Galileo.app/Contents/Resources/Java' |
| 11 |
# GNU Linux |
| 12 |
#ARDUINO_GALILEO_PATH = '/opt/arduino' |
| 13 |
|
| 14 |
GALILEO_BIN_PATH = "#{GALILEO_ARDUINO_PATH}/hardware/tools/x86/i386-pokysdk-darwin/usr/bin/i586-poky-linux-uclibc" |
| 15 |
GALILEO_SYSROOT = "#{GALILEO_ARDUINO_PATH}/hardware/tools/x86/i586-poky-linux-uclibc" |
| 16 |
GALILEO_X86_PATH = "#{GALILEO_ARDUINO_PATH}/hardware/arduino/x86" |
| 17 |
|
| 18 |
|
| 19 |
conf.cc do |cc| |
| 20 |
cc.command = "#{GALILEO_BIN_PATH}/i586-poky-linux-uclibc-gcc" |
| 21 |
cc.include_paths << ["#{GALILEO_X86_PATH}/cores/arduino", "#{GALILEO_X86_PATH}/variants/galileo_fab_d"] |
| 22 |
cc.flags = %w(-m32 -march=i586 -c -g -Os -w |
| 23 |
-ffunction-sections -fdata-sections -MMD -DARDUINO=153) |
| 24 |
cc.flags << "--sysroot=#{GALILEO_SYSROOT}" |
| 25 |
cc.compile_options = %Q[%{flags} -o "%{outfile}" -c "%{infile}"] |
| 26 |
end |
| 27 |
|
| 28 |
conf.cxx do |cxx| |
| 29 |
cxx.command = "#{GALILEO_BIN_PATH}/i586-poky-linux-uclibc-g++" |
| 30 |
cxx.include_paths = conf.cc.include_paths.dup |
| 31 |
cxx.include_paths << "#{GALILEO_ARDUINO_PATH}/hardware/tools/x86/i586-poky-linux-uclibc/usr/include/c++" |
| 32 |
cxx.include_paths << "#{GALILEO_ARDUINO_PATH}/hardware/tools/x86/i586-poky-linux-uclibc/usr/include/c++/i586-poky-linux-uclibc" |
| 33 |
cxx.flags = conf.cc.flags.dup |
| 34 |
cxx.defines = conf.cc.defines.dup |
| 35 |
cxx.compile_options = conf.cc.compile_options.dup |
| 36 |
end |
| 37 |
|
| 38 |
conf.archiver do |archiver| |
| 39 |
archiver.command = "#{GALILEO_BIN_PATH}/i586-poky-linux-uclibc-ar" |
| 40 |
archiver.archive_options = 'rcs "%{outfile}" %{objs}' |
| 41 |
end |
| 42 |
|
| 43 |
conf.linker do |linker| |
| 44 |
linker.command = "#{GALILEO_BIN_PATH}/i586-poky-linux-uclibc-g++" |
| 45 |
linker.flags = %w(-m32 -march=i586) |
| 46 |
linker.flags << "--sysroot=#{GALILEO_SYSROOT}" |
| 47 |
linker.flags << %w(-Os -Wl,--gc-sections) |
| 48 |
linker.libraries = %w(m pthread) |
| 49 |
end |
| 50 |
|
| 51 |
#no executables |
| 52 |
conf.bins = [] |
| 53 |
|
| 54 |
#do not build executable test |
| 55 |
conf.build_mrbtest_lib_only |
| 56 |
|
| 57 |
#official mrbgems |
| 58 |
conf.gem :core => "mruby-sprintf" |
| 59 |
conf.gem :core => "mruby-print" |
| 60 |
conf.gem :core => "mruby-math" |
| 61 |
conf.gem :core => "mruby-time" |
| 62 |
conf.gem :core => "mruby-struct" |
| 63 |
conf.gem :core => "mruby-enum-ext" |
| 64 |
conf.gem :core => "mruby-string-ext" |
| 65 |
conf.gem :core => "mruby-numeric-ext" |
| 66 |
conf.gem :core => "mruby-array-ext" |
| 67 |
conf.gem :core => "mruby-hash-ext" |
| 68 |
conf.gem :core => "mruby-range-ext" |
| 69 |
conf.gem :core => "mruby-proc-ext" |
| 70 |
conf.gem :core => "mruby-symbol-ext" |
| 71 |
conf.gem :core => "mruby-random" |
| 72 |
conf.gem :core => "mruby-object-ext" |
| 73 |
conf.gem :core => "mruby-objectspace" |
| 74 |
conf.gem :core => "mruby-fiber" |
| 75 |
conf.gem :core => "mruby-toplevel-ext" |
| 76 |
|
| 77 |
#lightweight regular expression |
| 78 |
conf.gem :github => "masamitsu-murase/mruby-hs-regexp", :branch => "master" |
| 79 |
|
| 80 |
#Arduino API |
| 81 |
#conf.gem :github =>"kyab/mruby-arduino", :branch => "master" do |g| |
| 82 |
# g.cxx.include_paths << "#{GALILEO_X86_PATH}/libraries/Wire" |
| 83 |
# g.cxx.include_paths << "#{GALILEO_X86_PATH}/libraries/Servo" |
| 84 |
|
| 85 |
#enable unsupported Servo class |
| 86 |
# g.cxx.defines << "MRUBY_ARDUINO_GALILEO_ENABLE_SERVO" |
| 87 |
#end |
| 88 |
|
| 89 |
end |