SlideShare ist ein Scribd-Unternehmen logo
1 von 35
Downloaden Sie, um offline zu lesen
Rust Embedded Development
on ESP32
and basics
of Async with Embassy
2023-02-08
Rust CZ/SK Meetup - Brno
Juraj Michálek, Juraj Sadel - Espressif Systems
ESP-RS organisation https://github.com/esp-rs
Rust ESP32 Community meeting
Regular meeting every two weeks
https://github.com/esp-rs/rust/discussions/
Community based effort to make Rust better
The Rust on ESP Book - https://esp-rs.github.io/book/
Awesome ESP Rust - https://github.com/esp-rs/awesome-esp-rust
- submit your project :-)
Designing Open Hardware - esp-rust-board
KiCad templates
https://github.com/esp-rs/esp-rust-board
ESP32-C3-DevKit-RUST-1 (available at Mouser, AliExpress)
https://www.espressif.com/en/products/devkits
wokwi.com/rust
Contribute: https://github.com/wokwi
EDC22 Day 1 Talk 9: Your browser is
ESP32 - Wokwi -
https://youtu.be/TKe4MgD6O8o
GitPod.io + Wokwi.com
https://github.com/playfulFence/esp-clock#dev-containers
Exploring what’s possible with Rust
Bare Metal: https://github.com/esp-rs/esp-hal
- ESP32 - esp32-hal/examples - Xtensa
- ESP32-C2 - esp32c2-hal/examples - RISC-V
- ESP32-C3 - esp32c3-hal/examples - RISC-V
- ESP32-S2 - esp32s2-hal/examples - Xtensa
- ESP32-S3 - esp32s3-hal/examples - RISC-V
STD: https://github.com/esp-rs/esp-idf-hal/tree/master/examples
Create new project Rust project
Bare metal:
cargo generate https://github.com/esp-rs/esp-template
STD with ESP-IDF:
cargo generate --vcs none --git https://github.com/esp-rs/esp-idf-template cargo
Multi-target project (PoC) - ESP32 Spooky Maze
https://github.com/georgik/esp32-spooky-maze-game
Idea: sharing business logic in Rust between
multiple targets
Targets: ESP32, ESP32-S2, ESP32-S3, ESP32-C3, M5Stack, Wasm and Desktop
Article: https://georgik.rocks/rust-bare-metal-application-for-esp32-desktop-android-and-ios/
https://github.com/espressif/esp-box
Wokwi - VS Code Plugin
Add wokwi.toml and diagram.json
to your project
cd m5stack-fire
cargo build --release --no-default-features --features "wokwi"
CTRL+Shift+P - Wokwi: Start Simulator
Async with Embassy
Embassy: https://github.com/embassy-rs/embassy
Examples of Embassy on ESP32:
- https://github.com/esp-rs/esp-hal/blob/main/esp32-hal/examples/embassy_hello_world.rs
- https://github.com/esp-rs/esp-hal/blob/main/esp32-hal/examples/embassy_spi.rs
- https://github.com/esp-rs/esp-hal/blob/main/esp32-hal/examples/embassy_wait.rs
Development options
- Local
- bootstrap whole env with “espup install” - https://github.com/esp-rs/espup#installation (written in Rust)
- Windows Online idf-installer - https://github.com/espressif/idf-installer/releases/tag/online-2.20 (includes VC
Tools)
- bootstrap with sh/pwsh (older method) - https://github.com/esp-rs/rust-build#download-installer
- Local in container
- Podman, Docker, Lima
- with VS Code Remote Container extension
- Cloud in GitPod.io or CodeSpaces
- EDC22 Day 2 Talk 11 Just Few dot files in Repo or Paradigm Shift to Cloud-based Embedded Development -
https://youtu.be/WAwfRyOy7N8
- Wokwi.com
Busy Looping (not using async)
- Very inefficient, blocking
Interrupts (not using async)
- Driven by hardware
- Pretty complex
Using async
- Don’t have to setting and waiting for interrupt resuming the program
- Async executor can do that for us instead
- Power efficient
async/.await
- Non-blocking operations
- Transforms each async function into future object
- When future blocks I/O it yields -> executor selects different future to execute
- No guessing which future is ready
Embassy (EMBedded ASYnc)
- We need an EXECUTOR to be able to use async
- Controlling which task should run
- Embassy consists of multiple crates (Executor, HALs, Networking,...)
- no_std
- Can be (relatively) easily extendable/configurable with other public crates
- https://embassy.dev
Executor
- Queue of tasks, when created it’s polled (1)
- Executing until gets blocked (awaiting async function) (2)
- Executes other task (3)
Interrupts
- Task is polled and executing (1)
- Task uses a peripheral to perform an operation(2)
- Interrupt occurred while awaiting (3)
- HAL ensures that interrupt signal updates
the peripheral state (4)
- Executor poll the task (5)
Rust language support
Talk: Embedded Rust on ESP32 - Juraj Michálek - Rust Linz November 2022
https://youtu.be/0PPPdqoDBQs
Training Embedded for ESP32-C3 by Ferrous Systems
Training: https://ferrous-systems.com/training/#package-espressif-beginner-training
Material: https://espressif-trainings.ferrous-systems.com/
GitHub: https://github.com/ferrous-systems/espressif-trainings/
Some Inspiration
(not necessary in Rust)
ESP Launchpad - https://espressif.github.io/esp-launchpad/
Many chips, many boards - quick help
https://products.espressif.com/
IDE
Supported by Espressif:
- VS Code with Espressif Extension -
https://docs.espressif.com/projects/esp-idf/en/stable/esp32/get-started/vscode-setup.html
- Espressif IDE - https://dl.espressif.com/dl/esp-idf/
Supported by 3rd party and community:
- Visual Studio with VisualGDB - https://visualgdb.com/
- CLion - https://www.jetbrains.com/clion/
Espressif Developer Conference 2022 - recording
https://www.youtube.com/playlist?list=PLOzvoM7_Knrc6o-n25jYuXRB2T8UKk1NU
OSes and integration
ESP-IDF (OS based on FreeRTOS) - https://github.com/esp-rs/esp-idf-hal (full feature)
no_std a.k.a. bare metal with Rust - https://github.com/esp-rs/esp-hal (minimalistic)
Zephyr - https://zephyrproject.org/
- EDC22 Day 1 Talk 10: Applications of Asymmetric Multiprocessing with ESP32 Devices -
including Rust on one core - https://youtu.be/oble9ObAqxM
NuttX - https://nuttx.apache.org/ (as app, Linux-like OS)
SVD files: https://github.com/espressif/svd
Further languages and frameworks
Arduino - Maker choice
- warning: limitation on production due to licenses!
VM based:
- CircuitPython and MicroPython - Python-like language
- Toit - Toit language
- Nanoframework - C# language
- Mongoose OS
- downside: bigger VM
- upside: more robust, comes with OTA and monitoring
CTAG-TBD
CTAG TBD >>to be determined<< an extendible
open source Eurorack sound module
https://github.com/ctag-fh-kiel/ctag-tbd
Wearables
The Ultimate Guide to Informed Wearable Technology
- book: https://packt.link/01VBv
Time-O-Mat - built at summer camp
https://github.com/vedatori/Time-O-Mat
Grafana
https://grafana.com/blog/2020/06/17/how-to-monitor-a-sourdough-starter-with-grafana/
https://github.com/grafana/diy-iot - Arduino now. We’re not Rust yet :)
Embedded World 2023
Meet us in Nuremberg, Germany
Visit us in Brno
Espressif Systems (Czech) s.r.o.
Přízova 3, 602 00 Brno
Czechia, Europe
See you in Linz in 2023. We’re planning ESP32 Rust Workshop ;-)

