SlideShare a Scribd company logo
1 of 10
Download to read offline
Embedded Rust and moreEmbedded Rust and moreEmbedded Rust and moreEmbedded Rust and moreEmbedded Rust and more
Kiwamu OkabeKiwamu OkabeKiwamu OkabeKiwamu OkabeKiwamu Okabe
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 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
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 #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)
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);
}
}
}
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]
}
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())
}
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
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

More Related Content

What's hot

Chromium Sandbox on Linux (NDC Security 2019)
Chromium Sandbox on Linux (NDC Security 2019)Chromium Sandbox on Linux (NDC Security 2019)
Chromium Sandbox on Linux (NDC Security 2019)Patricia Aas
 
Python Brasil 2010 - Potter vs Voldemort - Lições ofidiglotas da prática Pyth...
Python Brasil 2010 - Potter vs Voldemort - Lições ofidiglotas da prática Pyth...Python Brasil 2010 - Potter vs Voldemort - Lições ofidiglotas da prática Pyth...
Python Brasil 2010 - Potter vs Voldemort - Lições ofidiglotas da prática Pyth...Rodrigo Senra
 
The Ring programming language version 1.7 book - Part 82 of 196
The Ring programming language version 1.7 book - Part 82 of 196The Ring programming language version 1.7 book - Part 82 of 196
The Ring programming language version 1.7 book - Part 82 of 196Mahmoud Samir Fayed
 
The Ring programming language version 1.8 book - Part 91 of 202
The Ring programming language version 1.8 book - Part 91 of 202The Ring programming language version 1.8 book - Part 91 of 202
The Ring programming language version 1.8 book - Part 91 of 202Mahmoud Samir Fayed
 
Chromium Sandbox on Linux (BlackHoodie 2018)
Chromium Sandbox on Linux (BlackHoodie 2018)Chromium Sandbox on Linux (BlackHoodie 2018)
Chromium Sandbox on Linux (BlackHoodie 2018)Patricia Aas
 
Global Interpreter Lock: Episode I - Break the Seal
Global Interpreter Lock: Episode I - Break the SealGlobal Interpreter Lock: Episode I - Break the Seal
Global Interpreter Lock: Episode I - Break the SealTzung-Bi Shih
 
The Ring programming language version 1.5.4 book - Part 83 of 185
The Ring programming language version 1.5.4 book - Part 83 of 185The Ring programming language version 1.5.4 book - Part 83 of 185
The Ring programming language version 1.5.4 book - Part 83 of 185Mahmoud Samir Fayed
 

What's hot (8)

Chromium Sandbox on Linux (NDC Security 2019)
Chromium Sandbox on Linux (NDC Security 2019)Chromium Sandbox on Linux (NDC Security 2019)
Chromium Sandbox on Linux (NDC Security 2019)
 
Python Brasil 2010 - Potter vs Voldemort - Lições ofidiglotas da prática Pyth...
Python Brasil 2010 - Potter vs Voldemort - Lições ofidiglotas da prática Pyth...Python Brasil 2010 - Potter vs Voldemort - Lições ofidiglotas da prática Pyth...
Python Brasil 2010 - Potter vs Voldemort - Lições ofidiglotas da prática Pyth...
 
The Ring programming language version 1.7 book - Part 82 of 196
The Ring programming language version 1.7 book - Part 82 of 196The Ring programming language version 1.7 book - Part 82 of 196
The Ring programming language version 1.7 book - Part 82 of 196
 
Linux
LinuxLinux
Linux
 
The Ring programming language version 1.8 book - Part 91 of 202
The Ring programming language version 1.8 book - Part 91 of 202The Ring programming language version 1.8 book - Part 91 of 202
The Ring programming language version 1.8 book - Part 91 of 202
 
Chromium Sandbox on Linux (BlackHoodie 2018)
Chromium Sandbox on Linux (BlackHoodie 2018)Chromium Sandbox on Linux (BlackHoodie 2018)
Chromium Sandbox on Linux (BlackHoodie 2018)
 
Global Interpreter Lock: Episode I - Break the Seal
Global Interpreter Lock: Episode I - Break the SealGlobal Interpreter Lock: Episode I - Break the Seal
Global Interpreter Lock: Episode I - Break the Seal
 
The Ring programming language version 1.5.4 book - Part 83 of 185
The Ring programming language version 1.5.4 book - Part 83 of 185The Ring programming language version 1.5.4 book - Part 83 of 185
The Ring programming language version 1.5.4 book - Part 83 of 185
 

