ºÝºÝߣ

ºÝºÝߣShare a Scribd company logo
Now is the time to create your own (m)Ruby computer
What¡¯s your childhood dream ?
PLAYING VIDEO GAMES FREELY
CREATING VIDEO GAMES
FAMILY BASIC
My longing programing hardware using BASIC on Family Computer(NES)
CREATING VIDEO GAME
HARDWARE??
You can make
your own computer
with mruby!
WHO AM I?
Katsuhiko Kageyama
¡°kishima¡± @ twitter/github
? Embedded software engineer in a manufacturing
company
? Making mruby devices
? Personally, producing technical books about
mruby and original devices in TechBookFest,
Comic Market and Maker Faire(2020 Tsukuba).
MY
DEVICES
MY HOBBY
Agenda
?How to create your computer
?Why mruby?
?Important technical things about mruby
GOAL OF MY DEVELOPMENT
?Creating my small
computer to run Ruby
scripts like ¡°Family BASIC¡±
?I call it ¡°Family mruby¡±
How to create your computer
DEFINE
REQUIREMENTS
FIND
COMPONENTS
MAKE A
SCHEMATICS
MANUFACTURING
THE DEVICE
IMPLEMENT
SOFTWARE
Define requirements
Find components
Make a schematics
Manufacturing the device
Implement software
Each steps are no so difficult for software
engineers
According to your idea
Find components which satisfy your requirements.
DigiKey is a good worldwide supplier
Digital signal schematics could be simple
We can use KiCAD
Chinese company offers 5$ / 5 boards
You need to implement basic software
Write application using Ruby!
?I love Ruby
?No one likes to wait for compiling C and flashing img
?Shorter code is nice for the small device
Why mruby?
?mruby can run on some small processors with
limited memory (>400KB RAM preferred)
?Simple implementation of mruby VM helps to port
it to your own hardware
FINDING THE CORE PROCESSOR
Board MCU ROM size RAM size
Arduino ATmega328p 32KB 2KB
ProMicro ATmega32U4 32KB 2.5KB
ESP32 dev board ESP32-WROOM-32 4MB 520KB
ESP32 dev board ESP32-WROVER-B 4MB 8MB
Raspberry Pi zero ARM1176JZF-S >1GB
(external)
512MB
(external)
£ªmruby requires >400kB memory
Requirements Schematics
Manufacturing
Implement basic software
?Small processor doesn¡¯t support rich OS like Linux.
?C, C++ are common language
?Difficult to avoid C/C++ because low layer are
provided by C/C++ usually
My idea : System diagram
Dev host
ESP-IDF
my device
ESP32Arduino core
FabGL
mrbgem fro esp32
mruby compiler/VM
mruby user App
System
App
(C++)
family_mruby
Micro SD
xtensa tool chain
Serial communication
PS/2 key board
ESP32-WROVER-B
Updating software
Active speaker
VGA monitor
My hardware
?Small
manufacturing was
done by Chinese
company
?Case was made by
my 3D-printer
DIFFICULTY OF IMPLEMENTATION
?Limited memory
?Always need to take care of remaining memory
? Avoid creating so many Ruby objects
?Low performance
?Use HW function(Interruption, DMA etc.) as much as possible
INTERRUPTION
? Hardware interruption is good for receiving
HW event
CPU
Button
Electrical signal
Function A
(running)
Function B
(Interruption handler)
Interruption signal will change the program counter to
an interruption hander
MRUBY CANNOT HANDLE HW INTERRUPTION
? Cannot not touch mruby VM¡¯s resource from the interruption handler
? The handler has higher priority
? Common solution is a polling method
loop do
if Input::available
if Input::keydown?(Key::K_UP)
my=-2
end
if Input::keydown?(Key::K_DOWN)
my=2
end
end
sp.move(mx*1,my*1)
end
Checking inputs in
a loop
? This is not the best in the limited CPU
performance condition
SOFTWARE-LAYER INTERRUPTION
? Compromised solution for handling interruption
? Similar idea is applied in eLua and MicroPython
https://github.com/kishima/mruby-interrupt
CPU
Button
Electrical signal
Function A
(running)
Function B
(Interruption handler)
mruby VM
mruby VM do polling
events
Storing int. event in the
handler
Example:
Implementation
(experimental)
* vm.c *
#ifndef MRB_SW_INTERRUPT
#define CASE(insn,ops) L_ ## insn: pc0=p
c++; FETCH_ ## ops (); L_ ## insn ## _BO
DY:
#else
#define CASE(insn,ops) L_ ## insn: pc0=p
c++; exec_interrupt(mrb); FETCH_ ## ops
(); L_ ## insn ## _BODY:
#endif
* vm.c *
#ifdef MRB_SW_INTERRUPT
static void exec_interrupt(mrb_state *mrb){
if(!mrb->interrupt_func)
return;
while( !(mrb->interrupt_flag & 0x8000) && mrb-
>interrupt_flag & 0x7FFF){
for(int i=0;i<16;i++){
int bit = (mrb-
>interrupt_flag >> i) & 0x0001;
if(bit){
mrb->user_mutex_func(mrb,1);
uint16_t backup = mrb->interrupt_flag;
mrb-
>interrupt_flag |= 0x8000; //Interrupt flag
mrb->interrupt_func(mrb,i);
mrb->interrupt_flag = backup;
mrb->interrupt_flag &= ~(1 << i);
mrb->user_mutex_func(mrb,0);
}
}
}
}
#endif
exec_interrupt() will be executed
when VM fetchs each mruby byte
code.
Now is the time to create your own (m)Ruby computer
SUMMARY
?We can create our own device
?I have created Family mruby
?Software interruption is a good
tool for making devices
?Enjoy your maker life
https://kishima.github.io/family_mruby/
THANK YOU!

