Open Design Computer Project

オリジナルCPUから作る本格的自作コンピューター

ユーザ用ツール

サイト用ツール


software:mruby

mruby on mist32

mruby のコンパイルに挑戦して見ました。とりあえず動いたりします。

FPGA 上に載せた自作 CPU の上で、こんな簡単に mruby が動いてしまうのは気持ち良いですね。

mrbtest

-O1 であれば、mrbtest はすべて通るようになりました。

mrbtest - Embeddable Ruby Test

This is a very early version, please test and report errors.
Thanks :)

.......................................................................................................................
.......................................................................................................................
.......................................................................................................................
.......................................................................................................................
.......................................................................................
Total: 563
   OK: 563
   KO: 0
Crash: 0

How to build

mruby のリポジトリはこちらから

build_config.rb に以下を追記して、mist32.gembox を mrbgems/ においてください。

-O2 だと、mirb で undefined method になった時にコケます。原因不明。

build_config.rb

# Define cross build settings
MRuby::CrossBuild.new('mist32') do |conf|
  toolchain :gcc
 
  # include the default GEMs
  conf.gembox 'mist32'
 
  # C compiler settings
  conf.cc do |cc|
    cc.command = ENV['CC'] || 'mist32-elf-gcc'
    cc.flags = [ENV['CFLAGS'] || %w(-O)]
  #   cc.include_paths = ["#{root}/include"]
  #   cc.defines = %w(DISABLE_GEMS)
  #   cc.option_include_path = '-I%s'
  #   cc.option_define = '-D%s'
  #   cc.compile_options = "%{flags} -MMD -o %{outfile} -c %{infile}"
  end
 
  # Linker settings
  conf.linker do |linker|
    linker.command = ENV['LD'] || 'mist32-elf-gcc'
    linker.flags = [ENV['LDFLAGS'] || ['-Tmist32-elf-common.ld']]
  #   linker.flags_before_libraries = []
  #   linker.libraries = %w()
  #   linker.flags_after_libraries = []
  #   linker.library_paths = []
  #   linker.option_library = '-l%s'
  #   linker.option_library_path = '-L%s'
  #   linker.link_options = "%{flags} -o %{outfile} %{objs} %{libs}"
  end
 
  # Archiver settings
  conf.archiver do |archiver|
    archiver.command = ENV['AR'] || 'mist32-elf-ar'
  #   archiver.archive_options = 'rs %{outfile} %{objs}'
  end
end

mist32.gembox

mist32.gembox
MRuby::GemBox.new do |conf|
  # Use standard Kernel#sprintf method
  conf.gem :core => "mruby-sprintf"
 
  # Use standard print/puts/p
  conf.gem :core => "mruby-print"
 
  # Use standard Math module
  # conf.gem :core => "mruby-math"
 
  # Use standard Time class
  # conf.gem :core => "mruby-time"
 
  # Use standard Struct class
  conf.gem :core => "mruby-struct"
 
  # Use extensional Enumerable module
  conf.gem :core => "mruby-enum-ext"
 
  # Use extensional String class
  conf.gem :core => "mruby-string-ext"
 
  # Use extensional Numeric class
  conf.gem :core => "mruby-numeric-ext"
 
  # Use extensional Array class
  conf.gem :core => "mruby-array-ext"
 
  # Use extensional Hash class
  conf.gem :core => "mruby-hash-ext"
 
  # Use extensional Range class
  conf.gem :core => "mruby-range-ext"
 
  # Use extensional Proc class
  conf.gem :core => "mruby-proc-ext"
 
  # Use extensional Symbol class
  conf.gem :core => "mruby-symbol-ext"
 
  # Use Random class
  # conf.gem :core => "mruby-random"
 
  # Use extensional Object class
  conf.gem :core => "mruby-object-ext"
 
  # Use ObjectSpace class
  conf.gem :core => "mruby-objectspace"
 
  # Use Fiber class
  conf.gem :core => "mruby-fiber"
 
  # Use extended toplevel object (main) methods
  conf.gem :core => "mruby-toplevel-ext"
 
  # Generate mirb command
  conf.gem :core => "mruby-bin-mirb"
 
  # Generate mruby command
  conf.gem :core => "mruby-bin-mruby"
end
software/mruby.txt · 最終更新: 2013/12/30 04:54 by hktechno