Similar to Blink LED Using Rust on mbed LPC1768

Run Go applications on Pico using TinyGo
Run Go applications on Pico using TinyGo Run Go applications on Pico using TinyGo
Run Go applications on Pico using TinyGo Yu-Shuan Hsieh
 
Multiplatform JIT Code Generator for NetBSD by Alexander Nasonov
Multiplatform JIT Code Generator for NetBSD by Alexander NasonovMultiplatform JIT Code Generator for NetBSD by Alexander Nasonov
Multiplatform JIT Code Generator for NetBSD by Alexander Nasonoveurobsdcon
 
Functional IoT: Hardware and Platform
Functional IoT: Hardware and PlatformFunctional IoT: Hardware and Platform
Functional IoT: Hardware and PlatformKiwamu Okabe
 
Comparing On-The-Fly Accelerating Packages: Numba, TensorFlow, Dask, etc
Comparing On-The-Fly Accelerating Packages: Numba, TensorFlow, Dask, etcComparing On-The-Fly Accelerating Packages: Numba, TensorFlow, Dask, etc
Comparing On-The-Fly Accelerating Packages: Numba, TensorFlow, Dask, etcYukio Okuda
 
Kernel Recipes 2018 - New GPIO interface for linux user space - Bartosz Golas...
Kernel Recipes 2018 - New GPIO interface for linux user space - Bartosz Golas...Kernel Recipes 2018 - New GPIO interface for linux user space - Bartosz Golas...
Kernel Recipes 2018 - New GPIO interface for linux user space - Bartosz Golas...Anne Nicolas
 
Raspberry Pi - HW/SW Application Development
Raspberry Pi - HW/SW Application DevelopmentRaspberry Pi - HW/SW Application Development
Raspberry Pi - HW/SW Application DevelopmentCorley S.r.l.
 
Python-GTK
Python-GTKPython-GTK
Python-GTKYuren Ju
 
pcDuino Presentation at SparkFun
pcDuino Presentation at SparkFunpcDuino Presentation at SparkFun
pcDuino Presentation at SparkFunJingfeng Liu
 
Lies Told By The Kotlin Compiler
Lies Told By The Kotlin CompilerLies Told By The Kotlin Compiler
Lies Told By The Kotlin CompilerGarth Gilmour
 
Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core
Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT CoreHands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core
Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT CoreAndri Yadi
 
[Forward4 Webinar 2016] Building IoT Prototypes w/ Raspberry Pi
[Forward4 Webinar 2016] Building IoT Prototypes w/ Raspberry Pi [Forward4 Webinar 2016] Building IoT Prototypes w/ Raspberry Pi
[Forward4 Webinar 2016] Building IoT Prototypes w/ Raspberry Pi Tomomi Imura
 
Democratizing the Internet of Things
Democratizing the Internet of ThingsDemocratizing the Internet of Things
Democratizing the Internet of ThingsAdam Englander
 
Metasepi team meeting #7: Snatch application on tiny OS
Metasepi team meeting #7: Snatch application on tiny OSMetasepi team meeting #7: Snatch application on tiny OS
Metasepi team meeting #7: Snatch application on tiny OSKiwamu Okabe
 
Perl on embedded Linux with Buildroot‎
Perl on embedded Linux with Buildroot‎Perl on embedded Linux with Buildroot‎
Perl on embedded Linux with Buildroot‎François Perrad
 
Debugging Hung Python Processes With GDB
Debugging Hung Python Processes With GDBDebugging Hung Python Processes With GDB
Debugging Hung Python Processes With GDBbmbouter
 
Python GTK (Hacking Camp)
Python GTK (Hacking Camp)Python GTK (Hacking Camp)
Python GTK (Hacking Camp)Yuren Ju
 
Getting Started With Raspberry Pi - UCSD 2013
Getting Started With Raspberry Pi - UCSD 2013Getting Started With Raspberry Pi - UCSD 2013
Getting Started With Raspberry Pi - UCSD 2013Tom Paulus
 

Similar to Blink LED Using Rust on mbed LPC1768 (20)

Run Go applications on Pico using TinyGo
Run Go applications on Pico using TinyGo Run Go applications on Pico using TinyGo
Run Go applications on Pico using TinyGo
 
