0
Functional MCU programming
Metasepi Project / Kiwamu Okabe
Who am I ?
☆ http://www.masterq.net/
☆ Twitter: @master_q
☆ Organizer of Metasepi Project
☆ A developer of Ajhc Haskell co...
Kick off workshop at Nagoya !
Functional MCU programing workshop
☆ At Nagoya
☆ Meeting minutes
http://metasepi.org/posts/2...
Why functional lang for MCU?
☆ Internet of Things (IoT)
☆ We will live in IoT world
☆ Can't debug IoT device on the field
...
What is functional app?
Choice of cross compiler
Cross compiler: (A)jhc
http://ajhc.metasepi.org/
☆ Language: Haskell
☆ Haskell language is major !
☆ Need GC heap = Need m...
Cross compiler: ATS
http://www.ats-lang.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
☆ Exper...
Choice of MCU board
Which MCU? Of course mbed!?
Why?
☆ Major
☆ 32bit
☆ Large memory size (> 20kB)
☆ Debugger
☆ Ethernet
Which board is good for us...
☆ mbed LPC1768 (¥5,200)
RAM 32kB+32kB
Ethernet
https://mbed.org/platforms/mbed-LPC1768/

☆ S...
Choice of debugger
gdbserver: pyOCD
https://github.com/mbedmicro/pyOCD
☆ Only for MCU using CMSIS-DAP
☆ But now support only mbed LPC1768
☆ I...
gdbserver: OpenOCD
http://openocd.sourceforge.net/
☆ Comming CMSIS-DAP support!
☆ Need HIDAPI library
http://www.signal11....
OpenOCD enabling CMSIS-DAP
$
$
$
$
$
$

git clone git://github.com/signal11/hidapi.git
cd hidapi
./bootstrap
./configure
m...
On mbed LPC1768
$ sudo ./src/openocd -f tcl/board/mbed-lpc1768.cfg
$ arm-none-eabi-gdb
(gdb) target remote
(gdb) monitor r...
On Seeeduino Arch Pro
Same as mbed LPC1768.
On FRDM-KL46Z
Use project at https://github.com/0xc0170/kinetis_klxx_gcc.
$ sudo ./src/openocd -f tcl/board/frdm-kl46z.cfg...
Be a hacker such as ねむいさん
http://nemuisan.blog.bai.ne.jp/
☆ OpenOCD hacker
☆ There is his patch at following URL
http://ne...
Functional programming fanzine
☆ http://www.paraiso-lang.org/ikmsm/
☆ About Haskell or OCaml or . . .
☆ About Ajhc in C84 ...
Upcoming SlideShare
Loading in...5
×

Functional MCU programming

3,785

Published on

Functional MCU programming

