| 1 |
# Cross Compiling configuration for Digilent chipKIT Max32 |
| 2 |
# https://www.digilentinc.com/Products/Detail.cfm?Prod=CHIPKIT-MAX32 |
| 3 |
# |
| 4 |
# Requires MPIDE (https://github.com/chipKIT32/chipKIT32-MAX) |
| 5 |
# |
| 6 |
# This configuration is based on @kyab's version |
| 7 |
# http://d.hatena.ne.jp/kyab/20130201 |
| 8 |
MRuby::CrossBuild.new("chipKITMax32") do |conf| |
| 9 |
toolchain :gcc |
| 10 |
|
| 11 |
# Mac OS X |
| 12 |
# MPIDE_PATH = '/Applications/Mpide.app/Contents/Resources/Java' |
| 13 |
# GNU Linux |
| 14 |
MPIDE_PATH = '/opt/mpide-0023-linux-20120903' |
| 15 |
|
| 16 |
PIC32_PATH = "#{MPIDE_PATH}/hardware/pic32" |
| 17 |
|
| 18 |
conf.cc do |cc| |
| 19 |
cc.command = "#{PIC32_PATH}/compiler/pic32-tools/bin/pic32-gcc" |
| 20 |
cc.include_paths << ["#{PIC32_PATH}/cores/pic32", |
| 21 |
"#{PIC32_PATH}/variants/Max32", |
| 22 |
"#{PIC32_PATH}/libraries"] |
| 23 |
cc.flags = %w(-O2 -mno-smart-io -w -ffunction-sections -fdata-sections -g -mdebugger -Wcast-align |
| 24 |
-fno-short-double -mprocessor=32MX795F512L -DF_CPU=80000000L -DARDUINO=23 -D_BOARD_MEGA_ |
| 25 |
-DMPIDEVER=0x01000202 -DMPIDE=23) |
| 26 |
cc.compile_options = %Q[%{flags} -o "%{outfile}" -c "%{infile}"] |
| 27 |
|
| 28 |
#configuration for low memory environment |
| 29 |
cc.defines << %w(MRB_HEAP_PAGE_SIZE=64) |
| 30 |
cc.defines << %w(KHASH_DEFAULT_SIZE=8) |
| 31 |
cc.defines << %w(MRB_GC_STRESS) |
| 32 |
#cc.defines << %w(MRB_NO_STDIO) #if you don't need stdio. |
| 33 |
#cc.defines << %w(POOL_PAGE_SIZE=1000) #effective only for use with mruby-eval |
| 34 |
end |
| 35 |
|
| 36 |
conf.cxx do |cxx| |
| 37 |
cxx.command = conf.cc.command.dup |
| 38 |
cxx.include_paths = conf.cc.include_paths.dup |
| 39 |
cxx.flags = conf.cc.flags.dup |
| 40 |
cxx.defines = conf.cc.defines.dup |
| 41 |
cxx.compile_options = conf.cc.compile_options.dup |
| 42 |
end |
| 43 |
|
| 44 |
conf.archiver do |archiver| |
| 45 |
archiver.command = "#{PIC32_PATH}/compiler/pic32-tools/bin/pic32-ar" |
| 46 |
archiver.archive_options = 'rcs "%{outfile}" %{objs}' |
| 47 |
end |
| 48 |
|
| 49 |
#no executables |
| 50 |
conf.bins = [] |
| 51 |
|
| 52 |
#do not build test executable |
| 53 |
conf.build_mrbtest_lib_only |
| 54 |
|
| 55 |
#disable C++ exception |
| 56 |
conf.disable_cxx_exception |
| 57 |
|
| 58 |
#gems from core |
| 59 |
conf.gem :core => "mruby-print" |
| 60 |
conf.gem :core => "mruby-math" |
| 61 |
conf.gem :core => "mruby-enum-ext" |
| 62 |
|
| 63 |
#light-weight regular expression |
| 64 |
conf.gem :github => "masamitsu-murase/mruby-hs-regexp", :branch => "master" |
| 65 |
|
| 66 |
#Arduino API |
| 67 |
#conf.gem :github =>"kyab/mruby-arduino", :branch => "master" |
| 68 |
|
| 69 |
end |