mRuby - Powerful Software for Embedded System Development

2,043 views
1,819 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
2,043
On SlideShare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
20
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

mRuby - Powerful Software for Embedded System Development

  1. 1. mRuby - Powerful Software forEmbedded System Development mruby developers Kyushu Institute of Technology Kazuaki TANAKA
  2. 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. 3. Why using Ruby? Easy to implement, easy to read MaintenanceDelivery speed Software lifetime Cost Startup Decreasing bugs Team development Cost Quality Reusability Software scalability
  4. 4. Ruby● Dynamic Linking Application Dynamic Linking in Execution Application Application Libraries Libraries for Platform A for Platform B
  5. 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. 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. 7. Ruby interpreter Executer Execution Memory Management Optimizer Semantic Analyzer Preprocess Lexical Analyzer Syntax AnalyzerMemory map in execution phase
  8. 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. 9. Compiler and VM (image)Ruby Codesclass Motor < Motor3000TS def start @status = :on Byte-code is portable endend across any devices.m1=Motor.newm1.start Compiler LOAD r1, 0 SEND r0, :f0, 1 LOAD r1, 5Byte-code SEND r0, :f2, 1 LOAD r1, 0 SEND r0, :f0, 1 LOAD r1, 5 SEND r0, :f2, 1 VM Development Target Device
  10. 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. 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. 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. 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. 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. 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, 1Byte-code VM Target device※ “SEND” is like “CALL” instruction.
  16. 16. Advantages● Cross-compilation is not necessary ● Simple development and test (agile development) ● Test in desktop We dont have to wait the Hardware development.● Dynamic Linking ● Byte-code can be reused across the targets. ● Software family management
  17. 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. 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. 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. 20. Applicationsmruby on FPGA chip mruby on Industrial manipulator Multiple VMs on RTOS
  21. 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. 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. 23. mruby forum● NPO mruby forum ● Maintain the mruby codes ● Support for libraries ● License management ● Spread http://forum.mruby.org/

×