SlideShare une entreprise Scribd logo
1  sur  23
Télécharger pour lire hors ligne
mRuby - Powerful Software for
Embedded System Development



                            mruby developers
                  Kyushu Institute of Technology
                               Kazuaki TANAKA
Lightweight Ruby
●   METI Project 2010-2012
●   Project members:
    ●   Fukuoka CSK
    ●   Network Applied Communication Lab(NaCl)
    ●   Kyushu Institute of Technology
    ●   Toshiba Information Systems
    ●   Fukuoka Prefecture
    ●   SCSK
Why using Ruby?

                 Easy to implement, easy to read



                                               Maintenance
Delivery speed                                   Software lifetime
 Cost
 Startup


           Decreasing bugs       Team development
             Cost
             Quality             Reusability
                                     Software scalability
Ruby
●   Dynamic Linking

                       Application
                                              Dynamic Linking
                                              in Execution



         Application                  Application

           Libraries                    Libraries
        for Platform A               for Platform B
“Lightweight” Ruby
●   Less resources in execution
    ●   Memory space
●   Language specification
    ●   JIS X 3017
    ●   ISO/IEC 30170
●   Short time to delivery
●   Apply to any Hardware
Ruby / mruby
            Execution Mechanisms
●   “Ruby” is interpreter
    ●   Directly execute Ruby codes
    ●   Ruby 1.9 uses YARV(VM)
●   “mruby” is compiler and VM
    ●   Indirectly execute Ruby codes
    ●   Compiler converts Ruby codes into byte-code
        (Development environment)
    ●   VM executes byte-code
        (Execution environment)
Ruby interpreter
          Executer
                                Execution
    Memory Management
          Optimizer


     Semantic Analyzer
                                Preprocess

       Lexical Analyzer
       Syntax Analyzer


Memory map in execution phase
Lightweight Ruby
●   Compiler and VM
                              This phase is done in
       Memory Management      desktop environment

        Byte-code Generator

             Optimizer                VM runs in target device


         Semantic Analyzer

                                  Memory Management
          Lexical Analyzer                 VM
          Syntax Analyzer
                                    Byte-code Loader

       Memory map in                 Memory map in
       Compilation phase             Execution phase
Compiler and VM (image)
Ruby Codes
class Motor < Motor3000TS
 def start
  @status = :on             Byte-code is portable
 end
end                         across any devices.
m1=Motor.new
m1.start


            Compiler            LOAD   r1, 0
                                SEND   r0, :f0, 1
                                LOAD   r1, 5
Byte-code                       SEND   r0, :f2, 1
     LOAD    r1, 0
     SEND    r0, :f0, 1
     LOAD    r1, 5
     SEND    r0, :f2, 1
                                   VM


       Development               Target Device
Requirement from
        embedded system developers
●   Use Ruby language for embedded systems
    ●   “Ruby” requires over 20 or more MB memory
    ●   Reduce using memory
●   Hide Ruby codes
    ●   Encryption
●   Test and Reliability
Embedded System Development
●   Usual development style
    ●   Implement codes in C/C++/Java
    ●   Compile and Link, we get executable file
    ●   Download executables to target device
Problems in development
●   Implement codes in C/C++/Java
    ●   How to keep the quality of programs?
●   Compile and Link
    ●   Cross-compilation
    ●   Target dependent environment is necessary
    ●   Link libraries, we get executable file
    ●   We cannot execute this executable in desktop.
●   Download executables into target device
    ●   We can TEST the executable file.         Bugs....fix it
Development using mruby
●   Implement codes in Ruby
●   Compile, we get an executable file
    ●   We can TEST in desktop.
    ●   VM(for desktop) executes byte-code in desktop.
        Libraries are linked in execution.
●   Download the byte-code into target device
    ●   VM(for target) executes byte-code in target device.
The Mechanism
●   VM executes Ruby program+Library
●   Ruby program(= Byte-code) is
    device independent.
●   Libraries are included in VM
    ●   Target dependent VM is necessary.
        (Once VM is prepared, we can reuse same VM)