Weitere ähnliche Inhalte

Was ist angesagt?

LAS16-111: Easing Access to ARM TrustZone – OP-TEE and Raspberry Pi 3
LAS16-111: Easing Access to ARM TrustZone – OP-TEE and Raspberry Pi 3LAS16-111: Easing Access to ARM TrustZone – OP-TEE and Raspberry Pi 3
LAS16-111: Easing Access to ARM TrustZone – OP-TEE and Raspberry Pi 3
Linaro
 
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...
Opersys inc.
 
Embedded Operating System - Linux
Embedded Operating System - LinuxEmbedded Operating System - Linux
Embedded Operating System - Linux
Emertxe Information Technologies Pvt Ltd
 

Was ist angesagt? (20)

Jagan Teki - U-boot from scratch
Jagan Teki - U-boot from scratchJagan Teki - U-boot from scratch
Jagan Teki - U-boot from scratch
 
U-boot and Android Verified Boot 2.0
U-boot and Android Verified Boot 2.0U-boot and Android Verified Boot 2.0
U-boot and Android Verified Boot 2.0
 
Diving into SWUpdate: adding new platform support in 30minutes with Yocto/OE !
Diving into SWUpdate: adding new platform support in 30minutes with Yocto/OE !Diving into SWUpdate: adding new platform support in 30minutes with Yocto/OE !
Diving into SWUpdate: adding new platform support in 30minutes with Yocto/OE !
 