Published in: Technology, Education
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
3,785
On Slideshare
0
From Embeds
0
Number of Embeds
7
Actions
Shares
0
Downloads
8
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Transcript of "Functional MCU programming"

  1. 1. Functional MCU programming Metasepi Project / Kiwamu Okabe
  2. 2. 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
  3. 3. Kick off workshop at Nagoya ! Functional MCU programing workshop ☆ At Nagoya ☆ Meeting minutes http://metasepi.org/posts/2014-01-05-mbed_fp_0.html ☆ Now planning the next workshop...
  4. 4. Why functional lang for MCU? ☆ Internet of Things (IoT) ☆ We will live in IoT world ☆ Can't debug IoT device on the field ☆ Should avoid runtime error ☆ We need strong type !
  5. 5. What is functional app?
  6. 6. Choice of cross compiler
  7. 7. Cross compiler: (A)jhc http://ajhc.metasepi.org/ ☆ Language: Haskell ☆ Haskell language is major ! ☆ Need GC heap = Need more memory ☆ Experience running on MCU ARM Cortex-M https://github.com/ajhc/demo-cortex-m3
  8. 8. Cross compiler: ATS http://www.ats-lang.org/ ☆ Language: ML ☆ Optional GC = Need low memory ☆ No experience running on MCU ☆ Document translated into Japanese http://jats-ug.metasepi.org/
  9. 9. 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 ☆ Developing by Mozilla ☆ @pirapira knows the detail of it
  10. 10. Choice of MCU board
  11. 11. Which MCU? Of course mbed!? Why? ☆ Major ☆ 32bit ☆ Large memory size (> 20kB) ☆ Debugger ☆ Ethernet
  12. 12. Which board is good for us... ☆ mbed LPC1768 (¥5,200) RAM 32kB+32kB Ethernet https://mbed.org/platforms/mbed-LPC1768/ ☆ Seeeduino Arch Pro ($43.41) RAM 32kB+32kB Ethernet http://www.seeedstudio.com/depot/arch-pro-p-1677.html ☆ FRDM-KL46Z (¥1,634) RAM 32kB No Ethernet http://www.freescale.com/webapp/sps/site/prod_summary.jsp? code=FRDM-KL46Z
  13. 13. Choice of debugger
  14. 14. gdbserver: pyOCD https://github.com/mbedmicro/pyOCD ☆ Only for MCU using CMSIS-DAP ☆ But now support only mbed LPC1768 ☆ In future, support more board ?
  15. 15. gdbserver: OpenOCD http://openocd.sourceforge.net/ ☆ Comming CMSIS-DAP support! ☆ Need HIDAPI library http://www.signal11.us/oss/hidapi/
  16. 16. OpenOCD enabling CMSIS-DAP $ $ $ $ $ $ git clone git://github.com/signal11/hidapi.git cd hidapi ./bootstrap ./configure make sudo make install $ git clone https://github.com/master-q/openocd.git $ cd openocd $ git checkout masterq-mbedfest-201401 $ ./bootstrap $ ./configure --enable-cmsis-dap --ship-Olimex ARM-JTAG-EW Programmer yes (auto) CMSIS-DAP Compliant Debugger yes $ make Some time the following FRDM-KL46Z patch is useful. http://permalink.gmane.org/gmane.comp.debugging.openocd.devel/24258
  17. 17. On mbed LPC1768 $ sudo ./src/openocd -f tcl/board/mbed-lpc1768.cfg $ arm-none-eabi-gdb (gdb) target remote (gdb) monitor reset (gdb) load Blink.elf localhost:3333 halt Push hard rest button. (gdb) c But too slow... Transfer rate: 50 bytes/sec, 3818 bytes/write. :(
  18. 18. On Seeeduino Arch Pro Same as mbed LPC1768.
  19. 19. On FRDM-KL46Z Use project at https://github.com/0xc0170/kinetis_klxx_gcc. $ sudo ./src/openocd -f tcl/board/frdm-kl46z.cfg --snip-cortex_m reset_config sysresetreq Info : CMSIS-DAP: FW Version = 1.0 Info : SWCLK/TCK = 0 SWDIO/TMS = 1 TDI = 0 TDO = 0 nTRST = 0 nRESET = 1 Info : DAP_SWJ Sequence (reset: 50+ '1' followed by 0) Info : CMSIS-DAP: Interface ready Info : clock speed 100 kHz Info : IDCODE 0x0bc11477 Info : MKL46Z256VLL4.cpu: hardware has 2 breakpoints, 2 watchpoints Info : accepting 'gdb' connection from 3333 Warn : Cannot communicate... target not halted. Error: auto_probe failed Error: Connect failed. Consider setting up a gdb-attach event for the target to prepare. Error: attempted 'gdb' connection rejected X(
  20. 20. Be a hacker such as ねむいさん http://nemuisan.blog.bai.ne.jp/ ☆ OpenOCD hacker ☆ There is his patch at following URL http://nemuisan.blog.bai.ne.jp/?eid=192848#OPENOCD
  21. 21. Functional programming fanzine ☆ http://www.paraiso-lang.org/ikmsm/ ☆ About Haskell or OCaml or . . . ☆ About Ajhc in C84 book ☆ About Android app with Haskell in C85 book ☆ Call me if you read it! http://www.paraiso-lang.org/ikmsm/books/c85.html
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×