Dynamic Linking
●   Methods in Libraries are call by “method name”
    ●   Even if the library was changed, we can find the
        method by seeking method name.

                       LOAD   r1, 0
                       SEND   r0, :f0, 1             Device dependent
                       LOAD   r1, 5        Dynamic
                                           Linking       methods
                       SEND   r0, :f2, 1


Byte-code
                                             VM



                                               Target device
※ “SEND” is like “CALL” instruction.
Advantages
●   Cross-compilation is not necessary
    ●   Simple development and test (agile development)
    ●   Test in desktop
        We don't have to wait the Hardware development.
●   Dynamic Linking
    ●   Byte-code can be reused across the targets.
    ●   Software family management
Disadvantage
●   Execution Speed is slow
    ●   C : Ruby ~~ 100:1
●   VM is single threaded process
    ●   If necessary, multiple VM
●   Interruption is not supported
    ●   Interruption is catch by C
        Ruby is polling request to C
Application area
●   User Interface,Communication
    ●   Customize is easy
●   Network
    ●   Ruby is mainly used in Web applications
    ●   Software Deployment in execution time
        (Dynamic linking, so we can change libraries in
        runtime)
●   Software Initialization
    ●   Boot-up and settings
    ●   Tuning, Test in various configurations
Advisors and their case study
●   Toshiba Information System
    ●     Solar power regulation and monitoring
●   Fuji Electric
    ●     Vending machine
●   IIJ                                             Supported by
    ●     Network router
●   Manycolors
    ●     Bio-informatics
●   ILC
    ●     GUI Libraries for Embedded Applications
Applications




mruby on FPGA chip




                         mruby on Industrial manipulator
                            Multiple VMs on RTOS
Recent results
●   Memory Requirement
    ●   RAM 150KB + ROM 250KB
●   Target platform:
    ●   SH-4, TOPPERS(RTOS)
    ●   H8(w/o OS)
    ●   NIOS II(FPGA), iTRON

    ●   BeagleBoard(ARM Coretex A8), Linux
    ●   GR-SAKURA(Renesas RX63N)(w/o OS)
    ●   Of course, Windows, Mac, Linux
Open Souece Sofrware
●   Lightweight Ruby is called 'mruby'
    ●   Released in GitHub, beta version

            https://github.com/mruby

    ●   MIT License
        You can use mruby without any charge
        for any purpose
    ●   Show the MIT License description and Licenser
mruby forum
●   NPO mruby forum
    ●   Maintain the mruby codes
    ●   Support for libraries
    ●   License management
    ●   Spread



            http://forum.mruby.org/

Contenu connexe

Tendances

Os Grossupdated
Os GrossupdatedOs Grossupdated
Os Grossupdatedoscon2007
 
LAS16-108: JerryScript and other scripting languages for IoT
LAS16-108: JerryScript and other scripting languages for IoTLAS16-108: JerryScript and other scripting languages for IoT
LAS16-108: JerryScript and other scripting languages for IoTLinaro
 
Building a Network IP Camera using Erlang
Building a Network IP Camera using ErlangBuilding a Network IP Camera using Erlang
Building a Network IP Camera using ErlangFrank Hunleth
 
Embedded Erlang, Nerves, and SumoBots
Embedded Erlang, Nerves, and SumoBotsEmbedded Erlang, Nerves, and SumoBots
Embedded Erlang, Nerves, and SumoBotsFrank Hunleth
 
Using Erlang on the RaspberryPi to interact with the physical world
Using Erlang on the RaspberryPi to interact with the physical worldUsing Erlang on the RaspberryPi to interact with the physical world
Using Erlang on the RaspberryPi to interact with the physical worldBrian Chamberlain
 
Os Paesdosreistutorial
Os PaesdosreistutorialOs Paesdosreistutorial
Os Paesdosreistutorialoscon2007
 
Ola Bini J Ruby Power On The Jvm
Ola Bini J Ruby Power On The JvmOla Bini J Ruby Power On The Jvm
Ola Bini J Ruby Power On The Jvmdeimos
 