Temperatura Zabbix Procedimento Temper Usb
Temperatura Zabbix Procedimento Temper UsbTemperatura Zabbix Procedimento Temper Usb
Temperatura Zabbix Procedimento Temper Usb
 
Introduction to open_sbi
Introduction to open_sbiIntroduction to open_sbi
Introduction to open_sbi
 
Embedded Android : System Development - Part II (HAL)
Embedded Android : System Development - Part II (HAL)Embedded Android : System Development - Part II (HAL)
Embedded Android : System Development - Part II (HAL)
 
Embedded Android : System Development - Part III
Embedded Android : System Development - Part IIIEmbedded Android : System Development - Part III
Embedded Android : System Development - Part III
 
Embedded Android : System Development - Part I
Embedded Android : System Development - Part IEmbedded Android : System Development - Part I
Embedded Android : System Development - Part I
 
Implementing generic JNI hardware control for Kotlin based app on AOSP
Implementing generic JNI hardware control for Kotlin based app on AOSPImplementing generic JNI hardware control for Kotlin based app on AOSP
Implementing generic JNI hardware control for Kotlin based app on AOSP
 
Software update for embedded systems - elce2014
Software update for embedded systems - elce2014Software update for embedded systems - elce2014
Software update for embedded systems - elce2014
 
LAS16-111: Easing Access to ARM TrustZone – OP-TEE and Raspberry Pi 3
LAS16-111: Easing Access to ARM TrustZone – OP-TEE and Raspberry Pi 3LAS16-111: Easing Access to ARM TrustZone – OP-TEE and Raspberry Pi 3
LAS16-111: Easing Access to ARM TrustZone – OP-TEE and Raspberry Pi 3
 
Git for Excel
Git for ExcelGit for Excel
Git for Excel
 
Yocto - Embedded Linux Distribution Maker
Yocto - Embedded Linux Distribution MakerYocto - Embedded Linux Distribution Maker
Yocto - Embedded Linux Distribution Maker
 
Linux Internals - Part II
Linux Internals - Part IILinux Internals - Part II
Linux Internals - Part II
 
Embedded Android : System Development - Part IV
Embedded Android : System Development - Part IVEmbedded Android : System Development - Part IV
Embedded Android : System Development - Part IV
 
Android internals
Android internalsAndroid internals
Android internals
 
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...
 
Performance Wins with BPF: Getting Started
Performance Wins with BPF: Getting StartedPerformance Wins with BPF: Getting Started
Performance Wins with BPF: Getting Started
 
Embedded Operating System - Linux
Embedded Operating System - LinuxEmbedded Operating System - Linux
Embedded Operating System - Linux
 
Bootloaders (U-Boot)
Bootloaders (U-Boot) Bootloaders (U-Boot)
Bootloaders (U-Boot)
 

Ähnlich wie Rust Embedded Development on ESP32 and basics of Async with Embassy

Ähnlich wie Rust Embedded Development on ESP32 and basics of Async with Embassy (20)

Embedded Development on ESP32 - FEKT VUT - UREL
Embedded Development on ESP32 - FEKT VUT - URELEmbedded Development on ESP32 - FEKT VUT - UREL
Embedded Development on ESP32 - FEKT VUT - UREL
 
WebSocket on client & server using websocket-sharp & ASP.NET Core
WebSocket on client & server using websocket-sharp & ASP.NET CoreWebSocket on client & server using websocket-sharp & ASP.NET Core
WebSocket on client & server using websocket-sharp & ASP.NET Core
 
ESP32_LABVIEW.pdf
ESP32_LABVIEW.pdfESP32_LABVIEW.pdf
ESP32_LABVIEW.pdf
 
A glance at the Rust SWC
A glance at the Rust SWCA glance at the Rust SWC
A glance at the Rust SWC
 
GDG-ANDROID-ATHENS Meetup: Build in Docker with Jenkins
GDG-ANDROID-ATHENS Meetup: Build in Docker with Jenkins GDG-ANDROID-ATHENS Meetup: Build in Docker with Jenkins
GDG-ANDROID-ATHENS Meetup: Build in Docker with Jenkins
 
