From edfe03c1cad7845f52c916d6cd3a93b11d4ce84b Mon Sep 17 00:00:00 2001 From: kyab Date: Sat, 22 Jun 2013 03:41:27 +0900 Subject: Improve target example to more practical. --- examples/targets/ArduinoDue.rb | 26 ++++++++++++++++++++++++++ examples/targets/chipKitMax32.rb | 24 ++++++++++++++++++++++++ 2 files changed, 50 insertions(+) (limited to 'examples') diff --git a/examples/targets/ArduinoDue.rb b/examples/targets/ArduinoDue.rb index c45efb57c..762236f3b 100644 --- a/examples/targets/ArduinoDue.rb +++ b/examples/targets/ArduinoDue.rb @@ -5,6 +5,8 @@ MRuby::CrossBuild.new("Arduino Due") do |conf| toolchain :gcc + # Mac OS X + # ARDUINO_PATH = '/Applications/Arduino.app/Contents/Resources/Java' # GNU Linux ARDUINO_PATH = '/opt/arduino' BIN_PATH = "#{ARDUINO_PATH}/hardware/tools/g++_arm_none_eabi/bin" @@ -19,12 +21,22 @@ MRuby::CrossBuild.new("Arduino Due") do |conf| cc.flags = %w(-g -Os -w -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -Dprintf=iprintf -mcpu=cortex-m3 -DF_CPU=84000000L -DARDUINO=152 -D__SAM3X8E__ -mthumb -DUSB_PID=0x003e -DUSB_VID=0x2341 -DUSBCON) cc.compile_options = "%{flags} -o %{outfile} -c %{infile}" + + #configuration for low memory environment + cc.defines << %w(MRB_HEAP_PAGE_SIZE=64) + cc.defines << %w(MRB_USE_IV_SEGLIST) + cc.defines << %w(KHASH_DEFAULT_SIZE=8) + cc.defines << %w(MRB_STR_BUF_MIN_SIZE=20) + cc.defines << %w(MRB_GC_STRESS) + #cc.defines << %w(DISABLE_STDIO) #if you dont need stdio. + #cc.defines << %w(POOL_PAGE_SIZE=1000) #effective only for use with mruby-eval end conf.cxx do |cxx| cxx.command = conf.cc.command.dup cxx.include_paths = conf.cc.include_paths.dup cxx.flags = conf.cc.flags.dup + cxx.defines = conf.cc.defines.dup cxx.compile_options = conf.cc.compile_options.dup end @@ -36,4 +48,18 @@ MRuby::CrossBuild.new("Arduino Due") do |conf| #no executables conf.bins = [] + #do not build executable test + conf.build_mrbtest_lib_only + + #gems from core + conf.gem :core => "mruby-print" + conf.gem :core => "mruby-math" + conf.gem :core => "mruby-enum-ext" + + #light-weight regular expression + conf.gem :github => "masamitsu-murase/mruby-hs-regexp", :branch => "master" + + #Arduino API + #conf.gem :github =>"kyab/mruby-arduino", :branch => "master" + end diff --git a/examples/targets/chipKitMax32.rb b/examples/targets/chipKitMax32.rb index 380a34094..5c3a30a2b 100644 --- a/examples/targets/chipKitMax32.rb +++ b/examples/targets/chipKitMax32.rb @@ -24,12 +24,22 @@ MRuby::CrossBuild.new("chipKitMax32") do |conf| -fno-short-double -mprocessor=32MX795F512L -DF_CPU=80000000L -DARDUINO=23 -D_BOARD_MEGA_ -DMPIDEVER=0x01000202 -DMPIDE=23) cc.compile_options = "%{flags} -o %{outfile} -c %{infile}" + + #configuration for low memory environment + cc.defines << %w(MRB_HEAP_PAGE_SIZE=64) + cc.defines << %w(MRB_USE_IV_SEGLIST) + cc.defines << %w(KHASH_DEFAULT_SIZE=8) + cc.defines << %w(MRB_STR_BUF_MIN_SIZE=20) + cc.defines << %w(MRB_GC_STRESS) + #cc.defines << %w(DISABLE_STDIO) #if you dont need stdio. + #cc.defines << %w(POOL_PAGE_SIZE=1000) #effective only for use with mruby-eval end conf.cxx do |cxx| cxx.command = conf.cc.command.dup cxx.include_paths = conf.cc.include_paths.dup cxx.flags = conf.cc.flags.dup + cxx.defines = conf.cc.defines.dup cxx.compile_options = conf.cc.compile_options.dup end @@ -41,4 +51,18 @@ MRuby::CrossBuild.new("chipKitMax32") do |conf| #no executables conf.bins = [] + #do not build test executable + conf.build_mrbtest_lib_only + + #gems from core + conf.gem :core => "mruby-print" + conf.gem :core => "mruby-math" + conf.gem :core => "mruby-enum-ext" + + #light-weight regular expression + conf.gem :github => "masamitsu-murase/mruby-hs-regexp", :branch => "master" + + #Arduino API + #conf.gem :github =>"kyab/mruby-arduino", :branch => "master" + end -- cgit v1.2.3 From c23068e68f0adfb718a504032dfc30d2e7d9dbdb Mon Sep 17 00:00:00 2001 From: kyab Date: Thu, 27 Jun 2013 19:29:27 +0900 Subject: Fix include path of ArduinoDue example --- examples/targets/ArduinoDue.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'examples') diff --git a/examples/targets/ArduinoDue.rb b/examples/targets/ArduinoDue.rb index 762236f3b..a4af4a926 100644 --- a/examples/targets/ArduinoDue.rb +++ b/examples/targets/ArduinoDue.rb @@ -15,9 +15,9 @@ MRuby::CrossBuild.new("Arduino Due") do |conf| conf.cc do |cc| cc.command = "#{BIN_PATH}/arm-none-eabi-gcc" - cc.include_paths << ["#{SAM_PATH}/system/libsam -I#{SAM_PATH}/system/CMSIS/CMSIS/Include/", + cc.include_paths << ["#{SAM_PATH}/system/libsam", "#{SAM_PATH}/system/CMSIS/CMSIS/Include/", "#{SAM_PATH}/system/CMSIS/Device/ATMEL/", - "#{SAM_PATH}/cores/arduino -I#{TARGET_PATH}"] + "#{SAM_PATH}/cores/arduino", "#{SAM_PATH}/libraries","#{TARGET_PATH}"] cc.flags = %w(-g -Os -w -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -Dprintf=iprintf -mcpu=cortex-m3 -DF_CPU=84000000L -DARDUINO=152 -D__SAM3X8E__ -mthumb -DUSB_PID=0x003e -DUSB_VID=0x2341 -DUSBCON) cc.compile_options = "%{flags} -o %{outfile} -c %{infile}" -- cgit v1.2.3 From 116f75a8ce9d5d11d41268ecc95863f4e10f2729 Mon Sep 17 00:00:00 2001 From: Tomoyuki Sahara Date: Tue, 23 Jul 2013 10:09:24 +0900 Subject: "spec.author" is better for single-author gems. "spec.author=" expects a String represents a single author. "spec.authors=" expects an Array which is a list of multiple authors. http://guides.rubygems.org/specification-reference/ --- doc/mrbgems/README.md | 4 ++-- examples/mrbgems/c_and_ruby_extension_example/mrbgem.rake | 2 +- examples/mrbgems/c_extension_example/mrbgem.rake | 2 +- examples/mrbgems/ruby_extension_example/mrbgem.rake | 2 +- mrbgems/mruby-array-ext/mrbgem.rake | 2 +- mrbgems/mruby-bin-mirb/mrbgem.rake | 2 +- mrbgems/mruby-bin-mruby/mrbgem.rake | 2 +- mrbgems/mruby-enum-ext/mrbgem.rake | 2 +- mrbgems/mruby-eval/mrbgem.rake | 2 +- mrbgems/mruby-fiber/mrbgem.rake | 2 +- mrbgems/mruby-hash-ext/mrbgem.rake | 2 +- mrbgems/mruby-math/mrbgem.rake | 2 +- mrbgems/mruby-numeric-ext/mrbgem.rake | 2 +- mrbgems/mruby-object-ext/mrbgem.rake | 2 +- mrbgems/mruby-objectspace/mrbgem.rake | 2 +- mrbgems/mruby-print/mrbgem.rake | 2 +- mrbgems/mruby-proc-ext/mrbgem.rake | 2 +- mrbgems/mruby-random/mrbgem.rake | 2 +- mrbgems/mruby-range-ext/mrbgem.rake | 2 +- mrbgems/mruby-sprintf/mrbgem.rake | 2 +- mrbgems/mruby-string-ext/mrbgem.rake | 2 +- mrbgems/mruby-struct/mrbgem.rake | 2 +- mrbgems/mruby-symbol-ext/mrbgem.rake | 2 +- mrbgems/mruby-time/mrbgem.rake | 2 +- mrbgems/mruby-toplevel-ext/mrbgem.rake | 2 +- 25 files changed, 26 insertions(+), 26 deletions(-) (limited to 'examples') diff --git a/doc/mrbgems/README.md b/doc/mrbgems/README.md index 1062adc6b..07f7002fb 100644 --- a/doc/mrbgems/README.md +++ b/doc/mrbgems/README.md @@ -99,7 +99,7 @@ GEM directory. A typical GEM specification could look like this for example: MRuby::Gem::Specification.new('c_and_ruby_extension_example') do |spec| spec.license = 'MIT' - spec.authors = 'mruby developers' + spec.author = 'mruby developers' end The mrbgems build process will use this specification to compile Object and Ruby @@ -124,7 +124,7 @@ In case your GEM is depending on other GEMs please use MRuby::Gem::Specification.new('c_and_ruby_extension_example') do |spec| spec.license = 'MIT' - spec.authors = 'mruby developers' + spec.author = 'mruby developers' # add GEM dependency mruby-parser. # Version has to be between 1.0.0 and 1.5.2 diff --git a/examples/mrbgems/c_and_ruby_extension_example/mrbgem.rake b/examples/mrbgems/c_and_ruby_extension_example/mrbgem.rake index 35dbe5e18..a1f964b36 100644 --- a/examples/mrbgems/c_and_ruby_extension_example/mrbgem.rake +++ b/examples/mrbgems/c_and_ruby_extension_example/mrbgem.rake @@ -1,6 +1,6 @@ MRuby::Gem::Specification.new('c_and_ruby_extension_example') do |spec| spec.license = 'MIT' - spec.authors = 'mruby developers' + spec.author = 'mruby developers' # Add compile flags # spec.cc.flags << '' diff --git a/examples/mrbgems/c_extension_example/mrbgem.rake b/examples/mrbgems/c_extension_example/mrbgem.rake index 8c132b233..3524e22f4 100644 --- a/examples/mrbgems/c_extension_example/mrbgem.rake +++ b/examples/mrbgems/c_extension_example/mrbgem.rake @@ -1,6 +1,6 @@ MRuby::Gem::Specification.new('c_extension_example') do |spec| spec.license = 'MIT' - spec.authors = 'mruby developers' + spec.author = 'mruby developers' # Add compile flags # spec.cc.flags << '-g' diff --git a/examples/mrbgems/ruby_extension_example/mrbgem.rake b/examples/mrbgems/ruby_extension_example/mrbgem.rake index 3a80b5cd7..5624c33e9 100644 --- a/examples/mrbgems/ruby_extension_example/mrbgem.rake +++ b/examples/mrbgems/ruby_extension_example/mrbgem.rake @@ -1,6 +1,6 @@ MRuby::Gem::Specification.new('ruby_extension_example') do |spec| spec.license = 'MIT' - spec.authors = 'mruby developers' + spec.author = 'mruby developers' # Add compile flags # spec.cc.flags << '' diff --git a/mrbgems/mruby-array-ext/mrbgem.rake b/mrbgems/mruby-array-ext/mrbgem.rake index 38e0ad267..18f92ad65 100644 --- a/mrbgems/mruby-array-ext/mrbgem.rake +++ b/mrbgems/mruby-array-ext/mrbgem.rake @@ -1,4 +1,4 @@ MRuby::Gem::Specification.new('mruby-array-ext') do |spec| spec.license = 'MIT' - spec.authors = 'mruby developers' + spec.author = 'mruby developers' end diff --git a/mrbgems/mruby-bin-mirb/mrbgem.rake b/mrbgems/mruby-bin-mirb/mrbgem.rake index fd0b20254..337473975 100644 --- a/mrbgems/mruby-bin-mirb/mrbgem.rake +++ b/mrbgems/mruby-bin-mirb/mrbgem.rake @@ -1,5 +1,5 @@ MRuby::Gem::Specification.new('mruby-bin-mirb') do |spec| spec.license = 'MIT' - spec.authors = 'mruby developers' + spec.author = 'mruby developers' spec.bins = %w(mirb) end diff --git a/mrbgems/mruby-bin-mruby/mrbgem.rake b/mrbgems/mruby-bin-mruby/mrbgem.rake index 2e173a291..08ba89855 100644 --- a/mrbgems/mruby-bin-mruby/mrbgem.rake +++ b/mrbgems/mruby-bin-mruby/mrbgem.rake @@ -1,5 +1,5 @@ MRuby::Gem::Specification.new('mruby-bin-mruby') do |spec| spec.license = 'MIT' - spec.authors = 'mruby developers' + spec.author = 'mruby developers' spec.bins = %w(mruby) end diff --git a/mrbgems/mruby-enum-ext/mrbgem.rake b/mrbgems/mruby-enum-ext/mrbgem.rake index 758d298dc..e054f4318 100644 --- a/mrbgems/mruby-enum-ext/mrbgem.rake +++ b/mrbgems/mruby-enum-ext/mrbgem.rake @@ -1,4 +1,4 @@ MRuby::Gem::Specification.new('mruby-enum-ext') do |spec| spec.license = 'MIT' - spec.authors = 'mruby developers' + spec.author = 'mruby developers' end diff --git a/mrbgems/mruby-eval/mrbgem.rake b/mrbgems/mruby-eval/mrbgem.rake index f80cf1b9e..217a9e604 100644 --- a/mrbgems/mruby-eval/mrbgem.rake +++ b/mrbgems/mruby-eval/mrbgem.rake @@ -1,4 +1,4 @@ MRuby::Gem::Specification.new('mruby-eval') do |spec| spec.license = 'MIT' - spec.authors = 'mruby developers' + spec.author = 'mruby developers' end diff --git a/mrbgems/mruby-fiber/mrbgem.rake b/mrbgems/mruby-fiber/mrbgem.rake index cb258adcb..25009c47f 100644 --- a/mrbgems/mruby-fiber/mrbgem.rake +++ b/mrbgems/mruby-fiber/mrbgem.rake @@ -1,4 +1,4 @@ MRuby::Gem::Specification.new('mruby-fiber') do |spec| spec.license = 'MIT' - spec.authors = 'mruby developers' + spec.author = 'mruby developers' end diff --git a/mrbgems/mruby-hash-ext/mrbgem.rake b/mrbgems/mruby-hash-ext/mrbgem.rake index 3163c8c88..25d4f8e61 100644 --- a/mrbgems/mruby-hash-ext/mrbgem.rake +++ b/mrbgems/mruby-hash-ext/mrbgem.rake @@ -1,4 +1,4 @@ MRuby::Gem::Specification.new('mruby-hash-ext') do |spec| spec.license = 'MIT' - spec.authors = 'mruby developers' + spec.author = 'mruby developers' end diff --git a/mrbgems/mruby-math/mrbgem.rake b/mrbgems/mruby-math/mrbgem.rake index 4b0fa40fd..75d3d1fff 100644 --- a/mrbgems/mruby-math/mrbgem.rake +++ b/mrbgems/mruby-math/mrbgem.rake @@ -1,4 +1,4 @@ MRuby::Gem::Specification.new('mruby-math') do |spec| spec.license = 'MIT' - spec.authors = 'mruby developers' + spec.author = 'mruby developers' end diff --git a/mrbgems/mruby-numeric-ext/mrbgem.rake b/mrbgems/mruby-numeric-ext/mrbgem.rake index 69c4fde4c..010804058 100644 --- a/mrbgems/mruby-numeric-ext/mrbgem.rake +++ b/mrbgems/mruby-numeric-ext/mrbgem.rake @@ -1,4 +1,4 @@ MRuby::Gem::Specification.new('mruby-numeric-ext') do |spec| spec.license = 'MIT' - spec.authors = 'mruby developers' + spec.author = 'mruby developers' end diff --git a/mrbgems/mruby-object-ext/mrbgem.rake b/mrbgems/mruby-object-ext/mrbgem.rake index 1f232949e..980f1667a 100644 --- a/mrbgems/mruby-object-ext/mrbgem.rake +++ b/mrbgems/mruby-object-ext/mrbgem.rake @@ -1,4 +1,4 @@ MRuby::Gem::Specification.new('mruby-object-ext') do |spec| spec.license = 'MIT' - spec.authors = 'mruby developers' + spec.author = 'mruby developers' end diff --git a/mrbgems/mruby-objectspace/mrbgem.rake b/mrbgems/mruby-objectspace/mrbgem.rake index 100df4cdc..6a6a3e778 100644 --- a/mrbgems/mruby-objectspace/mrbgem.rake +++ b/mrbgems/mruby-objectspace/mrbgem.rake @@ -1,4 +1,4 @@ MRuby::Gem::Specification.new('mruby-objectspace') do |spec| spec.license = 'MIT' - spec.authors = 'mruby developers' + spec.author = 'mruby developers' end diff --git a/mrbgems/mruby-print/mrbgem.rake b/mrbgems/mruby-print/mrbgem.rake index dc7831280..768fc2e18 100644 --- a/mrbgems/mruby-print/mrbgem.rake +++ b/mrbgems/mruby-print/mrbgem.rake @@ -1,4 +1,4 @@ MRuby::Gem::Specification.new('mruby-print') do |spec| spec.license = 'MIT' - spec.authors = 'mruby developers' + spec.author = 'mruby developers' end diff --git a/mrbgems/mruby-proc-ext/mrbgem.rake b/mrbgems/mruby-proc-ext/mrbgem.rake index 7f979431d..b75fceda3 100644 --- a/mrbgems/mruby-proc-ext/mrbgem.rake +++ b/mrbgems/mruby-proc-ext/mrbgem.rake @@ -1,4 +1,4 @@ MRuby::Gem::Specification.new('mruby-proc-ext') do |spec| spec.license = 'MIT' - spec.authors = 'mruby developers' + spec.author = 'mruby developers' end diff --git a/mrbgems/mruby-random/mrbgem.rake b/mrbgems/mruby-random/mrbgem.rake index 38e93e4b1..7ad3c855c 100644 --- a/mrbgems/mruby-random/mrbgem.rake +++ b/mrbgems/mruby-random/mrbgem.rake @@ -1,4 +1,4 @@ MRuby::Gem::Specification.new('mruby-random') do |spec| spec.license = 'MIT' - spec.authors = 'mruby developers' + spec.author = 'mruby developers' end diff --git a/mrbgems/mruby-range-ext/mrbgem.rake b/mrbgems/mruby-range-ext/mrbgem.rake index 5ed521a44..a7970aa51 100644 --- a/mrbgems/mruby-range-ext/mrbgem.rake +++ b/mrbgems/mruby-range-ext/mrbgem.rake @@ -1,4 +1,4 @@ MRuby::Gem::Specification.new('mruby-range-ext') do |spec| spec.license = 'MIT' - spec.authors = 'mruby developers' + spec.author = 'mruby developers' end diff --git a/mrbgems/mruby-sprintf/mrbgem.rake b/mrbgems/mruby-sprintf/mrbgem.rake index 8772a5174..3e15ee7a9 100644 --- a/mrbgems/mruby-sprintf/mrbgem.rake +++ b/mrbgems/mruby-sprintf/mrbgem.rake @@ -1,4 +1,4 @@ MRuby::Gem::Specification.new('mruby-sprintf') do |spec| spec.license = 'MIT' - spec.authors = 'mruby developers' + spec.author = 'mruby developers' end diff --git a/mrbgems/mruby-string-ext/mrbgem.rake b/mrbgems/mruby-string-ext/mrbgem.rake index 83db97eb4..4a3369998 100644 --- a/mrbgems/mruby-string-ext/mrbgem.rake +++ b/mrbgems/mruby-string-ext/mrbgem.rake @@ -1,4 +1,4 @@ MRuby::Gem::Specification.new('mruby-string-ext') do |spec| spec.license = 'MIT' - spec.authors = 'mruby developers' + spec.author = 'mruby developers' end diff --git a/mrbgems/mruby-struct/mrbgem.rake b/mrbgems/mruby-struct/mrbgem.rake index 476e990da..3e9eab8d7 100644 --- a/mrbgems/mruby-struct/mrbgem.rake +++ b/mrbgems/mruby-struct/mrbgem.rake @@ -1,4 +1,4 @@ MRuby::Gem::Specification.new('mruby-struct') do |spec| spec.license = 'MIT' - spec.authors = 'mruby developers' + spec.author = 'mruby developers' end diff --git a/mrbgems/mruby-symbol-ext/mrbgem.rake b/mrbgems/mruby-symbol-ext/mrbgem.rake index 8e40c743b..6294e7a46 100644 --- a/mrbgems/mruby-symbol-ext/mrbgem.rake +++ b/mrbgems/mruby-symbol-ext/mrbgem.rake @@ -1,4 +1,4 @@ MRuby::Gem::Specification.new('mruby-symbol-ext') do |spec| spec.license = 'MIT' - spec.authors = 'mruby developers' + spec.author = 'mruby developers' end diff --git a/mrbgems/mruby-time/mrbgem.rake b/mrbgems/mruby-time/mrbgem.rake index 0f0b4899d..edf2aa3fc 100644 --- a/mrbgems/mruby-time/mrbgem.rake +++ b/mrbgems/mruby-time/mrbgem.rake @@ -1,4 +1,4 @@ MRuby::Gem::Specification.new('mruby-time') do |spec| spec.license = 'MIT' - spec.authors = 'mruby developers' + spec.author = 'mruby developers' end diff --git a/mrbgems/mruby-toplevel-ext/mrbgem.rake b/mrbgems/mruby-toplevel-ext/mrbgem.rake index 457047e8d..78eb73a26 100644 --- a/mrbgems/mruby-toplevel-ext/mrbgem.rake +++ b/mrbgems/mruby-toplevel-ext/mrbgem.rake @@ -1,4 +1,4 @@ MRuby::Gem::Specification.new('mruby-toplevel-ext') do |spec| spec.license = 'MIT' - spec.authors = 'mruby developers' + spec.author = 'mruby developers' end -- cgit v1.2.3