(phpconftw2012) PHP as a Middleware in Embedded Systems
(phpconftw2012) PHP as a Middleware in Embedded Systems(phpconftw2012) PHP as a Middleware in Embedded Systems
(phpconftw2012) PHP as a Middleware in Embedded Systemssosorry
 
GraalVM - MadridJUG 2019-10-22
GraalVM - MadridJUG 2019-10-22GraalVM - MadridJUG 2019-10-22
GraalVM - MadridJUG 2019-10-22Jorge Hidalgo
 
Aspect Orientated Programming in Ruby
Aspect Orientated Programming in RubyAspect Orientated Programming in Ruby
Aspect Orientated Programming in Rubydeimos
 
Swift for back end: A new generation of full stack languages?
Swift for back end: A new generation of full stack languages?Swift for back end: A new generation of full stack languages?
Swift for back end: A new generation of full stack languages?Koombea
 
Java begin so we win
Java begin so we winJava begin so we win
Java begin so we winIT
 
Build and deploy scientific Python Applications
Build and deploy scientific Python Applications  Build and deploy scientific Python Applications
Build and deploy scientific Python Applications Ramakrishna Reddy
 
Venkat Subramaniam Building DSLs In Groovy
Venkat Subramaniam Building DSLs In GroovyVenkat Subramaniam Building DSLs In Groovy
Venkat Subramaniam Building DSLs In Groovydeimos
 
GraalVM - JBCNConf 2019-05-28
GraalVM - JBCNConf 2019-05-28GraalVM - JBCNConf 2019-05-28
GraalVM - JBCNConf 2019-05-28Jorge Hidalgo
 

Tendances (20)

Os Grossupdated
Os GrossupdatedOs Grossupdated
Os Grossupdated
 
Pyhug zmq
Pyhug zmqPyhug zmq
Pyhug zmq
 
Where is LLVM Being Used Today?
Where is LLVM Being Used Today? Where is LLVM Being Used Today?
Where is LLVM Being Used Today?
 
Os Rego
Os RegoOs Rego
Os Rego
 
LAS16-108: JerryScript and other scripting languages for IoT
LAS16-108: JerryScript and other scripting languages for IoTLAS16-108: JerryScript and other scripting languages for IoT
LAS16-108: JerryScript and other scripting languages for IoT
 
Building a Network IP Camera using Erlang
Building a Network IP Camera using ErlangBuilding a Network IP Camera using Erlang
Building a Network IP Camera using Erlang
 
One VM to Rule Them All
One VM to Rule Them AllOne VM to Rule Them All
One VM to Rule Them All
 
Embedded Erlang, Nerves, and SumoBots
Embedded Erlang, Nerves, and SumoBotsEmbedded Erlang, Nerves, and SumoBots
Embedded Erlang, Nerves, and SumoBots
 
Using Erlang on the RaspberryPi to interact with the physical world
Using Erlang on the RaspberryPi to interact with the physical worldUsing Erlang on the RaspberryPi to interact with the physical world
Using Erlang on the RaspberryPi to interact with the physical world
 
Os Paesdosreistutorial
Os PaesdosreistutorialOs Paesdosreistutorial
Os Paesdosreistutorial
 
JavaScript Introduction
JavaScript IntroductionJavaScript Introduction
JavaScript Introduction
 
Ola Bini J Ruby Power On The Jvm
Ola Bini J Ruby Power On The JvmOla Bini J Ruby Power On The Jvm
Ola Bini J Ruby Power On The Jvm
 
(phpconftw2012) PHP as a Middleware in Embedded Systems
(phpconftw2012) PHP as a Middleware in Embedded Systems(phpconftw2012) PHP as a Middleware in Embedded Systems
(phpconftw2012) PHP as a Middleware in Embedded Systems
 
GraalVM - MadridJUG 2019-10-22
GraalVM - MadridJUG 2019-10-22GraalVM - MadridJUG 2019-10-22
GraalVM - MadridJUG 2019-10-22
 
Aspect Orientated Programming in Ruby
Aspect Orientated Programming in RubyAspect Orientated Programming in Ruby
Aspect Orientated Programming in Ruby
 
Swift for back end: A new generation of full stack languages?
Swift for back end: A new generation of full stack languages?Swift for back end: A new generation of full stack languages?
Swift for back end: A new generation of full stack languages?
 