Multiplatform JIT Code Generator for NetBSD by Alexander Nasonov
Multiplatform JIT Code Generator for NetBSD by Alexander NasonovMultiplatform JIT Code Generator for NetBSD by Alexander Nasonov
Multiplatform JIT Code Generator for NetBSD by Alexander Nasonov
 
Functional IoT: Hardware and Platform
Functional IoT: Hardware and PlatformFunctional IoT: Hardware and Platform
Functional IoT: Hardware and Platform
 
Comparing On-The-Fly Accelerating Packages: Numba, TensorFlow, Dask, etc
Comparing On-The-Fly Accelerating Packages: Numba, TensorFlow, Dask, etcComparing On-The-Fly Accelerating Packages: Numba, TensorFlow, Dask, etc
Comparing On-The-Fly Accelerating Packages: Numba, TensorFlow, Dask, etc
 
Kernel Recipes 2018 - New GPIO interface for linux user space - Bartosz Golas...
Kernel Recipes 2018 - New GPIO interface for linux user space - Bartosz Golas...Kernel Recipes 2018 - New GPIO interface for linux user space - Bartosz Golas...
Kernel Recipes 2018 - New GPIO interface for linux user space - Bartosz Golas...
 
Raspberry Pi - HW/SW Application Development
Raspberry Pi - HW/SW Application DevelopmentRaspberry Pi - HW/SW Application Development
Raspberry Pi - HW/SW Application Development
 
Python-GTK
Python-GTKPython-GTK
Python-GTK
 
pcDuino Presentation at SparkFun
pcDuino Presentation at SparkFunpcDuino Presentation at SparkFun
pcDuino Presentation at SparkFun
 
Lies Told By The Kotlin Compiler
Lies Told By The Kotlin CompilerLies Told By The Kotlin Compiler
Lies Told By The Kotlin Compiler
 
Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core
Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT CoreHands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core
Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core
 
[Forward4 Webinar 2016] Building IoT Prototypes w/ Raspberry Pi
[Forward4 Webinar 2016] Building IoT Prototypes w/ Raspberry Pi [Forward4 Webinar 2016] Building IoT Prototypes w/ Raspberry Pi
[Forward4 Webinar 2016] Building IoT Prototypes w/ Raspberry Pi
 
Democratizing the Internet of Things
Democratizing the Internet of ThingsDemocratizing the Internet of Things
Democratizing the Internet of Things
 
Metasepi team meeting #7: Snatch application on tiny OS
Metasepi team meeting #7: Snatch application on tiny OSMetasepi team meeting #7: Snatch application on tiny OS
Metasepi team meeting #7: Snatch application on tiny OS
 
Perl on embedded Linux with Buildroot‎
Perl on embedded Linux with Buildroot‎Perl on embedded Linux with Buildroot‎
Perl on embedded Linux with Buildroot‎
 
Debugging Hung Python Processes With GDB
Debugging Hung Python Processes With GDBDebugging Hung Python Processes With GDB
Debugging Hung Python Processes With GDB
 
Python GTK (Hacking Camp)
Python GTK (Hacking Camp)Python GTK (Hacking Camp)
Python GTK (Hacking Camp)
 
Python para equipos de ciberseguridad
Python para equipos de ciberseguridad Python para equipos de ciberseguridad
Python para equipos de ciberseguridad
 
Getting Started With Raspberry Pi - UCSD 2013
Getting Started With Raspberry Pi - UCSD 2013Getting Started With Raspberry Pi - UCSD 2013
Getting Started With Raspberry Pi - UCSD 2013
 
Fpga
FpgaFpga
Fpga
 
Sysprog 11
Sysprog 11Sysprog 11
Sysprog 11
 

Recently uploaded

My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 

Recently uploaded (20)

My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 

Blink LED Using Rust on mbed LPC1768

  • 1. Embedded Rust and moreEmbedded Rust and moreEmbedded Rust and moreEmbedded Rust and moreEmbedded Rust and more Kiwamu OkabeKiwamu OkabeKiwamu OkabeKiwamu OkabeKiwamu Okabe
  • 2. Congrats, Rust 1.0!Congrats, Rust 1.0!Congrats, Rust 1.0!Congrats, Rust 1.0!Congrats, Rust 1.0!
  • 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. Demo ArchitectureDemo ArchitectureDemo ArchitectureDemo ArchitectureDemo Architecture
  • 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. 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. 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. 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. 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. 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