Embedded Rust and moreEmbedded Rust and moreEmbedded Rust and moreEmbedded Rust and moreEmbedded Rust and more
Kiwamu Okab...
Congrats, Rust 1.0!Congrats, Rust 1.0!Congrats, Rust 1.0!Congrats, Rust 1.0!Congrats, Rust 1.0!
Demo: Blink LED using RustDemo: Blink LED using RustDemo: Blink LED using RustDemo: Blink LED using RustDemo: Blink LED us...
Demo ArchitectureDemo ArchitectureDemo ArchitectureDemo ArchitectureDemo Architecture
mbed-rust-frdm-k64-blinky.rs #1mbed-rust-frdm-k64-blinky.rs #1mbed-rust-frdm-k64-blinky.rs #1mbed-rust-frdm-k64-blinky.rs ...
mbed-rust-frdm-k64-blinky.rs #2mbed-rust-frdm-k64-blinky.rs #2mbed-rust-frdm-k64-blinky.rs #2mbed-rust-frdm-k64-blinky.rs ...
DigitalOut.rs #1DigitalOut.rs #1DigitalOut.rs #1DigitalOut.rs #1DigitalOut.rs #1
Use "gpio_*" functions on libmbed.a.Use "...
DigitalOut.rs #2DigitalOut.rs #2DigitalOut.rs #2DigitalOut.rs #2DigitalOut.rs #2
impl DigitalOut {
pub fn new(pin: u32) ->...
Why need embedded language?Why need embedded language?Why need embedded language?Why need embedded language?Why need embed...
Functional IoTFunctional IoTFunctional IoTFunctional IoTFunctional IoT
The Functional IoT is a wrestling mat
that strong t...
Upcoming SlideShare
Loading in …5
×

Embedded Rust and more

1,278 views

Published on

Embedded Rust and more

Published in: Technology

Embedded Rust and more

