SlideShare una empresa de Scribd logo
1 de 28
Descargar para leer sin conexión
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.
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!

Más contenido relacionado

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

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 CreamMif Masterz
 
Embedded Linux Systems Basics
Embedded Linux Systems BasicsEmbedded Linux Systems Basics
Embedded Linux Systems BasicsMax 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 Makerspchristensen
 
Marmalade bittersweet experience
Marmalade bittersweet experienceMarmalade bittersweet experience
Marmalade bittersweet experienceAlexander 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 learningLee 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 robotsDesiree 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 ControlPradip Bhandari
 
Marmalade: bittersweet experience
Marmalade: bittersweet experienceMarmalade: bittersweet experience
Marmalade: bittersweet experienceMax Klyga
 
Zach Murray CEIS 106 Project
Zach Murray CEIS 106 ProjectZach Murray CEIS 106 Project
Zach Murray CEIS 106 ProjectZacharyMurray8
 
Cesec2015 - Arduino Designer
Cesec2015 - Arduino DesignerCesec2015 - Arduino Designer
Cesec2015 - Arduino Designermelbats
 
Add sale davinci
Add sale davinciAdd sale davinci
Add sale davinciAkash 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 FOSSKirk 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).pptxlematadese670
 
Raspbeery Pi : An Introduction
Raspbeery Pi : An IntroductionRaspbeery Pi : An Introduction
Raspbeery Pi : An IntroductionVatsal 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 Projectspchristensen
 

Similar a 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
 
Embedded Linux Systems Basics
Embedded Linux Systems BasicsEmbedded Linux Systems Basics
Embedded Linux Systems Basics
 
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
 
Marmalade bittersweet experience
Marmalade bittersweet experienceMarmalade bittersweet experience
Marmalade bittersweet experience
 
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)
 
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
 
raspberry pi (generalised)
 raspberry pi (generalised) raspberry pi (generalised)
raspberry pi (generalised)
 
Arduino Easy way to create robots
Arduino Easy way to create robotsArduino Easy way to create robots
Arduino Easy way to create robots
 
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
 
Marmalade: bittersweet experience
Marmalade: bittersweet experienceMarmalade: bittersweet experience
Marmalade: bittersweet experience
 
Zach Murray CEIS 106 Project
Zach Murray CEIS 106 ProjectZach Murray CEIS 106 Project
Zach Murray CEIS 106 Project
 
Cesec2015 - Arduino Designer
Cesec2015 - Arduino DesignerCesec2015 - Arduino Designer
Cesec2015 - Arduino Designer
 
Add sale davinci
Add sale davinciAdd sale davinci
Add sale davinci
 
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
 
Advanced Video Production with FOSS
Advanced Video Production with FOSSAdvanced Video Production with FOSS
Advanced Video Production with FOSS
 
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
 
Project Proposal for Minor Project
Project Proposal for Minor Project Project Proposal for Minor Project
Project Proposal for Minor Project
 
Embedded programming Embedded programming (1).pptx
Embedded programming Embedded programming (1).pptxEmbedded programming Embedded programming (1).pptx
Embedded programming Embedded programming (1).pptx
 
Raspbeery Pi : An Introduction
Raspbeery Pi : An IntroductionRaspbeery Pi : An Introduction
Raspbeery Pi : An Introduction
 
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
 

Más de kishima7

mrubyで作るマイコンボード
mrubyで作るマイコンボードmrubyで作るマイコンボード
mrubyで作るマイコンボードkishima7
 
自分だけのデバイスを作るお話
自分だけのデバイスを作るお話自分だけのデバイスを作るお話
自分だけのデバイスを作るお話kishima7
 
オリジナルmrubyデバイス作り
オリジナルmrubyデバイス作りオリジナルmrubyデバイス作り
オリジナルmrubyデバイス作り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 mrubykishima7
 
VMを改めて学んで見る
VMを改めて学んで見るVMを改めて学んで見る
VMを改めて学んで見るkishima7
 
mruby/cで始めるM5Stack &mrubyスクリプト開発
mruby/cで始めるM5Stack &mrubyスクリプト開発mruby/cで始めるM5Stack &mrubyスクリプト開発
mruby/cで始めるM5Stack &mrubyスクリプト開発kishima7
 
Wio LTEとmruby/cでIoT
Wio LTEとmruby/cでIoTWio LTEとmruby/cでIoT
Wio LTEとmruby/cでIoTkishima7
 
