23. mruby on Mac OS X
$ git clone https://github.com/mruby/mruby.git
$ ruby ./minirake
$ ./bin/mruby -e 'p "Hello World!"'
"Hello World!"
$
mruby for PCs is not so hard
25. mruby on embedded system
● get board
● get JTAG cable
● connect wire
● configure OpenOCD
● (....)
● (...we have not touched mruby...)
mruby for embedded is pretty hard
37. 開發環境
● Eclipse + CDT
● YAGARTO GNU ARM toolchain
● st-util
● mruby tools plugin
development tools
38. 我們的軟件
● mrbgem generator (eclipse plugin)
● mruby-LED class (extensional library)
which tools/library we created
39. Our sample mruby code
● LED control class (mruby)
● porting C library into mruby
● Create mrbgem control LED port library
40. List of tools
● EclipseCDT
http://www.eclipse.org/downloads/
● GDBServer
https://github.com/texane/stlink
● YAGARTO GNU ARM toolchain
http://www.yagarto.de/
● STM32board firmware package(example code)
http://www.st.com/web/en/catalog/tools/PF257904
● mruby tools plugin (Eclipse plugin)
github(https://github.com/yamanekko) coming soon!
41. The process
1. create mrbgem for LED control
2.create mrubylibrary(include LED control gem)
3.create STM32F4Discovery project
4.create ruby program
5.execute
49. Build mruby
● Project -> Build Project
● mruby library was created. use this library in
the project of STM32f4
50. CREATE STM32F4DISCOVERY'S
PROJECT
● Get example from STMicroelectronics's site
● Get STM32F4-Discovery example from emb4fun's site
● Do necessary modifications
51. STM32F4-DISCOVERY
● Get example code from STMicroelectronics's site
http://www.st.com/web/en/catalog/tools/PF257904
stsw-stm32068.zip
● unzip -> STM32F4-Discovery_FW_V1.1.0
54. modify makefile
● Include path
● Use mruby library
● Increase Heap size <- the most important point!
● etc...
55. Write ruby code
● Insert “beginning tag” and “ending tag”
● write ruby cord in between beginning tag and ending
tag
● Two ways to embed ruby code
1.Use menu bar
2.Use tool bar
Insert ruby code in .c file
Insert .rb file name in .c file
/* <ruby->
...
<-ruby> */
/* <rubyfile->
aaa.rb
<-rubyfile> */