Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
技術書典7で見つけたベアメタルRust本 / Bare Metal with Rust
Search
Yuya Kato
October 05, 2019
Programming
1
650
技術書典7で見つけたベアメタルRust本 / Bare Metal with Rust
Yuya Kato
October 05, 2019
Tweet
Share
More Decks by Yuya Kato
See All by Yuya Kato
DevLOVE関西 自分の現場でやった“こと”と“経験”をみんなが話す会 / DevLOVE Kansai sharing experiences
yuyakato
0
73
Rustの新しい書籍『実践Rust入門』の紹介 / Introduction of Rust bicycle book
yuyakato
0
260
Rubyから世界へ / Let’s start a journey around the world beyond Ruby
yuyakato
0
540
サーマルプリンタとRaspberry Piでカンバンを改善した話
yuyakato
3
1.3k
「チームで学ぼう!TensorFlow実践編」第1期で僕が学んだこと
yuyakato
0
310
Other Decks in Programming
See All in Programming
AIの力でお手軽Chrome拡張機能作り
taiseiue
0
170
2024年のWebフロントエンドのふりかえりと2025年
sakito
3
250
1年目の私に伝えたい!テストコードを怖がらなくなるためのヒント/Tips for not being afraid of test code
push_gawa
0
210
SpringBoot3.4の構造化ログ #kanjava
irof
2
1k
Software Architecture
hschwentner
6
2.1k
チームリードになって変わったこと
isaka1022
0
200
Ruby on cygwin 2025-02
fd0
0
150
Rails アプリ地図考 Flush Cut
makicamel
1
120
Rubyで始める関数型ドメインモデリング
shogo_tksk
0
120
How mixi2 Uses TiDB for SNS Scalability and Performance
kanmo
38
14k
Amazon Q Developer Proで効率化するAPI開発入門
seike460
PRO
0
110
パスキーのすべて ── 導入・UX設計・実装の紹介 / 20250213 パスキー開発者の集い
kuralab
3
790
Featured
See All Featured
BBQ
matthewcrist
87
9.5k
Facilitating Awesome Meetings
lara
52
6.2k
Why Our Code Smells
bkeepers
PRO
336
57k
Imperfection Machines: The Place of Print at Facebook
scottboms
267
13k
Agile that works and the tools we love
rasmusluckow
328
21k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.4k
Designing for Performance
lara
604
68k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
27
1.6k
Building Adaptive Systems
keathley
40
2.4k
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
Why You Should Never Use an ORM
jnunemaker
PRO
55
9.2k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
Transcript
1 Rust Kansai Meetup #5 ٕज़ॻయ7Ͱݟ͚ͭͨ ϕΞϝλϧRustຊ 201910݄5() @ηϯελΠϜδϟύϯ גࣜձࣾಹ༝ଟ
Ճ౻༐
ࣗݾհ: Ճ౻ ༐ • ιϑτΣΞΤϯδχΞʢ2000ʙʣ • גࣜձࣾಹ༝ଟ දऔకʢ2007ʙʣ ͳ Ώ
ͨ • झຯ: • ͷͮ͘Γશൠʢιϑτ/ϋʔυʣ • 3DϓϦϯλʢ2013ʙʣ • ϘϧμϦϯάʢ2011ʙʣ 2 yuyakato1984 nayutaya
ٕज़ॻయ 3
4 ٕज़ॻయͱʁ ৽͍ٕ͠ज़ʹग़ձ͑Δ ͓ࡇΓͰ͢ɻ https://techbookfest.org/ ΑΓҾ༻ ٕज़ಉਓࢽͷଈചձ ۙͰ20199݄22()ʹାʹͯ։࠵ ࢀՃͨ͠ਓ
ٕज़ॻయ7ͷઓར 5 ↑ࣄͰ6 ←झຯͰ5 Λ ͓͔͍ͭ ͯ͠Β͍·ͨ͠ ͋Γ͕ͱ͏ʂI܅
ϕΞϝλϧ 6
ϕΞϝλϧͱʁ 7 ʲϕΞϝλϧʳʪ໊ʫ Bare Metal ༁Ͱʮ࿐ग़ͨۚ͠ଐʯʮΉ͖ग़͠ͷۚଐʯɻ సͯ͡ɺOSͳͲ͕Πϯετʔϧ͞Ε͍ͯͳ͍ɺ·ͬ͞Βͳ ίϯϐϡʔλɺ·ͨετϨʔδɻ
ϕΞϝλϧͱʁ 8
ϕΞϝλϧͱʁ 8 OSͷͳ͍Ϛγϯ ཁ͢Δʹ
9 RustΛѪ͢Δ ϕΞϝλϧΛѪ͢Δ ͔ͭ ͚ͩʹ ͞Δ3Λհ͠·͢ ͜ͷੈʹԿਓ͍Δ͔͔Βͳ͍ ͻͱ
հ͢Δ3 10 M5StackͰ࢝ΊΔ ΈࠐΈRust Rust on Bare-metal Raspberry Pi Rust
on Bare-metal Raspberry Pi Vol.2
1 11
M5StackͰ࢝ΊΔΈࠐΈRust 12 Kenta IDA ஶ / 58ϖʔδ μϯϩʔυ൛ 500ԁ https://booth.pm/ja/items/1569213
৽ץ
M5StackɺESP32ͱʁ 13 Wi-FiɺBluetoothΛଂ͢Δ ҆Ձ͔ͭଟػೳͳϚΠίϯ ESP32ɺӷথσΟεϓϨΠɺ ϘλϯɺόοςϦͳͲ͕ଂ͞Εͨ ίϯύΫτͳ։ൃϞδϡʔϧ ͜ͷϞδϡʔϧͷ தʹؚ·ΕΔνοϓ ελοΫͰ͖ΔΑʂ
US$5͘Β͍Ͱങ͑ΔΑʂ
ରಡऀ • M5Stackɺ·ͨESP32ʹ৮ͬͨ͜ͱ͕͋Δ • Arduino IDEɺPlatform IOɺ·ͨESP-IDFͰ ϓϩάϥϜΛ࡞ͬͨ͜ͱ͕͋Δ • RustͷʮHello,
worldʯܦݧࡁΈ 14 ֘͢Δਓ
͜ͷຊͷεΰΠͱ͜Ζ 15
͜ͷຊͷεΰΠͱ͜Ζ 15 LLVMɺrustc ͷϏϧυ͔Β͡·Δ ESP32ͷCPUTensilicaࣾͷXtensa LX6
QiitaهࣄΛॻ͖·ͨ͠ 16 ESP32 + RustͰ Hello world https://qiita.com/yuyakato/items/c11de0a43d14dea6c9dd Ϗϧυ͢Δ͚ͩͰ 30ʙ2͔͔࣌ؒΓ·͢
Ωʔϫʔυ #[no_std] #[no_mangle] #[global_allocator] #[alloc_error_handler] extern “C" bindgen FreeRTOS 17
2 18
Rust on Bare-metal Raspberry Pi 19 naotaco ஶ / 62ϖʔδ
ཧຊ 800ԁ https://booth.pm/ja/items/1318760 Kindle൛ 700ԁ https://www.amazon.co.jp/dp/B07QG3WX3T طץ
ରಡऀ • OSͷແ͍ੈքʹಌΕ͍ͯΔ • Raspberry Pi 3Λ࣋ͯ༨͍ͯ͠Δ • ϋʔυΣΞͷ͜ͱΛͬͱΓ͍ͨ 20
※ͪͳΈʹॻ੶ʹॻ͍ͯ͋Γ·ͤΜ ֘͢Δਓ
Raspberry Piͱʁ 21 ͜Εઆ໌ෆཁͩͱࢥΘΕΔͷͰলུ
͜ͷຊͷεΰΠͱ͜Ζ 22
͜ͷຊͷεΰΠͱ͜Ζ 22 mainؔ·Ͱ͕͍ ϕΞϝλϧ͋Δ͋Δ
Ωʔϫʔυ #[no_std] #[global_allocator] Arm Cortex-A53 SoC Ϩδελ DMA MMIO ϒʔτϩʔμ
UART registerΫϨʔτ compiler_fence fence JTAG OpenOCD gdb 23 DMA: Direct Memory Access MMIO: Memory Mapped I/O
3 24
Rust on Bare-metal Raspberry Pi Vol.2 25 naotaco ஶ /
50ϖʔδ ཧຊ 700ԁ https://booth.pm/ja/items/1575818 ৽ץ
͜ͷຊͷεΰΠͱ͜Ζ 26
͜ͷຊͷεΰΠͱ͜Ζ 26 ༰͕΄΅DMAC DMAC: DMA Controller
Ωʔϫʔυ DMAC #[repr(C)] ΩϟογϡϝϞϦ 27 DMAC: DMA Controller
·ͱΊ • ·͢·͕͢ΔRustͷద༻ൣғ • ϕΞϝλϧ͔Θ͍͍ΑϕΞϝλϧ 28
Let's dive into bare metal with Rust 29