SlideShare una empresa de Scribd logo
1 de 30
Descargar para leer sin conexión
Functional MCU programming
#0: Development environment
Metasepi Project / Kiwamu Okabe
Who am I ?
☆ http://www.masterq.net/
☆ Twitter: @master_q
☆ Organizer of Metasepi Project
☆ A developer of Ajhc Haskell compiler
☆ A Debian Maintainer
☆ 10 years' experience in developing
OS using NetBSD.
Why functional lang for MCU?
☆ We will live in IoT world
☆ Can't debug IoT device on field
☆ Should avoid runtime error
☆ We need strong type !
Overview
MCU (Microcontroller)
Many architecture are on the earth.
MCU: ARM Cortex-M
☆ Major
☆ 32bit
☆ Large memory size (> 20kB)
Good MCU Board is ...
☆ mbed LPC1768 (5,200 YEN)
https://mbed.org/platforms/mbed-LPC1768/

☆ STM32F4DISCOVERY (1,650 YEN)
http://www.st.com/web/catalog/tools/FM116/SC959/SS1532/PF252419
MCU: TI MSP430
☆ Minor
☆ 16bit
☆ Small memory size (< 4kB)
Good MCU Board is ...
☆ MSP-EXP430G2 (1,202 YEN)
http://www.ti.com/tool/msp-exp430g2
MCU: Atmel AVR
☆ Major
☆ 8bit and Harvard architecture
☆ Small memory size (< 8kB)
Good MCU Board is ...
☆ Arduino Mega 2560 compat board
(2,690 YEN)
http://www.amazon.co.jp/dp/B00CF2REXC
Cross compiler
☆ Functional language implementation
☆ many many many ...
☆ Which language good for MCU ?
Cross compiler: (A)jhc
http://ajhc.metasepi.org/
☆ Language: Haskell
☆ Haskell is major !
☆ Need GC heap = Need more memory
☆ Experience running on MCU
ARM Cortex-M
https://github.com/ajhc/demo-cortex-m3
Cross compiler: ATS
http://www.ats-lang.org/
http://jats-ug.metasepi.org/
☆ Language: ML
☆ Optional GC = Need low memory
☆ No experience running on MCU
Cross compiler: Rust
http://www.rust-lang.org/
☆ Language: Own syntax like C or JS
☆ Optional GC = Need low memory
☆ Experience running on MCU
ARM Cortex-M
https://github.com/neykov/armboot

☆ @pirapira knows detail of it
gdbserver (Debugger)
☆ Gdb is major debugger
☆ But gdb is only for the program
running on your PC
☆ How debug program running on
MCU ?
☆ Gdbserver is good for the use case
☆ There are many implementation
gdbserver: OpenOCD
http://openocd.sourceforge.net/
☆ Support many MCU
ARM7, ARM9, ARM11, ARM Cortex-M,
XScale, MIPS m4k, Orion SoC
☆ Support many JTAG
☆ Need config file
gdbserver: pyOCD
https://github.com/mbedmicro/pyOCD
☆ Only for MCU using CMSIS-DAP
☆ But now support only mbed LPC1768
☆ In future, support more board ?
Seeeduino Arch Pro ($43.41)
http://www.seeedstudio.com/depot/arch-pro-p-1677.html

FRDM-KL46Z (1,634 YEN)
http://www.freescale.com/webapp/sps/site/prod_summary.jsp?
code=FRDM-KL46Z
gdbserver: STLINK
https://github.com/texane/stlink
☆ Only for STM32 MCU
☆ STM32 is based on ARM Cortex-M
☆ No config is good config
gdbserver: AVaRICE
http://avarice.sourceforge.net/
☆ Only for Atmel AVR
Serial console
☆ Some MCU boards support "USB
Virtual Serial Port"
☆ If not, need USB serial converter
Peripheral
☆ GPIO
☆ I2C / SMBus
☆ USB host / device
☆ Bluetooth (LE)
☆ Sensor
☆ LCD Display
......
Ethernet
Use lwIP TCP/IP stack.
http://savannah.nongnu.org/projects/lwip/