Java begin so we win
Java begin so we winJava begin so we win
Java begin so we win
 
Build and deploy scientific Python Applications
Build and deploy scientific Python Applications  Build and deploy scientific Python Applications
Build and deploy scientific Python Applications
 
Venkat Subramaniam Building DSLs In Groovy
Venkat Subramaniam Building DSLs In GroovyVenkat Subramaniam Building DSLs In Groovy
Venkat Subramaniam Building DSLs In Groovy
 
GraalVM - JBCNConf 2019-05-28
GraalVM - JBCNConf 2019-05-28GraalVM - JBCNConf 2019-05-28
GraalVM - JBCNConf 2019-05-28
 

Similaire à mRuby - Powerful Software for Embedded System Development

Unmanned Aerial Vehicles: Exploit Automation with the Metasploit Framework
Unmanned Aerial Vehicles: Exploit Automation with the Metasploit FrameworkUnmanned Aerial Vehicles: Exploit Automation with the Metasploit Framework
Unmanned Aerial Vehicles: Exploit Automation with the Metasploit Frameworkegypt
 
An introduction to the ruby ecosystem
An introduction to the ruby ecosystemAn introduction to the ruby ecosystem
An introduction to the ruby ecosystemGeison Goes
 
Lua as a business logic language in high load application
Lua as a business logic language in high load applicationLua as a business logic language in high load application
Lua as a business logic language in high load applicationIlya Martynov
 
Oh the compilers you'll build
Oh the compilers you'll buildOh the compilers you'll build
Oh the compilers you'll buildMark Stoodley
 
Blackray @ SAPO CodeBits 2009
Blackray @ SAPO CodeBits 2009Blackray @ SAPO CodeBits 2009
Blackray @ SAPO CodeBits 2009fschupp
 
Ruby JIT Compilation - Mykhail Bortnyk
Ruby JIT Compilation - Mykhail Bortnyk Ruby JIT Compilation - Mykhail Bortnyk
Ruby JIT Compilation - Mykhail Bortnyk Ruby Meditation
 
Ruby JIT Compilation
Ruby JIT CompilationRuby JIT Compilation
Ruby JIT CompilationAmoniac OÜ
 
Green Custard Friday Talk 22: Flutter
Green Custard Friday Talk 22: FlutterGreen Custard Friday Talk 22: Flutter
Green Custard Friday Talk 22: FlutterGreen Custard
 
DevOpsDays Taipei 2019 - Mastering IaC the DevOps Way
DevOpsDays Taipei 2019 - Mastering IaC the DevOps WayDevOpsDays Taipei 2019 - Mastering IaC the DevOps Way
DevOpsDays Taipei 2019 - Mastering IaC the DevOps Waysmalltown
 
Dotnet framework
Dotnet frameworkDotnet framework
Dotnet frameworkNitu Pandey
 
The Fn Project by Jesse Butler
 The Fn Project by Jesse Butler The Fn Project by Jesse Butler
The Fn Project by Jesse ButlerOracle Developers
 
Serverless Boston @ Oracle Meetup
Serverless Boston @ Oracle MeetupServerless Boston @ Oracle Meetup
Serverless Boston @ Oracle MeetupWayne Scarano
 
LCU14 310- Cisco ODP v2
LCU14 310- Cisco ODP v2LCU14 310- Cisco ODP v2
LCU14 310- Cisco ODP v2Linaro
 

Similaire à mRuby - Powerful Software for Embedded System Development (20)

Grape golilath
Grape golilathGrape golilath
Grape golilath
 
Unmanned Aerial Vehicles: Exploit Automation with the Metasploit Framework
Unmanned Aerial Vehicles: Exploit Automation with the Metasploit FrameworkUnmanned Aerial Vehicles: Exploit Automation with the Metasploit Framework
Unmanned Aerial Vehicles: Exploit Automation with the Metasploit Framework
 
An introduction to the ruby ecosystem
An introduction to the ruby ecosystemAn introduction to the ruby ecosystem
An introduction to the ruby ecosystem
 