More Related Content

Similar to Now is the time to create your own (m)Ruby computer (20)

Quick prototyping using Gadgeteer, Raspberry Pi + Fez Cream
Quick prototyping using Gadgeteer, Raspberry Pi + Fez CreamQuick prototyping using Gadgeteer, Raspberry Pi + Fez Cream
Quick prototyping using Gadgeteer, Raspberry Pi + Fez Cream
Mif Masterz
?
Embedded Linux Systems Basics
Embedded Linux Systems BasicsEmbedded Linux Systems Basics
Embedded Linux Systems Basics
Max Henery
?
Programming the Real World: Javascript for Makers
Programming the Real World: Javascript for MakersProgramming the Real World: Javascript for Makers
Programming the Real World: Javascript for Makers
pchristensen
?
Marmalade bittersweet experience
Marmalade bittersweet experienceMarmalade bittersweet experience
Marmalade bittersweet experience
Alexander Degtyarev
?
Debugging a .NET program after crash (Post-mortem debugging)
Debugging a .NET program after crash (Post-mortem debugging)Debugging a .NET program after crash (Post-mortem debugging)
Debugging a .NET program after crash (Post-mortem debugging)
Mirco Vanini
?
A new way to inspire and stimulate learning
A new way to inspire and stimulate learningA new way to inspire and stimulate learning
A new way to inspire and stimulate learning
Lee Stott
?
raspberry pi (generalised)
 raspberry pi (generalised) raspberry pi (generalised)
raspberry pi (generalised)
Amit Dwivedi
?
Arduino Easy way to create robots
Arduino Easy way to create robotsArduino Easy way to create robots
Arduino Easy way to create robots
Desiree Santos
?
Introduction To Raspberry Pi with Simple GPIO pin Control
Introduction To Raspberry Pi with Simple GPIO pin ControlIntroduction To Raspberry Pi with Simple GPIO pin Control
Introduction To Raspberry Pi with Simple GPIO pin Control
Pradip Bhandari
?
Marmalade: bittersweet experience
Marmalade: bittersweet experienceMarmalade: bittersweet experience
Marmalade: bittersweet experience
Max Klyga
?
Zach Murray CEIS 106 Project
Zach Murray CEIS 106 ProjectZach Murray CEIS 106 Project
Zach Murray CEIS 106 Project
ZacharyMurray8
?
Cesec2015 - Arduino Designer
Cesec2015 - Arduino DesignerCesec2015 - Arduino Designer
Cesec2015 - Arduino Designer
melbats
?
Add sale davinci
Add sale davinciAdd sale davinci
Add sale davinci
Akash Sahoo
?
Hacking with Reverse Engineering and Defense against it
Hacking with Reverse Engineering and Defense against it Hacking with Reverse Engineering and Defense against it
Hacking with Reverse Engineering and Defense against it
Prakashchand Suthar
?
Advanced Video Production with FOSS
Advanced Video Production with FOSSAdvanced Video Production with FOSS
Advanced Video Production with FOSS
Kirk Kimmel
?
Let's begin io t with $10
Let's begin io t with $10Let's begin io t with $10
Let's begin io t with $10
Makoto Takahashi
?
Project Proposal for Minor Project
Project Proposal for Minor Project Project Proposal for Minor Project
Project Proposal for Minor Project
Aniket Maithani
?
Embedded programming Embedded programming (1).pptx
Embedded programming Embedded programming (1).pptxEmbedded programming Embedded programming (1).pptx
Embedded programming Embedded programming (1).pptx
lematadese670
?
Raspbeery Pi : An Introduction
Raspbeery Pi : An IntroductionRaspbeery Pi : An Introduction
Raspbeery Pi : An Introduction
Vatsal N Shah
?
UI Beyond the Browser - Software for Hardware Projects
UI Beyond the Browser - Software for Hardware ProjectsUI Beyond the Browser - Software for Hardware Projects
UI Beyond the Browser - Software for Hardware Projects
pchristensen
?
Quick prototyping using Gadgeteer, Raspberry Pi + Fez Cream
Quick prototyping using Gadgeteer, Raspberry Pi + Fez CreamQuick prototyping using Gadgeteer, Raspberry Pi + Fez Cream
Quick prototyping using Gadgeteer, Raspberry Pi + Fez Cream
Mif Masterz
?
Embedded Linux Systems Basics
Embedded Linux Systems BasicsEmbedded Linux Systems Basics
Embedded Linux Systems Basics
Max Henery
?
Programming the Real World: Javascript for Makers
Programming the Real World: Javascript for MakersProgramming the Real World: Javascript for Makers
Programming the Real World: Javascript for Makers
pchristensen
?
Debugging a .NET program after crash (Post-mortem debugging)
Debugging a .NET program after crash (Post-mortem debugging)Debugging a .NET program after crash (Post-mortem debugging)
Debugging a .NET program after crash (Post-mortem debugging)
Mirco Vanini
?
A new way to inspire and stimulate learning
A new way to inspire and stimulate learningA new way to inspire and stimulate learning
A new way to inspire and stimulate learning
Lee Stott
?
raspberry pi (generalised)
 raspberry pi (generalised) raspberry pi (generalised)
