使用Eclipse快樂的mruby開發
Upcoming SlideShare
Loading in...5
×
 

使用Eclipse快樂的mruby開發

on

  • 2,201 views

 

Statistics

Views

Total Views
2,201
Views on SlideShare
1,927
Embed Views
274

Actions

Likes
3
Downloads
4
Comments
0

1 Embed 274

https://twitter.com 274

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

使用Eclipse快樂的mruby開發 使用Eclipse快樂的mruby開發 Presentation Transcript

  • fun mruby develoment with Eclipse2013/04/19Team yamanekkoMasayoshi TakahashiYurie Yamane使用Eclipse快樂的mruby開發
  • 自我介紹●山根ゆりえ(Yurie Yamane)●高橋征義(Masayoshi Takahashi)self introduction
  • RubyConf 2012our talks
  • RubyConf Taiwan 2012our talks
  • 自我介紹Team Yamanekko
  • ebook publisher
  • 今天的主題Todays Topic
  • mrubyhttp://mrb.h2so5.net/
  • 輕量型RubyMinimal Ruby
  • 嵌入式RubyeMededdable Ruby
  • 用途“Embedded?”
  • 用途● 嵌入其他應用軟件● 嵌入式系統into applicationfor embedded systems
  • 用途● 嵌入其他應用軟件● 嵌入式系統for embedded systems
  • FM3 (Fujitsu, Cortex M3)http://www.kumikomi.net/interface/contents/fm3.phptarget boards weve tried
  • GR-SAKURA (Renesas, RX63N)http://japan.renesas.com/products/promotion/gr/index.jsptarget boards weve tried
  • RubyConf 2012our talks
  • RubyConf Taiwan 2012our talks
  • 大江戶Ruby會議03our talkshttp://www.flickr.com/photos/igaiga/8564676738/
  • 回顧Retrospective
  • 我們的目標= 快樂的mruby開發Our goals is mruby for fun
  • 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
  • http://www.flickr.com/photos/29638108@N06/8030322376/
  • mruby on embedded system● get board● get JTAG cable● connect wire● configure OpenOCD● (....)● (...we have not touched mruby...)mruby for embedded is pretty hard
  • http://www.flickr.com/photos/everexplore/8536595421/
  • 我們需要更容易的開發環境We need more easy-to-use environment
  • http://www.pageplugins.com/generators/fordummies/
  • “For Dummies” ???●指令碼語言(mruby!!)● 不使用軟銲、不使用面包板●硬體(cross)除錯器● GUI整合開發環境● 便利的工具
  • 開發板: STM32F4 Discoveryhttp://www.st.com/web/catalog/tools/FM116/SC959/SS1532/PF252419now we use STM32F4 discovery・ARM (Coretex M4)・1MB Flash, 192KB RAM・4 LED・1 switch・on board STLINK
  • mruby的特徵●embeddable●configurable●pluggable
  • embeddableRubylibmrubyC/C++ app/usr/bin/rubyCRuby mruby
  • CRubyRuby Interpreter*.rb (your code)*.rb (stdlib) ext
  • mrubymrubyVM*.rb (stdlib)*.rb (your code)Bytecode(C String)C/C++
  • pluggable● mruby-sprintf● mruby-print● mruby-math● mruby-time● mruby-struct● mruby-enum-ext● mruby-string-ext● mruby-numeric-ext● mruby-array-ext● mruby-hash-ext● mruby-random● mruby-evalstandard mrbgems
  • configurable● MRB_USE_FLOAT● MRB_INT64● MRB_NAN_BOXING● MRB_ENDIAN_BIG● MRB_FUNCALL_ARGC_MAX●MRB_HEAP_PAGE_SIZE● MRB_USE_IV_SEGLIST● MRB_IVHASH_INIT_SIZE● MRB_IREP_ARRAY_INIT_SIZE● KHASH_DEFAULT_SIZE● POOL_ALIGNMENT● POOL_PAGE_SIZE● MRB_STR_BUF_MIN_SIZE● MRB_PARSER_BUF_SIZE● MRB_PARSER_BUF_SIZE● ENABLE_DEBUG#define in mrbconf.h
  • 開發環境● Eclipse + CDT● YAGARTO GNU ARM toolchain● st-util● mruby tools plugindevelopment tools
  • 我們的軟件● mrbgem generator (eclipse plugin)● mruby-LED class (extensional library)which tools/library we created
  • Our sample mruby code● LED control class (mruby)● porting C library into mruby● Create mrbgem control LED port library
  • List of tools● EclipseCDThttp://www.eclipse.org/downloads/● GDBServerhttps://github.com/texane/stlink● YAGARTO GNU ARM toolchainhttp://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!
  • The process1. create mrbgem for LED control2.create mrubylibrary(include LED control gem)3.create STM32F4Discovery project4.create ruby program5.execute
  • Create new mruby project
  • USE EGit● mruby is distributed on Github● Clone mruby repository
  • mruby project was created● create mruby project with cloned mruby
  • CREATE CUSTOM mrbgems● create the mrbgem to control STM32F4-DiscoverysLED port from ruby
  • CREATE NEW mrbgem WIZARD● mrbgem wizard can create necessary files, directoryconstitution and template files
  • add your code to your mrbgem
  • build_config.rb● Write MRuby::CrossBuild with mruby-led
  • Build mruby● Project -> Build Project● mruby library was created. use this library inthe project of STM32f4
  • CREATE STM32F4DISCOVERYSPROJECT● Get example from STMicroelectronicss site● Get STM32F4-Discovery example from emb4funs site● Do necessary modifications
  • STM32F4-DISCOVERY● Get example code from STMicroelectronicss sitehttp://www.st.com/web/en/catalog/tools/PF257904stsw-stm32068.zip● unzip -> STM32F4-Discovery_FW_V1.1.0
  • gccs file● .ld, makefile .s etchttp://www.emb4fun.de/arm/examples/index.htmlSTM32F4-Discovery.zipSTM32F4-Discovery/prj/stm32f4xxxg_flash.ldSTM32F4-Discovery/src/syscalls.cSTM32F4-Discovery/makefileSTM32F4-Discovery/cmsis/device/startup_stm32f4xx.s
  • CREATE STM32F4DISCOVERYSPROJECT● Create new makefile project with existing code
  • modify makefile● Include path● Use mruby library● Increase Heap size <- the most important point!● etc...
  • Write ruby code● Insert “beginning tag” and “ending tag”● write ruby cord in between beginning tag and endingtag● Two ways to embed ruby code1.Use menu bar2.Use tool barInsert ruby code in .c fileInsert .rb file name in .c file/* <ruby->...<-ruby> *//* <rubyfile->aaa.rb<-rubyfile> */
  • Rubycode -> bytecode use mrbc● to generate executable mruby code
  • Build● Create elf file●
  • debug● 1. run -> externalTools -> “ST-Link”● 2. run -> debug as -> “STM32F4-Discovery Build”
  • GDBServer infomation● Remote debugging●
  • Debug information● Debug configurations● To input Remote target
  • To start GDBServer● Select ST-Link setting from External tools menu
  • debug
  • DEMO● LED brinkGreen on -> Orange on -> Red on -> Blue on -> all off● 10times repeat
  • 結論更快樂的mruby開發!ConclusionHappy mruby Hacking!
  • 謝謝!