Os Lattner
Os LattnerOs Lattner
Os Lattner
 
Nodejs
NodejsNodejs
Nodejs
 
Lua as a business logic language in high load application
Lua as a business logic language in high load applicationLua as a business logic language in high load application
Lua as a business logic language in high load application
 
Oh the compilers you'll build
Oh the compilers you'll buildOh the compilers you'll build
Oh the compilers you'll build
 
Blackray @ SAPO CodeBits 2009
Blackray @ SAPO CodeBits 2009Blackray @ SAPO CodeBits 2009
Blackray @ SAPO CodeBits 2009
 
Apache James/Hupa & GWT
Apache James/Hupa & GWTApache James/Hupa & GWT
Apache James/Hupa & GWT
 
Beginners Node.js
Beginners Node.jsBeginners Node.js
Beginners Node.js
 
Ruby JIT Compilation - Mykhail Bortnyk
Ruby JIT Compilation - Mykhail Bortnyk Ruby JIT Compilation - Mykhail Bortnyk
Ruby JIT Compilation - Mykhail Bortnyk
 
Ruby JIT Compilation
Ruby JIT CompilationRuby JIT Compilation
Ruby JIT Compilation
 
Android presentation
Android presentationAndroid presentation
Android presentation
 
Green Custard Friday Talk 22: Flutter
Green Custard Friday Talk 22: FlutterGreen Custard Friday Talk 22: Flutter
Green Custard Friday Talk 22: Flutter
 
DevOpsDays Taipei 2019 - Mastering IaC the DevOps Way
DevOpsDays Taipei 2019 - Mastering IaC the DevOps WayDevOpsDays Taipei 2019 - Mastering IaC the DevOps Way
DevOpsDays Taipei 2019 - Mastering IaC the DevOps Way
 
Dotnet framework
Dotnet frameworkDotnet framework
Dotnet framework
 
The Fn Project by Jesse Butler
 The Fn Project by Jesse Butler The Fn Project by Jesse Butler
The Fn Project by Jesse Butler
 
Serverless Boston @ Oracle Meetup
Serverless Boston @ Oracle MeetupServerless Boston @ Oracle Meetup
Serverless Boston @ Oracle Meetup
 
LCU14 310- Cisco ODP v2
LCU14 310- Cisco ODP v2LCU14 310- Cisco ODP v2
LCU14 310- Cisco ODP v2
 
Remote Web Desk
Remote Web DeskRemote Web Desk
Remote Web Desk
 