But it needs thread supported by OS.
OS: FreeRTOS
http://www.freertos.org/
☆ Major
☆ Bad document ?
OS: ChibiOS/RT
http://www.chibios.org/
☆ Support ARM7, ARM Cortex-M, AVR,
PPC, MSP430
☆ OS is written by C
☆ Small
☆ Good document
☆ Used by gniibe
OS: mbed RTOS
http://mbed.org/handbook/RTOS
☆ Only for mbed
☆ OS core is written by C
☆ C++ wrapper for API
Choose our environment set
Setup Ajhc
http://ajhc.metasepi.org/
$
$
$
$
$

sudo apt-get install haskell-platform
sudo apt-get install gcc m4 patch libncurses5-dev
cabal install drift
export PATH=$PATH:$HOME/.cabal/bin
cabal install ajhc

Able to use it on Windows/Mac OS X ?
Setup cross gcc and gdb
☆ Use summon-arm-toolchain
$ git clone https://github.com/master-q/summon-arm-toolchain.git
$ sudo apt-get install build-essential git flex bison libgmp3-dev
libmpfr-dev libncurses5-dev libmpc-dev autoconf texinfo libtool
libftdi-dev libusb-1.0-0-dev zlib1g zlib1g-dev python-yaml
$ cd summon-arm-toolchain/
$ ./summon-arm-toolchain
$ export PATH=$HOME/sat/bin:$PATH
なにやら不穏なmaster-qというリポジトリからcloneしているのは、
"unknown command `colophon'" とか言われるケースがあるため
詳細: http://trac.cross-lfs.org/ticket/926

☆ Use GCC ARM Embedded
https://launchpad.net/gcc-arm-embedded/
Setup pyOCD
☆ Upgrade mbed firmware
http://mbed.org/handbook/Firmware-LPC1768-LPC11U24

☆ Install pyOCD
http://mbed.org/blog/entry/Debugging-from-GDB-using-pyOCD/
$
$
$
$
$
$
$

sudo apt-get install python libusb-1.0-0-dev
git clone https://github.com/walac/pyusb.git
cd pyusb
sudo python setup.py install
git clone https://github.com/mbedmicro/pyOCD.git
cd pyOCD
sudo python setup.py install

__bootstrap_innerとかなんかgdb_test.pyがエラーを吐く場合
http://mbed.org/forum/mbed/topic/4544/
を参考にpatchをあてるらしい...
Compile example
https://github.com/ajhc/demo-cortex-m3/tree/master/mbed-nxp-lpc1768
$
$
$
$

git clone https://github.com/ajhc/demo-cortex-m3.git
cd demo-cortex-m3/mbed-nxp-lpc1768
cd samples/Haskell
make
Setup STLINK
https://github.com/texane/stlink
$
$
$
$
$
$
$

sudo apt-get install libsgutils2-dev libusb-1.0-0-dev
git clone https://github.com/texane/stlink.git
cd stlink/
./autogen.sh
./configure
make
sudo make install
Get mbed LPC1768 !
☆ マルツパーツ館
http://www.marutsu.co.jp/shohin_72981/

☆ スイッチサイエンス
http://www.switch-science.com/catalog/250/

☆ 秋月電子通商
http://akizukidenshi.com/catalog/g/gM-03596/

Más contenido relacionado

La actualidad más candente

Quest for a low powered home hub 120522
Quest for a low powered home hub 120522Quest for a low powered home hub 120522
Quest for a low powered home hub 120522
Paul Tanner
 
Java fx on raspberry pi gerrit grunwald
Java fx on raspberry pi   gerrit grunwaldJava fx on raspberry pi   gerrit grunwald
Java fx on raspberry pi gerrit grunwald
NLJUG
 
OpenBSD/sgi SMP implementation for Origin 350
OpenBSD/sgi SMP implementation for Origin 350OpenBSD/sgi SMP implementation for Origin 350
OpenBSD/sgi SMP implementation for Origin 350
Takuya ASADA
 