Lab Handson: Power your Creations with Intel Edison!
Lab Handson: Power your Creations with Intel Edison!Lab Handson: Power your Creations with Intel Edison!
Lab Handson: Power your Creations with Intel Edison!
 
Introduction to ESP32 Programming [Road to RIoT 2017]
Introduction to ESP32 Programming [Road to RIoT 2017]Introduction to ESP32 Programming [Road to RIoT 2017]
Introduction to ESP32 Programming [Road to RIoT 2017]
 
App container rkt
App container rktApp container rkt
App container rkt
 
An Overview of the IHK/McKernel Multi-kernel Operating System
An Overview of the IHK/McKernel Multi-kernel Operating SystemAn Overview of the IHK/McKernel Multi-kernel Operating System
An Overview of the IHK/McKernel Multi-kernel Operating System
 
carrow - Go bindings to Apache Arrow via C++-API
carrow - Go bindings to Apache Arrow via C++-APIcarrow - Go bindings to Apache Arrow via C++-API
carrow - Go bindings to Apache Arrow via C++-API
 
My ROS Experience
My ROS ExperienceMy ROS Experience
My ROS Experience
 
Fedora on risc-v_tokyo_30_sep_2019_v4
Fedora on risc-v_tokyo_30_sep_2019_v4Fedora on risc-v_tokyo_30_sep_2019_v4
Fedora on risc-v_tokyo_30_sep_2019_v4
 
Rapid IoT prototyping with mruby
Rapid IoT prototyping with mrubyRapid IoT prototyping with mruby
Rapid IoT prototyping with mruby
 
Apache Bigtop and ARM64 / AArch64 - Empowering Big Data Everywhere
Apache Bigtop and ARM64 / AArch64 - Empowering Big Data EverywhereApache Bigtop and ARM64 / AArch64 - Empowering Big Data Everywhere
Apache Bigtop and ARM64 / AArch64 - Empowering Big Data Everywhere
 
Embedded Linux BSP Training (Intro)
Embedded Linux BSP Training (Intro)Embedded Linux BSP Training (Intro)
Embedded Linux BSP Training (Intro)
 
OPTEE on QEMU - Build Tutorial
OPTEE on QEMU - Build TutorialOPTEE on QEMU - Build Tutorial
OPTEE on QEMU - Build Tutorial
 
Discovering OpenBSD on AWS
Discovering OpenBSD on AWSDiscovering OpenBSD on AWS
Discovering OpenBSD on AWS
 
Build Low-Latency Applications in Rust on ScyllaDB
Build Low-Latency Applications in Rust on ScyllaDBBuild Low-Latency Applications in Rust on ScyllaDB
Build Low-Latency Applications in Rust on ScyllaDB
 
Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014
 
Ropython-windbg-python-extensions
Ropython-windbg-python-extensionsRopython-windbg-python-extensions
Ropython-windbg-python-extensions
 

Mehr von Juraj Michálek

Mehr von Juraj Michálek (20)

C language in our world 2019
C language in our world 2019C language in our world 2019
C language in our world 2019
 
C language in our world 2017
C language in our world 2017C language in our world 2017
C language in our world 2017
 
Continuous Delivery - FIT VUT
Continuous Delivery - FIT VUTContinuous Delivery - FIT VUT
Continuous Delivery - FIT VUT
 
C language in our world 2016
C language in our world 2016C language in our world 2016
C language in our world 2016
 
Story behind PF 2016
Story behind PF 2016Story behind PF 2016
Story behind PF 2016
 
C++ and Software Engineering 2015
C++ and Software Engineering 2015C++ and Software Engineering 2015
C++ and Software Engineering 2015
 
C language in our world 2015
C language in our world 2015C language in our world 2015
C language in our world 2015
 
C++ in our world
C++ in our worldC++ in our world
C++ in our world
 
Bigger & Better RnD - GeeCON.cz 2014
Bigger & Better RnD - GeeCON.cz 2014Bigger & Better RnD - GeeCON.cz 2014
Bigger & Better RnD - GeeCON.cz 2014
 
Gradle and build systems for C language
Gradle and build systems for C languageGradle and build systems for C language
Gradle and build systems for C language
 