raspberry pi (generalised)
Amit Dwivedi
?
Arduino Easy way to create robots
Arduino Easy way to create robotsArduino Easy way to create robots
Arduino Easy way to create robots
Desiree Santos
?
Introduction To Raspberry Pi with Simple GPIO pin Control
Introduction To Raspberry Pi with Simple GPIO pin ControlIntroduction To Raspberry Pi with Simple GPIO pin Control
Introduction To Raspberry Pi with Simple GPIO pin Control
Pradip Bhandari
?
Marmalade: bittersweet experience
Marmalade: bittersweet experienceMarmalade: bittersweet experience
Marmalade: bittersweet experience
Max Klyga
?
Zach Murray CEIS 106 Project
Zach Murray CEIS 106 ProjectZach Murray CEIS 106 Project
Zach Murray CEIS 106 Project
ZacharyMurray8
?
Cesec2015 - Arduino Designer
Cesec2015 - Arduino DesignerCesec2015 - Arduino Designer
Cesec2015 - Arduino Designer
melbats
?
Hacking with Reverse Engineering and Defense against it
Hacking with Reverse Engineering and Defense against it Hacking with Reverse Engineering and Defense against it
Hacking with Reverse Engineering and Defense against it
Prakashchand Suthar
?
Advanced Video Production with FOSS
Advanced Video Production with FOSSAdvanced Video Production with FOSS
Advanced Video Production with FOSS
Kirk Kimmel
?
Project Proposal for Minor Project
Project Proposal for Minor Project Project Proposal for Minor Project
Project Proposal for Minor Project
Aniket Maithani
?
Embedded programming Embedded programming (1).pptx
Embedded programming Embedded programming (1).pptxEmbedded programming Embedded programming (1).pptx
Embedded programming Embedded programming (1).pptx
lematadese670
?
Raspbeery Pi : An Introduction
Raspbeery Pi : An IntroductionRaspbeery Pi : An Introduction
Raspbeery Pi : An Introduction
Vatsal N Shah
?
UI Beyond the Browser - Software for Hardware Projects
UI Beyond the Browser - Software for Hardware ProjectsUI Beyond the Browser - Software for Hardware Projects
UI Beyond the Browser - Software for Hardware Projects
pchristensen
?

More from kishima7 (16)

