Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
スタックチャンで複数アプリを切り替えるテクニック
Search
Takao Akaki
July 31, 2023
Programming
950
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
スタックチャンで複数アプリを切り替えるテクニック
2023/7/29 スタックチャン お誕生日会 2023のLTで、M5Stack-SD-Updaterの概要を説明した時のスライドです。
Takao Akaki
July 31, 2023
Transcript
12 slides
スタックチャンで複数アプリを 切り替えるテクニック M5Stack-SD-Updaterの使い方 Arduino-Frameworkで利用できます。 5分なので概要だけです。 2023/7/29 タカオ
自己紹介 名前 タカオ(Twitter: @mongonta555) 職業 スタックチャン職人 M5Stackのドキュメント要員
スタックチャンと出会って2年で26人になりました。 BOOTHでスタックチャン タカオ版組み立てキットを頒布しています。 (見送った人数は 2023/7/29現在 579人) https://mongonta.booth.pm
ESP32上で複数のアプリを切り替えて使うことが 可能になります。 スタックチャンに限りません。 ArduinoFrameworkで利用できます。 相互に切り替えを行うには、各アプリにSD- Updaterの組み込みが必要です。 M5Stack-SD-Updaterとは https://github.com/tobozo/M5Stack-SD-Updater Tobozo Tagada(@TobozoTagada)氏が公開しているArduinoライブラリです。
M5Stack-SD-Updaterを使うメリット 1つのアプリで複数の機能を盛り込んだ場合にありがちな、ヒープメモリ不足 を気にしなくて済む。 複数の機能を同一コード内に持たずに済むので、複雑にならない。 M5Stack-SD-Updaterを使うデメリット SDやSPIFFSからバイナリを読み込むので切り替えには時間がかかる。 →
2つのアプリの切り替えであれば速くするテクニックもある。 プログラムを変更した場合、生成したbinも置き換える必要がある。 → あらかじめ、プログラムにbinを保存する機能を盛り込んでおくと楽
仕組み ESP32(S3等含む)はOTA(Over The Air)という仕組みを持っていて、ファームウェア(アプリ)を WiFi経由で書き換えることが可能です。 その仕組みを利用してSPIFFSやSD上にあるbinファイルをFlashに読み込んで 動作しているファームウェア(アプリ)を切り替えるという仕組みです。
仕組み上、app0とapp1のそれそれのサイズを超えるアプリは使用することができません。 Name 16MB(Core/2/S3等) 8MB(AtomS3等) 4MB(Atom,StickC等) build_partition default_16MB.csv default_8MB.csv default.csv nvs 5,000 5,000 5,000 otadata 2,000 2,000 2,000 app0 640,000 330,000 140,000 app1 640,000 330,000 140,000 spiffs 360,000 180,000 160,000 coredump 10,000 10,000 10,000 ESP32のFlashメモリのパーティションレイアウト(単位:byte)
簡単に言うと、、、 SDカードやSPIFFS(M5Stack内蔵Flashメ モリの一部)に書き込んだbinファイル を相互に切り替えることが可能です。 AIスタックチャン センサー値の表示 アプリ Bluetoothスピーカー スタックチャン AIStackchan.bin
BTStackchan.bin Sensor.bin ランチャーアプリ(menu.bin) AIスタックチャン BTSPK センサー アプリ
Binの用意の仕方 1.ArduinoIDEでバイナリビルド 2.VSCode+PlatformIOからコピー 3.アプリから書き込む方法
Binの用意の仕方① ArduinoIDEでバイナリコンパイル メニューから「スケッチ」→「コンパイル済みバイナリをエクスポート」 を選ぶとbin形式のファイルを生成することができます。 (Arduino1.8.xでは「コンパイルしたバイナリを出力」)
Binの用意の仕方② VSCode+PlatformIOからコピー Buildを実行すると、 .pio/build/(選択したenv名のフォルダ) の下にfirmware.binとファイルができます。 そのファイルをコピーして名前を変更して ください。
Binの用意の仕方③ アプリに書き込み機能を組み込む 多分これが一番楽です。 下記のようなコードをアプリに組み込みます。 例では、BtnAをダブルクリックをするとSPIFFSに書き込みます。
M5Stack-SD-Updaterの注意事項 binのファイル名は半角英数字のみで短めに。 あまり長すぎると、エラーが出て読み込めません。 SPIFFSを使う場合はフォーマットできてないとエラーになる場合がある。 その場合は一度Eraseしてから書き込んでみましょう。
ご清聴ありがとうございました。
More Decks by Takao Akaki
See All by Takao Akaki
2026.6.27 お誕生日会で配布された透明シェルを交換する際の注意点について
mongonta0716
0
280
2025.5.4 M5Stack スタックチャンの活用方法(2025最新版)
mongonta0716
0
1.2k
スタックチャンに外部スピーカーを接続する方法
mongonta0716
0
920
2022.10.23 メタル #スタックチャン を作ってみた。
mongonta0716
0
2.6k
2022.09.23 メタルスタックチャンを作ってみた
mongonta0716
2
990
2022.7.23 スタックチャン誕生日会
mongonta0716
0
690
Other Decks in Programming
See All in Programming
Kiro Crewによる開発体験ーKiro CrewでStrands Decider 2B に関する技術検証をやってみた
satoshi256kbyte
1
220
LLM 101
dalinaum
0
550
JavaScriptはシングルバイナリの夢を見るか / Does JavaScript Dream of a Single Binary?
ssssota
0
910
あなたはMCPの機能を、まだ知らない。
4geru
1
740
自宅サーバはどこまで再現できるのか - Proxmox VE上のVM環境をIaCとバックアップで戻してみた
youto
0
450
AI駆動開発4年目の現在地(『あなたはFDEになるべきか?』イベント資料)
kumaiu
0
710
Kawaiicon: Kubernetes, it's no longer cool, but let's secure it anyway!
barnbarn
0
150
flutter_test のその先へ — Flutter アプリの LLM 機能に「評価」という品質保証を
kosukesaigusa
0
210
The Cost of the DOM
ypresto
2
870
SODA - FACT BOOK(JP)
sodainc
1
40k
Lean で手続き的プログラム の証明が書けるようになった
inoueasei
9
5.2k
Getting Started with Vibe Coding
miccheng
0
250
Featured
See All Featured
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
970
Making the Leap to Tech Lead
cromwellryan
135
10k
4 Signs Your Business is Dying
shpigford
187
23k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
23k
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
4
4.4k
Fantastic passwords and where to find them - at NoRuKo
philnash
53
4k
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4.3k
Ten Tips & Tricks for a 🌱 transition
stuffmc
1
290
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.9k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.4k
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.9k
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
560