The story behind PF2014 - Cordova
The story behind PF2014 - CordovaThe story behind PF2014 - Cordova
The story behind PF2014 - Cordova
 
There is more to C 2013
There is more to C 2013There is more to C 2013
There is more to C 2013
 
PowerShell UIAtomation
PowerShell UIAtomationPowerShell UIAtomation
PowerShell UIAtomation
 
PowerShell from *nix user perspective
PowerShell from *nix user perspectivePowerShell from *nix user perspective
PowerShell from *nix user perspective
 
Ať se z kódu nepráší! 2013
Ať se z kódu nepráší! 2013Ať se z kódu nepráší! 2013
Ať se z kódu nepráší! 2013
 
Libraries and tools for C++
Libraries and tools for C++Libraries and tools for C++
Libraries and tools for C++
 
There is more to C
There is more to CThere is more to C
There is more to C
 
Git, Jenkins & Chuck
Git, Jenkins & ChuckGit, Jenkins & Chuck
Git, Jenkins & Chuck
 
Startup Camp - Git, Python, Django session
Startup Camp - Git, Python, Django sessionStartup Camp - Git, Python, Django session
Startup Camp - Git, Python, Django session
 
Ať se z kódu nepráší!
Ať se z kódu nepráší!Ať se z kódu nepráší!
Ať se z kódu nepráší!
 

Kürzlich hochgeladen

TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 

Kürzlich hochgeladen (20)

Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 