Unityにmrubyを組み込んで抽選をしてみた
Unityにmrubyを組み込んで抽選をしてみたUnityにmrubyを組み込んで抽選をしてみた
Unityにmrubyを組み込んで抽選をしてみたkishima7
 
Introduction of mruby & Webruby script example
Introduction of mruby & Webruby script exampleIntroduction of mruby & Webruby script example
Introduction of mruby & Webruby script examplekishima7
 
Dalvik Source Code Reading
Dalvik Source Code ReadingDalvik Source Code Reading
Dalvik Source Code Readingkishima7
 
Ruby and Android
Ruby and AndroidRuby and Android
Ruby and Androidkishima7
 
Google TV hack
Google TV hackGoogle TV hack
Google TV hackkishima7
 
くみこみからひとことReturns
くみこみからひとことReturnsくみこみからひとことReturns
くみこみからひとことReturnskishima7
 
ネット家電じゃなくて?
ネット家電じゃなくて?ネット家電じゃなくて?
ネット家電じゃなくて?kishima7
 
くみこみからひとこと
くみこみからひとことくみこみからひとこと
くみこみからひとことkishima7
 

Más de kishima7 (16)

mrubyで作るマイコンボード
mrubyで作るマイコンボードmrubyで作るマイコンボード
mrubyで作るマイコンボード
 
自分だけのデバイスを作るお話
自分だけのデバイスを作るお話自分だけのデバイスを作るお話
自分だけのデバイスを作るお話
 
オリジナルmrubyデバイス作り
オリジナルmrubyデバイス作りオリジナルmrubyデバイス作り
オリジナルmrubyデバイス作り
 
mruby VM を調べてみた話
mruby VM を調べてみた話mruby VM を調べてみた話
mruby VM を調べてみた話
 
Stairway to my Family mruby
Stairway to my Family mrubyStairway to my Family mruby
Stairway to my Family mruby
 
VMを改めて学んで見る
VMを改めて学んで見るVMを改めて学んで見る
VMを改めて学んで見る
 
mruby/cで始めるM5Stack &mrubyスクリプト開発
mruby/cで始めるM5Stack &mrubyスクリプト開発mruby/cで始めるM5Stack &mrubyスクリプト開発
mruby/cで始めるM5Stack &mrubyスクリプト開発
 
Wio LTEとmruby/cでIoT
Wio LTEとmruby/cでIoTWio LTEとmruby/cでIoT
Wio LTEとmruby/cでIoT
 
Unityにmrubyを組み込んで抽選をしてみた
Unityにmrubyを組み込んで抽選をしてみたUnityにmrubyを組み込んで抽選をしてみた
Unityにmrubyを組み込んで抽選をしてみた
 
Introduction of mruby & Webruby script example
Introduction of mruby & Webruby script exampleIntroduction of mruby & Webruby script example
Introduction of mruby & Webruby script example
 
Dalvik Source Code Reading
Dalvik Source Code ReadingDalvik Source Code Reading
Dalvik Source Code Reading
 
Ruby and Android
Ruby and AndroidRuby and Android
Ruby and Android
 
Google TV hack
Google TV hackGoogle TV hack
Google TV hack
 
くみこみからひとことReturns
くみこみからひとことReturnsくみこみからひとことReturns
くみこみからひとことReturns
 
ネット家電じゃなくて?
ネット家電じゃなくて?ネット家電じゃなくて?
ネット家電じゃなくて?
 
くみこみからひとこと
くみこみからひとことくみこみからひとこと
くみこみからひとこと
 

Último

Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . pptDineshKumar4165
 
Unit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdfUnit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdfRagavanV2
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfKamal Acharya
 
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoorTop Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoordharasingh5698
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...Call Girls in Nagpur High Profile
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...roncy bisnoi
 
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Bookingroncy bisnoi
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapRishantSharmaFr
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxJuliansyahHarahap1
 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01KreezheaRecto
 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Bookingroncy bisnoi
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Standamitlee9823
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringmulugeta48
 

Último (20)

Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
Unit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdfUnit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdf
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoorTop Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
 
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsFEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptx
 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01
 
NFPA 5000 2024 standard .
NFPA 5000 2024 standard                                  .NFPA 5000 2024 standard                                  .
NFPA 5000 2024 standard .
 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineering
 

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

  • 1.
  • 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.
  • 26.
  • 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/