source: EcnlProtoTool/trunk/mruby-2.1.1/examples/targets/build_config_ArduinoDue.rb@ 439

Last change on this file since 439 was 439, checked in by coas-nagasima, 4 years ago

mrubyを2.1.1に更新

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-ruby;charset=UTF-8
File size: 3.0 KB
Line 
1MRuby::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
15end
16
17# Cross Compiling configuration for Arduino Due
18# http://arduino.cc/en/Main/ArduinoBoardDue
19#
20# Requires Arduino IDE >= 1.5
21MRuby::CrossBuild.new("ArduinoDue") do |conf|
22 toolchain :gcc
23
24 # Mac OS X, Arduino IDE <= 1.5.6
25 # ARDUINO_PATH = '/Applications/Arduino.app/Contents/Resources/Java'
26 # Mac OS X, Arduino IDE >= 1.5.7
27 # ARDUINO_PATH = '/Applications/Arduino.app/Contents/Java'
28 # GNU Linux
29 ARDUINO_PATH = '/opt/arduino'
30 # Arduino IDE <= 1.5.6
31 BIN_PATH = "#{ARDUINO_PATH}/hardware/tools/g++_arm_none_eabi/bin"
32 # Arduino IDE >= 1.5.7
33 # BIN_PATH = "#{ARDUINO_PATH}/hardware/tools/gcc-arm-none-eabi-4.8.3-2014q1/bin"
34 SAM_PATH = "#{ARDUINO_PATH}/hardware/arduino/sam"
35 TARGET_PATH = "#{SAM_PATH}/variants/arduino_due_x"
36
37 conf.cc do |cc|
38 cc.command = "#{BIN_PATH}/arm-none-eabi-gcc"
39 cc.include_paths << ["#{SAM_PATH}/system/libsam", "#{SAM_PATH}/system/CMSIS/CMSIS/Include/",
40 "#{SAM_PATH}/system/CMSIS/Device/ATMEL/",
41 "#{SAM_PATH}/cores/arduino", "#{SAM_PATH}/libraries","#{TARGET_PATH}"]
42 cc.flags = %w(-g -Os -w -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500
43 -Dprintf=iprintf -mcpu=cortex-m3 -DF_CPU=84000000L -DARDUINO=156 -DARDUINO_SAM_DUE -DARDUINO_ARCH_SAM
44 -D__SAM3X8E__ -mthumb -DUSB_PID=0x003e -DUSB_VID=0x2341 -DUSBCON -DUSB_MANUFACTURER="Unknown" -DUSB_PRODUCT="Arduino Due")
45 cc.compile_options = %Q[%{flags} -o "%{outfile}" -c "%{infile}"]
46
47 #configuration for low memory environment
48 cc.defines << %w(MRB_HEAP_PAGE_SIZE=64)
49 cc.defines << %w(KHASH_DEFAULT_SIZE=8)
50 cc.defines << %w(MRB_STR_BUF_MIN_SIZE=20)
51 cc.defines << %w(MRB_GC_STRESS)
52 #cc.defines << %w(MRB_DISABLE_STDIO) #if you dont need stdio.
53 #cc.defines << %w(POOL_PAGE_SIZE=1000) #effective only for use with mruby-eval
54 end
55
56 conf.cxx do |cxx|
57 cxx.command = conf.cc.command.dup
58 cxx.include_paths = conf.cc.include_paths.dup
59 cxx.flags = conf.cc.flags.dup
60 cxx.flags << %w(-fno-rtti -fno-exceptions)
61 cxx.defines = conf.cc.defines.dup
62 cxx.compile_options = conf.cc.compile_options.dup
63 end
64
65 conf.archiver do |archiver|
66 archiver.command = "#{BIN_PATH}/arm-none-eabi-ar"
67 archiver.archive_options = 'rcs "%{outfile}" %{objs}'
68 end
69
70 #no executables
71 conf.bins = []
72
73 #do not build executable test
74 conf.build_mrbtest_lib_only
75
76 #disable C++ exception
77 conf.disable_cxx_exception
78
79 #gems from core
80 conf.gem :core => "mruby-print"
81 conf.gem :core => "mruby-math"
82 conf.gem :core => "mruby-enum-ext"
83
84 #light-weight regular expression
85 conf.gem :github => "masamitsu-murase/mruby-hs-regexp", :branch => "master"
86
87 #Arduino API
88 #conf.gem :github =>"kyab/mruby-arduino", :branch => "master"
89
90end
Note: See TracBrowser for help on using the repository browser.