Rust Embedded Development on ESP32 and basics of Async with Embassy

  • 1. Rust Embedded Development on ESP32 and basics of Async with Embassy 2023-02-08 Rust CZ/SK Meetup - Brno Juraj Michálek, Juraj Sadel - Espressif Systems
  • 3. Rust ESP32 Community meeting Regular meeting every two weeks https://github.com/esp-rs/rust/discussions/
  • 4. Community based effort to make Rust better The Rust on ESP Book - https://esp-rs.github.io/book/ Awesome ESP Rust - https://github.com/esp-rs/awesome-esp-rust - submit your project :-)
  • 5. Designing Open Hardware - esp-rust-board KiCad templates https://github.com/esp-rs/esp-rust-board ESP32-C3-DevKit-RUST-1 (available at Mouser, AliExpress) https://www.espressif.com/en/products/devkits
  • 6. wokwi.com/rust Contribute: https://github.com/wokwi EDC22 Day 1 Talk 9: Your browser is ESP32 - Wokwi - https://youtu.be/TKe4MgD6O8o
  • 8. Exploring what’s possible with Rust Bare Metal: https://github.com/esp-rs/esp-hal - ESP32 - esp32-hal/examples - Xtensa - ESP32-C2 - esp32c2-hal/examples - RISC-V - ESP32-C3 - esp32c3-hal/examples - RISC-V - ESP32-S2 - esp32s2-hal/examples - Xtensa - ESP32-S3 - esp32s3-hal/examples - RISC-V STD: https://github.com/esp-rs/esp-idf-hal/tree/master/examples
  • 9. Create new project Rust project Bare metal: cargo generate https://github.com/esp-rs/esp-template STD with ESP-IDF: cargo generate --vcs none --git https://github.com/esp-rs/esp-idf-template cargo
  • 10. Multi-target project (PoC) - ESP32 Spooky Maze https://github.com/georgik/esp32-spooky-maze-game Idea: sharing business logic in Rust between multiple targets Targets: ESP32, ESP32-S2, ESP32-S3, ESP32-C3, M5Stack, Wasm and Desktop Article: https://georgik.rocks/rust-bare-metal-application-for-esp32-desktop-android-and-ios/ https://github.com/espressif/esp-box
  • 11. Wokwi - VS Code Plugin Add wokwi.toml and diagram.json to your project cd m5stack-fire cargo build --release --no-default-features --features "wokwi" CTRL+Shift+P - Wokwi: Start Simulator
  • 12. Async with Embassy Embassy: https://github.com/embassy-rs/embassy Examples of Embassy on ESP32: - https://github.com/esp-rs/esp-hal/blob/main/esp32-hal/examples/embassy_hello_world.rs - https://github.com/esp-rs/esp-hal/blob/main/esp32-hal/examples/embassy_spi.rs - https://github.com/esp-rs/esp-hal/blob/main/esp32-hal/examples/embassy_wait.rs
  • 13. Development options - Local - bootstrap whole env with “espup install” - https://github.com/esp-rs/espup#installation (written in Rust) - Windows Online idf-installer - https://github.com/espressif/idf-installer/releases/tag/online-2.20 (includes VC Tools) - bootstrap with sh/pwsh (older method) - https://github.com/esp-rs/rust-build#download-installer - Local in container - Podman, Docker, Lima - with VS Code Remote Container extension - Cloud in GitPod.io or CodeSpaces - EDC22 Day 2 Talk 11 Just Few dot files in Repo or Paradigm Shift to Cloud-based Embedded Development - https://youtu.be/WAwfRyOy7N8 - Wokwi.com
  • 14. Busy Looping (not using async) - Very inefficient, blocking
  • 15. Interrupts (not using async) - Driven by hardware - Pretty complex
  • 16. Using async - Don’t have to setting and waiting for interrupt resuming the program - Async executor can do that for us instead - Power efficient
  • 17. async/.await - Non-blocking operations - Transforms each async function into future object - When future blocks I/O it yields -> executor selects different future to execute - No guessing which future is ready
  • 18. Embassy (EMBedded ASYnc) - We need an EXECUTOR to be able to use async - Controlling which task should run - Embassy consists of multiple crates (Executor, HALs, Networking,...) - no_std - Can be (relatively) easily extendable/configurable with other public crates - https://embassy.dev
  • 19. Executor - Queue of tasks, when created it’s polled (1) - Executing until gets blocked (awaiting async function) (2) - Executes other task (3)
  • 20. Interrupts - Task is polled and executing (1) - Task uses a peripheral to perform an operation(2) - Interrupt occurred while awaiting (3) - HAL ensures that interrupt signal updates the peripheral state (4) - Executor poll the task (5)
  • 21. Rust language support Talk: Embedded Rust on ESP32 - Juraj Michálek - Rust Linz November 2022 https://youtu.be/0PPPdqoDBQs
  • 22. Training Embedded for ESP32-C3 by Ferrous Systems Training: https://ferrous-systems.com/training/#package-espressif-beginner-training Material: https://espressif-trainings.ferrous-systems.com/ GitHub: https://github.com/ferrous-systems/espressif-trainings/
  • 24. ESP Launchpad - https://espressif.github.io/esp-launchpad/
  • 25. Many chips, many boards - quick help https://products.espressif.com/
  • 26. IDE Supported by Espressif: - VS Code with Espressif Extension - https://docs.espressif.com/projects/esp-idf/en/stable/esp32/get-started/vscode-setup.html - Espressif IDE - https://dl.espressif.com/dl/esp-idf/ Supported by 3rd party and community: - Visual Studio with VisualGDB - https://visualgdb.com/ - CLion - https://www.jetbrains.com/clion/
  • 27. Espressif Developer Conference 2022 - recording https://www.youtube.com/playlist?list=PLOzvoM7_Knrc6o-n25jYuXRB2T8UKk1NU
  • 28. OSes and integration ESP-IDF (OS based on FreeRTOS) - https://github.com/esp-rs/esp-idf-hal (full feature) no_std a.k.a. bare metal with Rust - https://github.com/esp-rs/esp-hal (minimalistic) Zephyr - https://zephyrproject.org/ - EDC22 Day 1 Talk 10: Applications of Asymmetric Multiprocessing with ESP32 Devices - including Rust on one core - https://youtu.be/oble9ObAqxM NuttX - https://nuttx.apache.org/ (as app, Linux-like OS) SVD files: https://github.com/espressif/svd
  • 29. Further languages and frameworks Arduino - Maker choice - warning: limitation on production due to licenses! VM based: - CircuitPython and MicroPython - Python-like language - Toit - Toit language - Nanoframework - C# language - Mongoose OS - downside: bigger VM - upside: more robust, comes with OTA and monitoring
  • 30. CTAG-TBD CTAG TBD >>to be determined<< an extendible open source Eurorack sound module https://github.com/ctag-fh-kiel/ctag-tbd
  • 31. Wearables The Ultimate Guide to Informed Wearable Technology - book: https://packt.link/01VBv
  • 32. Time-O-Mat - built at summer camp https://github.com/vedatori/Time-O-Mat
  • 34. Embedded World 2023 Meet us in Nuremberg, Germany
  • 35. Visit us in Brno Espressif Systems (Czech) s.r.o. Přízova 3, 602 00 Brno Czechia, Europe See you in Linz in 2023. We’re planning ESP32 Rust Workshop ;-)