◦ Written in Arduino ▪ Most famous one is AI stack-chan firmware authored by @robo8080 san ▪ https://github.com/robo8080/M5Unified_StackChan_ChatGPT ◦ Written in TypeScript for Moddable ▪ Authored by ししかわ san (also known as the author of Stack-chan itself) • There doesn't seem to be any firmware written in MicroPython/UI Flow. ◦ If you have any information, please let me know.
the display of M5Stack. ◦ M5Stack-Avatar (by ししかわさん) is mainly used to implement this. ◦ Some variants of M5Stack-Avatar are also available. ◦ Moddable firmware implements refit version of M5Stack-Avatar • Controls servo motors forj panning and tilt. ◦ ServoEasing Arduino library. ◦ Moddable firmware also implements easing? (I don’t know about it) • Wireless communications, etc…
ESP-IDF ◦ Mainly written in C. some part (e.g. NVS driver) is written in C++. ◦ User code can be written in both C, C++. • Arduino core for the ESP32 ◦ Arduino core for ESP32 series. ◦ Based heavily on ESP-IDF ◦ User code: Arduino language (C++) • MicroPython ◦ Python interpreter optimized for embedded systems. ◦ Based on Python 3.6 language spec + some extensions.
for embedded systems. ◦ User can use TypeScript compiler to generate ECMA Script run on Moddable. • TinyGo ◦ Go language compiler for embedded systems. ◦ You can use powerful Go language multithreading feature like goroutines and channels on embedded systems. • Rust ← New! ◦ Zero cost, memory safe language, used mainly at desktop and server. ◦ Can generate binaries for embedded systems.
reliable and efficient software.” (https://www.rust-lang.org/) ◦ Zero cost abstractions ◦ Memory safety without GC ◦ Powerful package manager and build system (cargo) • Rust applications for embedded systems are increasing. ◦ Linux kernel module ◦ Microsoft also uses Rust for writing kernel of their OS. • Espressif is also actively working on creating a development environment for Rust.
• Using esp-idf-sys and write application for ESP-IDF in Rust. ◦ On this platform, you can use ESP-IDF functionality from Rust. ◦ You can also use FreeRTOS functionality via Rust threading library. • Using esp-hal and write bare-metal application in Rust. ← I used this. ◦ No ESP-IDF dependency. ◦ You can get very compact firmware and less compilation time. ◦ You CANNOT use rich ESP-IDF functionality at all. ◦ WiFi and BLE communications are currently experimental.
firmware in Rust. • There is a lot of functions to implement. ◦ Showing “kawaii” face. ◦ Controlling servo motors. ◦ M5Stack Core2 platform support ← !!!!
Rust graphics library. ◦ M5Stack-Avatar uses FreeRTOS functions, which does not exist in baremetal ESP32. ◦ The structure of M5Stack-Avatar works well with embedded-graphics. ▪ Defining shapes, then draw to the display. ◦ Around 3 days to port the minimal functionality.
Ported from Wio Terminal-chan’s firmware. (which is also written in Rust) • Implementing PWM output driver. ◦ esp-hal crate has MCPWM peripheral driver. so all I need to do is just call it.
driver ◦ Core2 uses AXP192 to control its power source. ◦ In order to configure powers for peripherals, AXP192 must be initialized correctly. ▪ Peripherals, LCD backlights, etc… ◦ I have experience implementing M5StickC AXP192 driver for ESP-IDF in C++. ◦ I’ve ported this driver and M5Stack official driver for Core2 to Rust.
Core2 uses ILI9342 LCD controller. ◦ There is existing library, “ili9341” crate in crates.io, but it is a bit old and do not compatible with current embedded-hal crate. ◦ I’ve ported my ILI9341 library I wrote a few years ago to latest environment.