Bits of Advice for the VM Writer, by Cliff Click @ Curry On 2015
Bits of Advice for the VM Writer, by Cliff Click @ Curry On 2015Bits of Advice for the VM Writer, by Cliff Click @ Curry On 2015
Bits of Advice for the VM Writer, by Cliff Click @ Curry On 2015
curryon
 

La actualidad más candente (19)

How to Hack Edison
How to Hack EdisonHow to Hack Edison
How to Hack Edison
 
Bsdtw17: lightning talks/wip sessions
Bsdtw17: lightning talks/wip sessionsBsdtw17: lightning talks/wip sessions
Bsdtw17: lightning talks/wip sessions
 
Quest for a low powered home hub 120522
Quest for a low powered home hub 120522Quest for a low powered home hub 120522
Quest for a low powered home hub 120522
 
Java fx on raspberry pi gerrit grunwald
Java fx on raspberry pi   gerrit grunwaldJava fx on raspberry pi   gerrit grunwald
Java fx on raspberry pi gerrit grunwald
 
Micro Python で組み込み Python
Micro Python で組み込み PythonMicro Python で組み込み Python
Micro Python で組み込み Python
 
Espresso Lite v2 - ESP8266 Overview
Espresso Lite v2 - ESP8266 OverviewEspresso Lite v2 - ESP8266 Overview
Espresso Lite v2 - ESP8266 Overview
 
OpenBSD/sgi SMP implementation for Origin 350
OpenBSD/sgi SMP implementation for Origin 350OpenBSD/sgi SMP implementation for Origin 350
OpenBSD/sgi SMP implementation for Origin 350
 
How to control physical devices with mruby
How to control physical devices with mrubyHow to control physical devices with mruby
How to control physical devices with mruby
 
Js robotics
Js roboticsJs robotics
Js robotics
 
Android and Arduio mixed with Breakout js
Android and Arduio mixed with Breakout jsAndroid and Arduio mixed with Breakout js
Android and Arduio mixed with Breakout js
 
Embedded. What Why How
Embedded. What Why HowEmbedded. What Why How
Embedded. What Why How
 
Bits of Advice for the VM Writer, by Cliff Click @ Curry On 2015
Bits of Advice for the VM Writer, by Cliff Click @ Curry On 2015Bits of Advice for the VM Writer, by Cliff Click @ Curry On 2015
Bits of Advice for the VM Writer, by Cliff Click @ Curry On 2015
 
Tools
ToolsTools
Tools
 
IoT Chess 16th April Berlin
IoT Chess 16th April BerlinIoT Chess 16th April Berlin
IoT Chess 16th April Berlin
 
Arduino IDE
Arduino IDEArduino IDE
Arduino IDE
 
Violent python
Violent pythonViolent python
Violent python
 
UP Board AI Core Configuration memo
UP Board AI Core Configuration memoUP Board AI Core Configuration memo
UP Board AI Core Configuration memo
 
JRuby talk / 26.03.2014 / @vbalazs
JRuby talk / 26.03.2014 / @vbalazsJRuby talk / 26.03.2014 / @vbalazs
JRuby talk / 26.03.2014 / @vbalazs
 
Qemu Introduction
Qemu IntroductionQemu Introduction
Qemu Introduction
 

Destacado (6)

start_printf: dev/ic/com.c comstart()
start_printf: dev/ic/com.c comstart()start_printf: dev/ic/com.c comstart()
start_printf: dev/ic/com.c comstart()
 
Build OS X Apps on Travis CI
Build OS X Apps on Travis CIBuild OS X Apps on Travis CI
Build OS X Apps on Travis CI
 
Functional MCU programming
Functional MCU programmingFunctional MCU programming
Functional MCU programming
 
Play, Slick, play2-authの間で討死
Play, Slick, play2-authの間で討死Play, Slick, play2-authの間で討死
Play, Slick, play2-authの間で討死
 
Safer IoT using functional language
Safer IoT using functional languageSafer IoT using functional language
Safer IoT using functional language
 
Real-time OS system state captured by ATS language
Real-time OS system state captured by ATS languageReal-time OS system state captured by ATS language
Real-time OS system state captured by ATS language
 

Similar a Functional MCU programming #0: Development environment

