Skip to content

Commit 76eb714

Browse files
committed
Added example for cross-compiling for Renesas RX630
1 parent 4325707 commit 76eb714

File tree

1 file changed

+82
-0
lines changed

1 file changed

+82
-0
lines changed
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
MRuby::Build.new do |conf|
2+
3+
# Gets set by the VS command prompts.
4+
if ENV['VisualStudioVersion'] || ENV['VSINSTALLDIR']
5+
toolchain :visualcpp
6+
else
7+
toolchain :gcc
8+
end
9+
10+
enable_debug
11+
12+
# include the default GEMs
13+
conf.gembox 'default'
14+
15+
end
16+
17+
# Cross Compiling configuration for RX630
18+
# http://gadget.renesas.com/
19+
#
20+
# Requires gnurx_v14.03
21+
MRuby::CrossBuild.new("RX630") do |conf|
22+
toolchain :gcc
23+
24+
# Linux
25+
BIN_PATH = "/usr/share/gnurx_v14.03_elf-1/bin"
26+
27+
conf.cc do |cc|
28+
cc.command = "#{BIN_PATH}/rx-elf-gcc"
29+
cc.flags = "-Wall -g -O2 -flto -mcpu=rx600 -m64bit-doubles"
30+
cc.compile_options = "%{flags} -o %{outfile} -c %{infile}"
31+
32+
#configuration for low memory environment
33+
cc.defines << %w(MRB_USE_FLOAT)
34+
cc.defines << %w(MRB_HEAP_PAGE_SIZE=64)
35+
cc.defines << %w(MRB_USE_IV_SEGLIST)
36+
cc.defines << %w(KHASH_DEFAULT_SIZE=8)
37+
cc.defines << %w(MRB_STR_BUF_MIN_SIZE=20)
38+
cc.defines << %w(MRB_GC_STRESS)
39+
cc.defines << %w(MRB_DISABLE_STDIO) #if you dont need stdio.
40+
#cc.defines << %w(POOL_PAGE_SIZE=1000) #effective only for use with mruby-eval
41+
end
42+
43+
conf.cxx do |cxx|
44+
cxx.command = conf.cc.command.dup
45+
cxx.include_paths = conf.cc.include_paths.dup
46+
cxx.flags = conf.cc.flags.dup
47+
cxx.defines = conf.cc.defines.dup
48+
cxx.compile_options = conf.cc.compile_options.dup
49+
end
50+
51+
conf.linker do |linker|
52+
linker.command="#{BIN_PATH}/rx-elf-ld"
53+
end
54+
55+
conf.archiver do |archiver|
56+
archiver.command = "#{BIN_PATH}/rx-elf-ar"
57+
archiver.archive_options = 'rcs %{outfile} %{objs}'
58+
end
59+
60+
#no executables
61+
conf.bins = []
62+
63+
#do not build executable test
64+
conf.build_mrbtest_lib_only
65+
66+
#disable C++ exception
67+
conf.disable_cxx_exception
68+
69+
#gems from core
70+
conf.gem :core => "mruby-sprintf"
71+
conf.gem :core => "mruby-print"
72+
conf.gem :core => "mruby-math"
73+
conf.gem :core => "mruby-enum-ext"
74+
conf.gem :core => "mruby-numeric-ext"
75+
76+
#light-weight regular expression
77+
#conf.gem :github => "masamitsu-murase/mruby-hs-regexp", :branch => "master"
78+
79+
#Arduino API
80+
#conf.gem :github =>"kyab/mruby-arduino", :branch => "master"
81+
82+
end

0 commit comments

Comments
 (0)