mRuby - Powerful Software for Embedded System Development

  • 1. mRuby - Powerful Software for Embedded System Development mruby developers Kyushu Institute of Technology Kazuaki TANAKA
  • 2. Lightweight Ruby ● METI Project 2010-2012 ● Project members: ● Fukuoka CSK ● Network Applied Communication Lab(NaCl) ● Kyushu Institute of Technology ● Toshiba Information Systems ● Fukuoka Prefecture ● SCSK
  • 3. Why using Ruby? Easy to implement, easy to read Maintenance Delivery speed Software lifetime Cost Startup Decreasing bugs Team development Cost Quality Reusability Software scalability
  • 4. Ruby ● Dynamic Linking Application Dynamic Linking in Execution Application Application Libraries Libraries for Platform A for Platform B
  • 5. “Lightweight” Ruby ● Less resources in execution ● Memory space ● Language specification ● JIS X 3017 ● ISO/IEC 30170 ● Short time to delivery ● Apply to any Hardware
  • 6. Ruby / mruby Execution Mechanisms ● “Ruby” is interpreter ● Directly execute Ruby codes ● Ruby 1.9 uses YARV(VM) ● “mruby” is compiler and VM ● Indirectly execute Ruby codes ● Compiler converts Ruby codes into byte-code (Development environment) ● VM executes byte-code (Execution environment)
  • 7. Ruby interpreter Executer Execution Memory Management Optimizer Semantic Analyzer Preprocess Lexical Analyzer Syntax Analyzer Memory map in execution phase
  • 8. Lightweight Ruby ● Compiler and VM This phase is done in Memory Management desktop environment Byte-code Generator Optimizer VM runs in target device Semantic Analyzer Memory Management Lexical Analyzer VM Syntax Analyzer Byte-code Loader Memory map in Memory map in Compilation phase Execution phase
  • 9. Compiler and VM (image) Ruby Codes class Motor < Motor3000TS def start @status = :on Byte-code is portable end end across any devices. m1=Motor.new m1.start Compiler LOAD r1, 0 SEND r0, :f0, 1 LOAD r1, 5 Byte-code SEND r0, :f2, 1 LOAD r1, 0 SEND r0, :f0, 1 LOAD r1, 5 SEND r0, :f2, 1 VM Development Target Device
  • 10. Requirement from embedded system developers ● Use Ruby language for embedded systems ● “Ruby” requires over 20 or more MB memory ● Reduce using memory ● Hide Ruby codes ● Encryption ● Test and Reliability
  • 11. Embedded System Development ● Usual development style ● Implement codes in C/C++/Java ● Compile and Link, we get executable file ● Download executables to target device
  • 12. Problems in development ● Implement codes in C/C++/Java ● How to keep the quality of programs? ● Compile and Link ● Cross-compilation ● Target dependent environment is necessary ● Link libraries, we get executable file ● We cannot execute this executable in desktop. ● Download executables into target device ● We can TEST the executable file. Bugs....fix it
  • 13. Development using mruby ● Implement codes in Ruby ● Compile, we get an executable file ● We can TEST in desktop. ● VM(for desktop) executes byte-code in desktop. Libraries are linked in execution. ● Download the byte-code into target device ● VM(for target) executes byte-code in target device.
  • 14. The Mechanism ● VM executes Ruby program+Library ● Ruby program(= Byte-code) is device independent. ● Libraries are included in VM ● Target dependent VM is necessary. (Once VM is prepared, we can reuse same VM)
  • 15. Dynamic Linking ● Methods in Libraries are call by “method name” ● Even if the library was changed, we can find the method by seeking method name. LOAD r1, 0 SEND r0, :f0, 1 Device dependent LOAD r1, 5 Dynamic Linking methods SEND r0, :f2, 1 Byte-code VM Target device ※ “SEND” is like “CALL” instruction.
  • 16. Advantages ● Cross-compilation is not necessary ● Simple development and test (agile development) ● Test in desktop We don't have to wait the Hardware development. ● Dynamic Linking ● Byte-code can be reused across the targets. ● Software family management
  • 17. Disadvantage ● Execution Speed is slow ● C : Ruby ~~ 100:1 ● VM is single threaded process ● If necessary, multiple VM ● Interruption is not supported ● Interruption is catch by C Ruby is polling request to C
  • 18. Application area ● User Interface,Communication ● Customize is easy ● Network ● Ruby is mainly used in Web applications ● Software Deployment in execution time (Dynamic linking, so we can change libraries in runtime) ● Software Initialization ● Boot-up and settings ● Tuning, Test in various configurations
  • 19. Advisors and their case study ● Toshiba Information System ● Solar power regulation and monitoring ● Fuji Electric ● Vending machine ● IIJ Supported by ● Network router ● Manycolors ● Bio-informatics ● ILC ● GUI Libraries for Embedded Applications
  • 20. Applications mruby on FPGA chip mruby on Industrial manipulator Multiple VMs on RTOS
  • 21. Recent results ● Memory Requirement ● RAM 150KB + ROM 250KB ● Target platform: ● SH-4, TOPPERS(RTOS) ● H8(w/o OS) ● NIOS II(FPGA), iTRON ● BeagleBoard(ARM Coretex A8), Linux ● GR-SAKURA(Renesas RX63N)(w/o OS) ● Of course, Windows, Mac, Linux
  • 22. Open Souece Sofrware ● Lightweight Ruby is called 'mruby' ● Released in GitHub, beta version https://github.com/mruby ● MIT License You can use mruby without any charge for any purpose ● Show the MIT License description and Licenser
  • 23. mruby forum ● NPO mruby forum ● Maintain the mruby codes ● Support for libraries ● License management ● Spread http://forum.mruby.org/