  1. 1. Embedded Rust and moreEmbedded Rust and moreEmbedded Rust and moreEmbedded Rust and moreEmbedded Rust and more Kiwamu OkabeKiwamu OkabeKiwamu OkabeKiwamu OkabeKiwamu Okabe
  2. 2. Congrats, Rust 1.0!Congrats, Rust 1.0!Congrats, Rust 1.0!Congrats, Rust 1.0!Congrats, Rust 1.0!
  3. 3. Demo: Blink LED using RustDemo: Blink LED using RustDemo: Blink LED using RustDemo: Blink LED using RustDemo: Blink LED using Rust https://github.com/master-q/mbed-rust-frdm-k64f-blinkyhttps://github.com/master-q/mbed-rust-frdm-k64f-blinkyhttps://github.com/master-q/mbed-rust-frdm-k64f-blinkyhttps://github.com/master-q/mbed-rust-frdm-k64f-blinkyhttps://github.com/master-q/mbed-rust-frdm-k64f-blinky ☆ Based on 0xc0170's product☆ Based on 0xc0170's product☆ Based on 0xc0170's product☆ Based on 0xc0170's product☆ Based on 0xc0170's product ☆ Support hardware: mbed LPC1768☆ Support hardware: mbed LPC1768☆ Support hardware: mbed LPC1768☆ Support hardware: mbed LPC1768☆ Support hardware: mbed LPC1768
  4. 4. Demo ArchitectureDemo ArchitectureDemo ArchitectureDemo ArchitectureDemo Architecture
  5. 5. mbed-rust-frdm-k64-blinky.rs #1mbed-rust-frdm-k64-blinky.rs #1mbed-rust-frdm-k64-blinky.rs #1mbed-rust-frdm-k64-blinky.rs #1mbed-rust-frdm-k64-blinky.rs #1 Magic words for no std library.Magic words for no std library.Magic words for no std library.Magic words for no std library.Magic words for no std library. #![crate_type = "rlib"] #![feature(no_std)] #![no_std] #![feature(lang_items, asm, core)] #![allow(dead_code)] #![allow(non_snake_case)] extern crate core; #![crate_type = "rlib"] #![feature(no_std)] #![no_std] #![feature(lang_items, asm, core)] #![allow(dead_code)] #![allow(non_snake_case)] extern crate core; #![crate_type = "rlib"] #![feature(no_std)] #![no_std] #![feature(lang_items, asm, core)] #![allow(dead_code)] #![allow(non_snake_case)] extern crate core; #![crate_type = "rlib"] #![feature(no_std)] #![no_std] #![feature(lang_items, asm, core)] #![allow(dead_code)] #![allow(non_snake_case)] extern crate core; #![crate_type = "rlib"] #![feature(no_std)] #![no_std] #![feature(lang_items, asm, core)] #![allow(dead_code)] #![allow(non_snake_case)] extern crate core; It's available for following version.It's available for following version.It's available for following version.It's available for following version.It's available for following version. $ rustc --version rustc 1.1.0-nightly (435622028 2015-05-04) (built 2015-05-05) $ rustc --version rustc 1.1.0-nightly (435622028 2015-05-04) (built 2015-05-05) $ rustc --version rustc 1.1.0-nightly (435622028 2015-05-04) (built 2015-05-05) $ rustc --version rustc 1.1.0-nightly (435622028 2015-05-04) (built 2015-05-05) $ rustc --version rustc 1.1.0-nightly (435622028 2015-05-04) (built 2015-05-05)
  6. 6. mbed-rust-frdm-k64-blinky.rs #2mbed-rust-frdm-k64-blinky.rs #2mbed-rust-frdm-k64-blinky.rs #2mbed-rust-frdm-k64-blinky.rs #2mbed-rust-frdm-k64-blinky.rs #2 Blink LED using libmbed.a.Blink LED using libmbed.a.Blink LED using libmbed.a.Blink LED using libmbed.a.Blink LED using libmbed.a. #[link(name = "mbed", kind = "static")] extern { pub fn wait(sec: f32); pub fn mbed_die(); } #[no_mangle] pub fn main() { let mut led = DigitalOut::DigitalOut::new(0x2009C000 | (32 + 18)); unsafe { loop { led.write(1); wait(1.0); led.write(0); wait(1.0); } } } #[link(name = "mbed", kind = "static")] extern { pub fn wait(sec: f32); pub fn mbed_die(); } #[no_mangle] pub fn main() { let mut led = DigitalOut::DigitalOut::new(0x2009C000 | (32 + 18)); unsafe { loop { led.write(1); wait(1.0); led.write(0); wait(1.0); } } } #[link(name = "mbed", kind = "static")] extern { pub fn wait(sec: f32); pub fn mbed_die(); } #[no_mangle] pub fn main() { let mut led = DigitalOut::DigitalOut::new(0x2009C000 | (32 + 18)); unsafe { loop { led.write(1); wait(1.0); led.write(0); wait(1.0); } } } #[link(name = "mbed", kind = "static")] extern { pub fn wait(sec: f32); pub fn mbed_die(); } #[no_mangle] pub fn main() { let mut led = DigitalOut::DigitalOut::new(0x2009C000 | (32 + 18)); unsafe { loop { led.write(1); wait(1.0); led.write(0); wait(1.0); } } } #[link(name = "mbed", kind = "static")] extern { pub fn wait(sec: f32); pub fn mbed_die(); } #[no_mangle] pub fn main() { let mut led = DigitalOut::DigitalOut::new(0x2009C000 | (32 + 18)); unsafe { loop { led.write(1); wait(1.0); led.write(0); wait(1.0); } } }
  7. 7. DigitalOut.rs #1DigitalOut.rs #1DigitalOut.rs #1DigitalOut.rs #1DigitalOut.rs #1 Use "gpio_*" functions on libmbed.a.Use "gpio_*" functions on libmbed.a.Use "gpio_*" functions on libmbed.a.Use "gpio_*" functions on libmbed.a.Use "gpio_*" functions on libmbed.a. #[link(name = "mbed", kind = "static")] extern { pub fn gpio_write_stub(obj: *mut u8, value: i32); pub fn gpio_init_out(obj: *mut u8, pin: u32); pub fn gpio_read_stub(obj: *mut u8) -> i32; pub fn gpio_mode(obj: *mut u8, mode: i32); pub fn gpio_set(pin: i32) -> u32; } pub struct DigitalOut { gpio : [u8; 24] } #[link(name = "mbed", kind = "static")] extern { pub fn gpio_write_stub(obj: *mut u8, value: i32); pub fn gpio_init_out(obj: *mut u8, pin: u32); pub fn gpio_read_stub(obj: *mut u8) -> i32; pub fn gpio_mode(obj: *mut u8, mode: i32); pub fn gpio_set(pin: i32) -> u32; } pub struct DigitalOut { gpio : [u8; 24] } #[link(name = "mbed", kind = "static")] extern { pub fn gpio_write_stub(obj: *mut u8, value: i32); pub fn gpio_init_out(obj: *mut u8, pin: u32); pub fn gpio_read_stub(obj: *mut u8) -> i32; pub fn gpio_mode(obj: *mut u8, mode: i32); pub fn gpio_set(pin: i32) -> u32; } pub struct DigitalOut { gpio : [u8; 24] } #[link(name = "mbed", kind = "static")] extern { pub fn gpio_write_stub(obj: *mut u8, value: i32); pub fn gpio_init_out(obj: *mut u8, pin: u32); pub fn gpio_read_stub(obj: *mut u8) -> i32; pub fn gpio_mode(obj: *mut u8, mode: i32); pub fn gpio_set(pin: i32) -> u32; } pub struct DigitalOut { gpio : [u8; 24] } #[link(name = "mbed", kind = "static")] extern { pub fn gpio_write_stub(obj: *mut u8, value: i32); pub fn gpio_init_out(obj: *mut u8, pin: u32); pub fn gpio_read_stub(obj: *mut u8) -> i32; pub fn gpio_mode(obj: *mut u8, mode: i32); pub fn gpio_set(pin: i32) -> u32; } pub struct DigitalOut { gpio : [u8; 24] }
  8. 8. DigitalOut.rs #2DigitalOut.rs #2DigitalOut.rs #2DigitalOut.rs #2DigitalOut.rs #2 impl DigitalOut { pub fn new(pin: u32) -> DigitalOut { unsafe { let mut gpio_out : DigitalOut = init(); gpio_init_out(gpio_out.gpio.as_mut_ptr(), pin); gpio_out } } fn as_mut_ptr(&mut self) -> *mut u8 { self.gpio.as_mut_ptr() } pub fn write(&mut self, value: i32) { unsafe { gpio_write_stub(self.gpio.as_mut_ptr(), value); } } pub fn read(&mut self, value: i32) -> i32 { unsafe { gpio_read_stub(self.gpio.as_mut_ptr()) } impl DigitalOut { pub fn new(pin: u32) -> DigitalOut { unsafe { let mut gpio_out : DigitalOut = init(); gpio_init_out(gpio_out.gpio.as_mut_ptr(), pin); gpio_out } } fn as_mut_ptr(&mut self) -> *mut u8 { self.gpio.as_mut_ptr() } pub fn write(&mut self, value: i32) { unsafe { gpio_write_stub(self.gpio.as_mut_ptr(), value); } } pub fn read(&mut self, value: i32) -> i32 { unsafe { gpio_read_stub(self.gpio.as_mut_ptr()) } impl DigitalOut { pub fn new(pin: u32) -> DigitalOut { unsafe { let mut gpio_out : DigitalOut = init(); gpio_init_out(gpio_out.gpio.as_mut_ptr(), pin); gpio_out } } fn as_mut_ptr(&mut self) -> *mut u8 { self.gpio.as_mut_ptr() } pub fn write(&mut self, value: i32) { unsafe { gpio_write_stub(self.gpio.as_mut_ptr(), value); } } pub fn read(&mut self, value: i32) -> i32 { unsafe { gpio_read_stub(self.gpio.as_mut_ptr()) } impl DigitalOut { pub fn new(pin: u32) -> DigitalOut { unsafe { let mut gpio_out : DigitalOut = init(); gpio_init_out(gpio_out.gpio.as_mut_ptr(), pin); gpio_out } } fn as_mut_ptr(&mut self) -> *mut u8 { self.gpio.as_mut_ptr() } pub fn write(&mut self, value: i32) { unsafe { gpio_write_stub(self.gpio.as_mut_ptr(), value); } } pub fn read(&mut self, value: i32) -> i32 { unsafe { gpio_read_stub(self.gpio.as_mut_ptr()) } impl DigitalOut { pub fn new(pin: u32) -> DigitalOut { unsafe { let mut gpio_out : DigitalOut = init(); gpio_init_out(gpio_out.gpio.as_mut_ptr(), pin); gpio_out } } fn as_mut_ptr(&mut self) -> *mut u8 { self.gpio.as_mut_ptr() } pub fn write(&mut self, value: i32) { unsafe { gpio_write_stub(self.gpio.as_mut_ptr(), value); } } pub fn read(&mut self, value: i32) -> i32 { unsafe { gpio_read_stub(self.gpio.as_mut_ptr()) }
  9. 9. Why need embedded language?Why need embedded language?Why need embedded language?Why need embedded language?Why need embedded language? To design IoT device. IoT device is:To design IoT device. IoT device is:To design IoT device. IoT device is:To design IoT device. IoT device is:To design IoT device. IoT device is: ☆ connected to the internet☆ connected to the internet☆ connected to the internet☆ connected to the internet☆ connected to the internet ☆ developed in a short time☆ developed in a short time☆ developed in a short time☆ developed in a short time☆ developed in a short time ☆ storing personal data☆ storing personal data☆ storing personal data☆ storing personal data☆ storing personal data ☆ secure☆ secure☆ secure☆ secure☆ secure ☆ more intelligence☆ more intelligence☆ more intelligence☆ more intelligence☆ more intelligence ☆ inexpensive☆ inexpensive☆ inexpensive☆ inexpensive☆ inexpensive
  10. 10. Functional IoTFunctional IoTFunctional IoTFunctional IoTFunctional IoT The Functional IoT is a wrestling mat that strong typed languages fight on, to become the champion of system programming language. The Functional IoT is a wrestling mat that strong typed languages fight on, to become the champion of system programming language. The Functional IoT is a wrestling mat that strong typed languages fight on, to become the champion of system programming language. The Functional IoT is a wrestling mat that strong typed languages fight on, to become the champion of system programming language. The Functional IoT is a wrestling mat that strong typed languages fight on, to become the champion of system programming language. What language will challenge?What language will challenge?What language will challenge?What language will challenge?What language will challenge? ☆ ATS☆ ATS☆ ATS☆ ATS☆ ATS ☆ Haskell (jhc)☆ Haskell (jhc)☆ Haskell (jhc)☆ Haskell (jhc)☆ Haskell (jhc) ☆ Rust☆ Rust☆ Rust☆ Rust☆ Rust

×