³¾°ù³Ü²ú²â¤Ç×÷¤ë¥Þ¥¤¥³¥ó¥Ü©`¥É
³¾°ù³Ü²ú²â¤Ç×÷¤ë¥Þ¥¤¥³¥ó¥Ü©`¥É³¾°ù³Ü²ú²â¤Ç×÷¤ë¥Þ¥¤¥³¥ó¥Ü©`¥É
³¾°ù³Ü²ú²â¤Ç×÷¤ë¥Þ¥¤¥³¥ó¥Ü©`¥É
kishima7
?
×Ô·Ö¤À¤±¤Î¥Ç¥Ð¥¤¥¹¤ò×÷¤ë¤ª»°
×Ô·Ö¤À¤±¤Î¥Ç¥Ð¥¤¥¹¤ò×÷¤ë¤ª»°×Ô·Ö¤À¤±¤Î¥Ç¥Ð¥¤¥¹¤ò×÷¤ë¤ª»°
×Ô·Ö¤À¤±¤Î¥Ç¥Ð¥¤¥¹¤ò×÷¤ë¤ª»°
kishima7
?
¥ª¥ê¥¸¥Ê¥ë³¾°ù³Ü²ú²â¥Ç¥Ð¥¤¥¹×÷¤ê
¥ª¥ê¥¸¥Ê¥ë³¾°ù³Ü²ú²â¥Ç¥Ð¥¤¥¹×÷¤ê¥ª¥ê¥¸¥Ê¥ë³¾°ù³Ü²ú²â¥Ç¥Ð¥¤¥¹×÷¤ê
¥ª¥ê¥¸¥Ê¥ë³¾°ù³Ü²ú²â¥Ç¥Ð¥¤¥¹×÷¤ê
kishima7
?
mruby VM ¤òÕ{¤Ù¤Æ¤ß¤¿Ô’
mruby VM ¤òÕ{¤Ù¤Æ¤ß¤¿Ô’mruby VM ¤òÕ{¤Ù¤Æ¤ß¤¿Ô’
mruby VM ¤òÕ{¤Ù¤Æ¤ß¤¿Ô’
kishima7
?
Stairway to my Family mruby
Stairway to my Family mrubyStairway to my Family mruby
Stairway to my Family mruby
kishima7
?
³Õ²Ñ¤ò¸Ä¤á¤Æѧ¤ó¤Ç¼û¤ë
³Õ²Ñ¤ò¸Ä¤á¤Æѧ¤ó¤Ç¼û¤ë³Õ²Ñ¤ò¸Ä¤á¤Æѧ¤ó¤Ç¼û¤ë
³Õ²Ñ¤ò¸Ä¤á¤Æѧ¤ó¤Ç¼û¤ë
kishima7
?
mruby/c¤Çʼ¤á¤ëM5Stack £¦mruby¥¹¥¯¥ê¥×¥Èé_°k
mruby/c¤Çʼ¤á¤ëM5Stack £¦mruby¥¹¥¯¥ê¥×¥Èé_°kmruby/c¤Çʼ¤á¤ëM5Stack £¦mruby¥¹¥¯¥ê¥×¥Èé_°k
mruby/c¤Çʼ¤á¤ëM5Stack £¦mruby¥¹¥¯¥ê¥×¥Èé_°k
kishima7
?
Wio LTE¤Èmruby/c¤ÇIoT
Wio LTE¤Èmruby/c¤ÇIoTWio LTE¤Èmruby/c¤ÇIoT
Wio LTE¤Èmruby/c¤ÇIoT
kishima7
?
±«²Ô¾±³Ù²â¤Ë³¾°ù³Ü²ú²â¤ò×é¤ßÞz¤ó¤Ç³éÑ¡¤ò¤·¤Æ¤ß¤¿
±«²Ô¾±³Ù²â¤Ë³¾°ù³Ü²ú²â¤ò×é¤ßÞz¤ó¤Ç³éÑ¡¤ò¤·¤Æ¤ß¤¿±«²Ô¾±³Ù²â¤Ë³¾°ù³Ü²ú²â¤ò×é¤ßÞz¤ó¤Ç³éÑ¡¤ò¤·¤Æ¤ß¤¿
±«²Ô¾±³Ù²â¤Ë³¾°ù³Ü²ú²â¤ò×é¤ßÞz¤ó¤Ç³éÑ¡¤ò¤·¤Æ¤ß¤¿
kishima7
?
Introduction of mruby & Webruby script example
Introduction of mruby & Webruby script exampleIntroduction of mruby & Webruby script example
Introduction of mruby & Webruby script example
kishima7
?
Dalvik Source Code Reading
Dalvik Source Code ReadingDalvik Source Code Reading
Dalvik Source Code Reading
kishima7
?
Ruby and Android
Ruby and AndroidRuby and Android
Ruby and Android
kishima7
?
Google TV hack
Google TV hackGoogle TV hack
Google TV hack
kishima7
?
¤¯¤ß¤³¤ß¤«¤é¤Ò¤È¤³¤È¸é±ð³Ù³Ü°ù²Ô²õ
¤¯¤ß¤³¤ß¤«¤é¤Ò¤È¤³¤È¸é±ð³Ù³Ü°ù²Ô²õ¤¯¤ß¤³¤ß¤«¤é¤Ò¤È¤³¤È¸é±ð³Ù³Ü°ù²Ô²õ
¤¯¤ß¤³¤ß¤«¤é¤Ò¤È¤³¤È¸é±ð³Ù³Ü°ù²Ô²õ
kishima7
?
¥Í¥Ã¥È¼Òµç¤¸¤ã¤Ê¤¯¤Æ£¿
¥Í¥Ã¥È¼Òµç¤¸¤ã¤Ê¤¯¤Æ£¿¥Í¥Ã¥È¼Òµç¤¸¤ã¤Ê¤¯¤Æ£¿
¥Í¥Ã¥È¼Òµç¤¸¤ã¤Ê¤¯¤Æ£¿
kishima7
?
¤¯¤ß¤³¤ß¤«¤é¤Ò¤È¤³¤È
¤¯¤ß¤³¤ß¤«¤é¤Ò¤È¤³¤È¤¯¤ß¤³¤ß¤«¤é¤Ò¤È¤³¤È
¤¯¤ß¤³¤ß¤«¤é¤Ò¤È¤³¤È
kishima7
?
³¾°ù³Ü²ú²â¤Ç×÷¤ë¥Þ¥¤¥³¥ó¥Ü©`¥É
³¾°ù³Ü²ú²â¤Ç×÷¤ë¥Þ¥¤¥³¥ó¥Ü©`¥É³¾°ù³Ü²ú²â¤Ç×÷¤ë¥Þ¥¤¥³¥ó¥Ü©`¥É
³¾°ù³Ü²ú²â¤Ç×÷¤ë¥Þ¥¤¥³¥ó¥Ü©`¥É
kishima7
?
×Ô·Ö¤À¤±¤Î¥Ç¥Ð¥¤¥¹¤ò×÷¤ë¤ª»°
×Ô·Ö¤À¤±¤Î¥Ç¥Ð¥¤¥¹¤ò×÷¤ë¤ª»°×Ô·Ö¤À¤±¤Î¥Ç¥Ð¥¤¥¹¤ò×÷¤ë¤ª»°
×Ô·Ö¤À¤±¤Î¥Ç¥Ð¥¤¥¹¤ò×÷¤ë¤ª»°
kishima7
?
¥ª¥ê¥¸¥Ê¥ë³¾°ù³Ü²ú²â¥Ç¥Ð¥¤¥¹×÷¤ê
¥ª¥ê¥¸¥Ê¥ë³¾°ù³Ü²ú²â¥Ç¥Ð¥¤¥¹×÷¤ê¥ª¥ê¥¸¥Ê¥ë³¾°ù³Ü²ú²â¥Ç¥Ð¥¤¥¹×÷¤ê
¥ª¥ê¥¸¥Ê¥ë³¾°ù³Ü²ú²â¥Ç¥Ð¥¤¥¹×÷¤ê
kishima7
?
mruby VM ¤òÕ{¤Ù¤Æ¤ß¤¿Ô’
mruby VM ¤òÕ{¤Ù¤Æ¤ß¤¿Ô’mruby VM ¤òÕ{¤Ù¤Æ¤ß¤¿Ô’
mruby VM ¤òÕ{¤Ù¤Æ¤ß¤¿Ô’
kishima7
?
Stairway to my Family mruby
Stairway to my Family mrubyStairway to my Family mruby
Stairway to my Family mruby
kishima7
?
³Õ²Ñ¤ò¸Ä¤á¤Æѧ¤ó¤Ç¼û¤ë
³Õ²Ñ¤ò¸Ä¤á¤Æѧ¤ó¤Ç¼û¤ë³Õ²Ñ¤ò¸Ä¤á¤Æѧ¤ó¤Ç¼û¤ë
³Õ²Ñ¤ò¸Ä¤á¤Æѧ¤ó¤Ç¼û¤ë
kishima7
?
mruby/c¤Çʼ¤á¤ëM5Stack £¦mruby¥¹¥¯¥ê¥×¥Èé_°k
mruby/c¤Çʼ¤á¤ëM5Stack £¦mruby¥¹¥¯¥ê¥×¥Èé_°kmruby/c¤Çʼ¤á¤ëM5Stack £¦mruby¥¹¥¯¥ê¥×¥Èé_°k
mruby/c¤Çʼ¤á¤ëM5Stack £¦mruby¥¹¥¯¥ê¥×¥Èé_°k
kishima7
?
Wio LTE¤Èmruby/c¤ÇIoT
Wio LTE¤Èmruby/c¤ÇIoTWio LTE¤Èmruby/c¤ÇIoT
Wio LTE¤Èmruby/c¤ÇIoT
kishima7
?
±«²Ô¾±³Ù²â¤Ë³¾°ù³Ü²ú²â¤ò×é¤ßÞz¤ó¤Ç³éÑ¡¤ò¤·¤Æ¤ß¤¿
±«²Ô¾±³Ù²â¤Ë³¾°ù³Ü²ú²â¤ò×é¤ßÞz¤ó¤Ç³éÑ¡¤ò¤·¤Æ¤ß¤¿±«²Ô¾±³Ù²â¤Ë³¾°ù³Ü²ú²â¤ò×é¤ßÞz¤ó¤Ç³éÑ¡¤ò¤·¤Æ¤ß¤¿
±«²Ô¾±³Ù²â¤Ë³¾°ù³Ü²ú²â¤ò×é¤ßÞz¤ó¤Ç³éÑ¡¤ò¤·¤Æ¤ß¤¿
kishima7
?
Introduction of mruby & Webruby script example
Introduction of mruby & Webruby script exampleIntroduction of mruby & Webruby script example
Introduction of mruby & Webruby script example
kishima7
?
Dalvik Source Code Reading
Dalvik Source Code ReadingDalvik Source Code Reading
Dalvik Source Code Reading
kishima7
?
Ruby and Android
Ruby and AndroidRuby and Android
Ruby and Android
kishima7
?
Google TV hack
Google TV hackGoogle TV hack
Google TV hack
kishima7
?
¤¯¤ß¤³¤ß¤«¤é¤Ò¤È¤³¤È¸é±ð³Ù³Ü°ù²Ô²õ
¤¯¤ß¤³¤ß¤«¤é¤Ò¤È¤³¤È¸é±ð³Ù³Ü°ù²Ô²õ¤¯¤ß¤³¤ß¤«¤é¤Ò¤È¤³¤È¸é±ð³Ù³Ü°ù²Ô²õ
¤¯¤ß¤³¤ß¤«¤é¤Ò¤È¤³¤È¸é±ð³Ù³Ü°ù²Ô²õ
kishima7
?
¥Í¥Ã¥È¼Òµç¤¸¤ã¤Ê¤¯¤Æ£¿
¥Í¥Ã¥È¼Òµç¤¸¤ã¤Ê¤¯¤Æ£¿¥Í¥Ã¥È¼Òµç¤¸¤ã¤Ê¤¯¤Æ£¿
¥Í¥Ã¥È¼Òµç¤¸¤ã¤Ê¤¯¤Æ£¿
kishima7
?
¤¯¤ß¤³¤ß¤«¤é¤Ò¤È¤³¤È
¤¯¤ß¤³¤ß¤«¤é¤Ò¤È¤³¤È¤¯¤ß¤³¤ß¤«¤é¤Ò¤È¤³¤È
¤¯¤ß¤³¤ß¤«¤é¤Ò¤È¤³¤È
kishima7
?

Recently uploaded (20)

UHV UNIT-5 IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON P...
UHV UNIT-5  IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON P...UHV UNIT-5  IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON P...
UHV UNIT-5 IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON P...
arivazhaganrajangam
?
22PCOAM16 _ML_ Unit 2 Full unit notes.pdf
22PCOAM16 _ML_ Unit 2 Full unit notes.pdf22PCOAM16 _ML_ Unit 2 Full unit notes.pdf
22PCOAM16 _ML_ Unit 2 Full unit notes.pdf
Guru Nanak Technical Institutions
?
Intro PPT SY_HONORS.pptx- Teaching scheme
Intro PPT SY_HONORS.pptx- Teaching schemeIntro PPT SY_HONORS.pptx- Teaching scheme
Intro PPT SY_HONORS.pptx- Teaching scheme
Priyanka Dange
?
power system protection and why to protect the system
power system protection and why to protect the systempower system protection and why to protect the system
power system protection and why to protect the system
DivyangBhatt6
?
Reinventando el CD_ Unificando Aplicaciones e Infraestructura con Crossplane-...
Reinventando el CD_ Unificando Aplicaciones e Infraestructura con Crossplane-...Reinventando el CD_ Unificando Aplicaciones e Infraestructura con Crossplane-...
Reinventando el CD_ Unificando Aplicaciones e Infraestructura con Crossplane-...
Alberto Lorenzo
?
22PCOAM16_ML_Unit 1 notes & Question Bank with answers.pdf
22PCOAM16_ML_Unit 1 notes & Question Bank with answers.pdf22PCOAM16_ML_Unit 1 notes & Question Bank with answers.pdf
22PCOAM16_ML_Unit 1 notes & Question Bank with answers.pdf
Guru Nanak Technical Institutions
?
UHV Unit - 4 HARMONY IN THE NATURE AND EXISTENCE.pptx
UHV Unit - 4 HARMONY IN THE NATURE AND EXISTENCE.pptxUHV Unit - 4 HARMONY IN THE NATURE AND EXISTENCE.pptx
UHV Unit - 4 HARMONY IN THE NATURE AND EXISTENCE.pptx
arivazhaganrajangam
?
Airport Components Part1 ppt.pptx-Site layout,RUNWAY,TAXIWAY,TAXILANE
Airport Components Part1 ppt.pptx-Site layout,RUNWAY,TAXIWAY,TAXILANEAirport Components Part1 ppt.pptx-Site layout,RUNWAY,TAXIWAY,TAXILANE
Airport Components Part1 ppt.pptx-Site layout,RUNWAY,TAXIWAY,TAXILANE
Priyanka Dange
?
Chemical_Safety | Chemical Safety Management | Gaurav Singh Rajput
Chemical_Safety | Chemical Safety Management | Gaurav Singh RajputChemical_Safety | Chemical Safety Management | Gaurav Singh Rajput
Chemical_Safety | Chemical Safety Management | Gaurav Singh Rajput
Gaurav Singh Rajput
?
Virtual Power plants-Cleantech-Revolution
Virtual Power plants-Cleantech-RevolutionVirtual Power plants-Cleantech-Revolution
Virtual Power plants-Cleantech-Revolution
Ashoka Saket
?
BUILD WITH AI for GDG on campus MVJCE.pptx
BUILD WITH AI for GDG on campus MVJCE.pptxBUILD WITH AI for GDG on campus MVJCE.pptx
BUILD WITH AI for GDG on campus MVJCE.pptx
greeshmadj0
?
4. "Exploring the Role of Lubrication in Machinery Efficiency: Mechanisms, Ty...
4. "Exploring the Role of Lubrication in Machinery Efficiency: Mechanisms, Ty...4. "Exploring the Role of Lubrication in Machinery Efficiency: Mechanisms, Ty...
4. "Exploring the Role of Lubrication in Machinery Efficiency: Mechanisms, Ty...
adityaprakashme26
?
MODULE 01 - CLOUD COMPUTING [BIS 613D] .pptx
MODULE 01 - CLOUD COMPUTING [BIS 613D] .pptxMODULE 01 - CLOUD COMPUTING [BIS 613D] .pptx
MODULE 01 - CLOUD COMPUTING [BIS 613D] .pptx
Alvas Institute of Engineering and technology, Moodabidri
?
"Introduction to VLSI Design: Concepts and Applications"
"Introduction to VLSI Design: Concepts and Applications""Introduction to VLSI Design: Concepts and Applications"
"Introduction to VLSI Design: Concepts and Applications"
GtxDriver
?
he Wright brothers, Orville and Wilbur, invented and flew the first successfu...
he Wright brothers, Orville and Wilbur, invented and flew the first successfu...he Wright brothers, Orville and Wilbur, invented and flew the first successfu...
he Wright brothers, Orville and Wilbur, invented and flew the first successfu...
HardeepZinta2
?
UHV UNIT-I INTRODUCTION TO VALUE EDUCATION.pptx
UHV UNIT-I INTRODUCTION TO VALUE EDUCATION.pptxUHV UNIT-I INTRODUCTION TO VALUE EDUCATION.pptx
UHV UNIT-I INTRODUCTION TO VALUE EDUCATION.pptx
arivazhaganrajangam
?
Karim Baina NISS 2025 invited speach about Ethical Considerations for Respons...
Karim Baina NISS 2025 invited speach about Ethical Considerations for Respons...Karim Baina NISS 2025 invited speach about Ethical Considerations for Respons...
Karim Baina NISS 2025 invited speach about Ethical Considerations for Respons...
Karim Ba?na
?
Explainability and Transparency in Artificial Intelligence: Ethical Imperativ...
Explainability and Transparency in Artificial Intelligence: Ethical Imperativ...Explainability and Transparency in Artificial Intelligence: Ethical Imperativ...
Explainability and Transparency in Artificial Intelligence: Ethical Imperativ...
AI Publications
?
iso 45001 en 111111111111111111111111111
iso 45001 en 111111111111111111111111111iso 45001 en 111111111111111111111111111
iso 45001 en 111111111111111111111111111
ssuser3c947d
?
Kamal 2, new features and practical examples
Kamal 2, new features and practical examplesKamal 2, new features and practical examples
Kamal 2, new features and practical examples
Igor Aleksandrov
?
UHV UNIT-5 IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON P...
UHV UNIT-5  IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON P...UHV UNIT-5  IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON P...
UHV UNIT-5 IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON P...
arivazhaganrajangam
?
Intro PPT SY_HONORS.pptx- Teaching scheme
Intro PPT SY_HONORS.pptx- Teaching schemeIntro PPT SY_HONORS.pptx- Teaching scheme
Intro PPT SY_HONORS.pptx- Teaching scheme
Priyanka Dange
?
power system protection and why to protect the system
power system protection and why to protect the systempower system protection and why to protect the system
power system protection and why to protect the system
DivyangBhatt6
?
Reinventando el CD_ Unificando Aplicaciones e Infraestructura con Crossplane-...
Reinventando el CD_ Unificando Aplicaciones e Infraestructura con Crossplane-...Reinventando el CD_ Unificando Aplicaciones e Infraestructura con Crossplane-...
Reinventando el CD_ Unificando Aplicaciones e Infraestructura con Crossplane-...
Alberto Lorenzo
?
UHV Unit - 4 HARMONY IN THE NATURE AND EXISTENCE.pptx
UHV Unit - 4 HARMONY IN THE NATURE AND EXISTENCE.pptxUHV Unit - 4 HARMONY IN THE NATURE AND EXISTENCE.pptx
UHV Unit - 4 HARMONY IN THE NATURE AND EXISTENCE.pptx
arivazhaganrajangam
?
Airport Components Part1 ppt.pptx-Site layout,RUNWAY,TAXIWAY,TAXILANE
Airport Components Part1 ppt.pptx-Site layout,RUNWAY,TAXIWAY,TAXILANEAirport Components Part1 ppt.pptx-Site layout,RUNWAY,TAXIWAY,TAXILANE
Airport Components Part1 ppt.pptx-Site layout,RUNWAY,TAXIWAY,TAXILANE
Priyanka Dange
?
Chemical_Safety | Chemical Safety Management | Gaurav Singh Rajput
Chemical_Safety | Chemical Safety Management | Gaurav Singh RajputChemical_Safety | Chemical Safety Management | Gaurav Singh Rajput
Chemical_Safety | Chemical Safety Management | Gaurav Singh Rajput
Gaurav Singh Rajput
?
Virtual Power plants-Cleantech-Revolution
Virtual Power plants-Cleantech-RevolutionVirtual Power plants-Cleantech-Revolution
Virtual Power plants-Cleantech-Revolution
Ashoka Saket
?
BUILD WITH AI for GDG on campus MVJCE.pptx
BUILD WITH AI for GDG on campus MVJCE.pptxBUILD WITH AI for GDG on campus MVJCE.pptx
BUILD WITH AI for GDG on campus MVJCE.pptx
greeshmadj0
?
4. "Exploring the Role of Lubrication in Machinery Efficiency: Mechanisms, Ty...
4. "Exploring the Role of Lubrication in Machinery Efficiency: Mechanisms, Ty...4. "Exploring the Role of Lubrication in Machinery Efficiency: Mechanisms, Ty...
4. "Exploring the Role of Lubrication in Machinery Efficiency: Mechanisms, Ty...
adityaprakashme26
?
"Introduction to VLSI Design: Concepts and Applications"
"Introduction to VLSI Design: Concepts and Applications""Introduction to VLSI Design: Concepts and Applications"
"Introduction to VLSI Design: Concepts and Applications"
GtxDriver
?
he Wright brothers, Orville and Wilbur, invented and flew the first successfu...
he Wright brothers, Orville and Wilbur, invented and flew the first successfu...he Wright brothers, Orville and Wilbur, invented and flew the first successfu...
he Wright brothers, Orville and Wilbur, invented and flew the first successfu...
HardeepZinta2
?
UHV UNIT-I INTRODUCTION TO VALUE EDUCATION.pptx
UHV UNIT-I INTRODUCTION TO VALUE EDUCATION.pptxUHV UNIT-I INTRODUCTION TO VALUE EDUCATION.pptx
UHV UNIT-I INTRODUCTION TO VALUE EDUCATION.pptx
arivazhaganrajangam
?
Karim Baina NISS 2025 invited speach about Ethical Considerations for Respons...
Karim Baina NISS 2025 invited speach about Ethical Considerations for Respons...Karim Baina NISS 2025 invited speach about Ethical Considerations for Respons...
Karim Baina NISS 2025 invited speach about Ethical Considerations for Respons...
Karim Ba?na
?
Explainability and Transparency in Artificial Intelligence: Ethical Imperativ...
Explainability and Transparency in Artificial Intelligence: Ethical Imperativ...Explainability and Transparency in Artificial Intelligence: Ethical Imperativ...
Explainability and Transparency in Artificial Intelligence: Ethical Imperativ...
AI Publications
?
iso 45001 en 111111111111111111111111111
iso 45001 en 111111111111111111111111111iso 45001 en 111111111111111111111111111
iso 45001 en 111111111111111111111111111
ssuser3c947d
?
Kamal 2, new features and practical examples
Kamal 2, new features and practical examplesKamal 2, new features and practical examples
Kamal 2, new features and practical examples
Igor Aleksandrov
?

Now is the time to create your own (m)Ruby computer

  • 5. FAMILY BASIC My longing programing hardware using BASIC on Family Computer(NES)
  • 7. You can make your own computer with mruby!
  • 8. WHO AM I? Katsuhiko Kageyama ¡°kishima¡± @ twitter/github ? Embedded software engineer in a manufacturing company ? Making mruby devices ? Personally, producing technical books about mruby and original devices in TechBookFest, Comic Market and Maker Faire(2020 Tsukuba).
  • 10. Agenda ?How to create your computer ?Why mruby? ?Important technical things about mruby
  • 11. GOAL OF MY DEVELOPMENT ?Creating my small computer to run Ruby scripts like ¡°Family BASIC¡± ?I call it ¡°Family mruby¡±
  • 12. How to create your computer DEFINE REQUIREMENTS FIND COMPONENTS MAKE A SCHEMATICS MANUFACTURING THE DEVICE IMPLEMENT SOFTWARE
  • 13. Define requirements Find components Make a schematics Manufacturing the device Implement software Each steps are no so difficult for software engineers According to your idea Find components which satisfy your requirements. DigiKey is a good worldwide supplier Digital signal schematics could be simple We can use KiCAD Chinese company offers 5$ / 5 boards You need to implement basic software
  • 14. Write application using Ruby! ?I love Ruby ?No one likes to wait for compiling C and flashing img ?Shorter code is nice for the small device
  • 15. Why mruby? ?mruby can run on some small processors with limited memory (>400KB RAM preferred) ?Simple implementation of mruby VM helps to port it to your own hardware
  • 16. FINDING THE CORE PROCESSOR Board MCU ROM size RAM size Arduino ATmega328p 32KB 2KB ProMicro ATmega32U4 32KB 2.5KB ESP32 dev board ESP32-WROOM-32 4MB 520KB ESP32 dev board ESP32-WROVER-B 4MB 8MB Raspberry Pi zero ARM1176JZF-S >1GB (external) 512MB (external) £ªmruby requires >400kB memory
  • 18. Implement basic software ?Small processor doesn¡¯t support rich OS like Linux. ?C, C++ are common language ?Difficult to avoid C/C++ because low layer are provided by C/C++ usually
  • 19. My idea : System diagram Dev host ESP-IDF my device ESP32Arduino core FabGL mrbgem fro esp32 mruby compiler/VM mruby user App System App (C++) family_mruby Micro SD xtensa tool chain Serial communication PS/2 key board ESP32-WROVER-B Updating software Active speaker VGA monitor
  • 20. My hardware ?Small manufacturing was done by Chinese company ?Case was made by my 3D-printer
  • 21. DIFFICULTY OF IMPLEMENTATION ?Limited memory ?Always need to take care of remaining memory ? Avoid creating so many Ruby objects ?Low performance ?Use HW function(Interruption, DMA etc.) as much as possible
  • 22. INTERRUPTION ? Hardware interruption is good for receiving HW event CPU Button Electrical signal Function A (running) Function B (Interruption handler) Interruption signal will change the program counter to an interruption hander
  • 23. MRUBY CANNOT HANDLE HW INTERRUPTION ? Cannot not touch mruby VM¡¯s resource from the interruption handler ? The handler has higher priority ? Common solution is a polling method loop do if Input::available if Input::keydown?(Key::K_UP) my=-2 end if Input::keydown?(Key::K_DOWN) my=2 end end sp.move(mx*1,my*1) end Checking inputs in a loop ? This is not the best in the limited CPU performance condition
  • 24. SOFTWARE-LAYER INTERRUPTION ? Compromised solution for handling interruption ? Similar idea is applied in eLua and MicroPython https://github.com/kishima/mruby-interrupt CPU Button Electrical signal Function A (running) Function B (Interruption handler) mruby VM mruby VM do polling events Storing int. event in the handler Example:
  • 25. Implementation (experimental) * vm.c * #ifndef MRB_SW_INTERRUPT #define CASE(insn,ops) L_ ## insn: pc0=p c++; FETCH_ ## ops (); L_ ## insn ## _BO DY: #else #define CASE(insn,ops) L_ ## insn: pc0=p c++; exec_interrupt(mrb); FETCH_ ## ops (); L_ ## insn ## _BODY: #endif * vm.c * #ifdef MRB_SW_INTERRUPT static void exec_interrupt(mrb_state *mrb){ if(!mrb->interrupt_func) return; while( !(mrb->interrupt_flag & 0x8000) && mrb- >interrupt_flag & 0x7FFF){ for(int i=0;i<16;i++){ int bit = (mrb- >interrupt_flag >> i) & 0x0001; if(bit){ mrb->user_mutex_func(mrb,1); uint16_t backup = mrb->interrupt_flag; mrb- >interrupt_flag |= 0x8000; //Interrupt flag mrb->interrupt_func(mrb,i); mrb->interrupt_flag = backup; mrb->interrupt_flag &= ~(1 << i); mrb->user_mutex_func(mrb,0); } } } } #endif exec_interrupt() will be executed when VM fetchs each mruby byte code.
  • 27. SUMMARY ?We can create our own device ?I have created Family mruby ?Software interruption is a good tool for making devices ?Enjoy your maker life https://kishima.github.io/family_mruby/