Share the Experience of Using Embedded Development Board
Share the Experience of Using Embedded Development BoardShare the Experience of Using Embedded Development Board
Share the Experience of Using Embedded Development Board
Jian-Hong Pan
 
Fun with JavaFX8 on the Raspberry Pi
Fun with JavaFX8 on the Raspberry PiFun with JavaFX8 on the Raspberry Pi
Fun with JavaFX8 on the Raspberry Pi
NLJUG
 

Similar a Functional MCU programming #0: Development environment (20)

Share the Experience of Using Embedded Development Board
Share the Experience of Using Embedded Development BoardShare the Experience of Using Embedded Development Board
Share the Experience of Using Embedded Development Board
 
fpga1 - What is.pptx
fpga1 - What is.pptxfpga1 - What is.pptx
fpga1 - What is.pptx
 
Metasepi team meeting #19: ATS application on Arduino
Metasepi team meeting #19: ATS application on ArduinoMetasepi team meeting #19: ATS application on Arduino
Metasepi team meeting #19: ATS application on Arduino
 
Stm32 f4 first touch
Stm32 f4 first touchStm32 f4 first touch
Stm32 f4 first touch
 
Rapid IoT prototyping with mruby
Rapid IoT prototyping with mrubyRapid IoT prototyping with mruby
Rapid IoT prototyping with mruby
 
Porting Android
Porting AndroidPorting Android
Porting Android
 
Introduction to FreeRTOS
Introduction to FreeRTOSIntroduction to FreeRTOS
Introduction to FreeRTOS
 
Experiences with Oracle SPARC S7-2 Server
Experiences with Oracle SPARC S7-2 ServerExperiences with Oracle SPARC S7-2 Server
Experiences with Oracle SPARC S7-2 Server
 
Tizen RT: A Lightweight RTOS Platform for Low-End IoT Devices
Tizen RT: A Lightweight RTOS Platform for Low-End IoT DevicesTizen RT: A Lightweight RTOS Platform for Low-End IoT Devices
Tizen RT: A Lightweight RTOS Platform for Low-End IoT Devices
 
Spi drivers
Spi driversSpi drivers
Spi drivers
 
Deploy STM32 family on Zephyr - SFO17-102
Deploy STM32 family on Zephyr - SFO17-102Deploy STM32 family on Zephyr - SFO17-102
Deploy STM32 family on Zephyr - SFO17-102
 
Developing Applications for Beagle Bone Black, Raspberry Pi and SoC Single Bo...
Developing Applications for Beagle Bone Black, Raspberry Pi and SoC Single Bo...Developing Applications for Beagle Bone Black, Raspberry Pi and SoC Single Bo...
Developing Applications for Beagle Bone Black, Raspberry Pi and SoC Single Bo...
 
Esp32 cam arduino-123
Esp32 cam arduino-123Esp32 cam arduino-123
Esp32 cam arduino-123
 
OpenOCD-K3
OpenOCD-K3OpenOCD-K3
OpenOCD-K3
 
Porting Android
Porting AndroidPorting Android
Porting Android
 
Porting Android ABS 2011
Porting Android ABS 2011Porting Android ABS 2011
Porting Android ABS 2011
 
Kernel Recipes 2016 - Speeding up development by setting up a kernel build farm
Kernel Recipes 2016 - Speeding up development by setting up a kernel build farmKernel Recipes 2016 - Speeding up development by setting up a kernel build farm
Kernel Recipes 2016 - Speeding up development by setting up a kernel build farm
 
Functional IoT: Hardware and Platform
Functional IoT: Hardware and PlatformFunctional IoT: Hardware and Platform
Functional IoT: Hardware and Platform
 
Red hat open stack and storage presentation
Red hat open stack and storage presentationRed hat open stack and storage presentation
Red hat open stack and storage presentation
 
Fun with JavaFX8 on the Raspberry Pi
Fun with JavaFX8 on the Raspberry PiFun with JavaFX8 on the Raspberry Pi
Fun with JavaFX8 on the Raspberry Pi
 

Último

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 

Último (20)

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 

Functional MCU programming #0: Development environment