技術書典7で見つけたベアメタルRust本 / Bare Metal with Rust

682bc9c1067a85bbcaa6cc35b1f23982?s=47 Yuya Kato
October 05, 2019

技術書典7で見つけたベアメタルRust本 / Bare Metal with Rust

682bc9c1067a85bbcaa6cc35b1f23982?s=128

Yuya Kato

October 05, 2019
Tweet

Transcript

  1. 1 Rust Kansai Meetup #5 ٕज़ॻయ7Ͱݟ͚ͭͨ ϕΞϝλϧRustຊ 2019೥10݄5೔(౔) @ηϯελΠϜδϟύϯ גࣜձࣾಹ༝ଟ԰

    Ճ౻༐໵
  2. ࣗݾ঺հ: Ճ౻ ༐໵ • ιϑτ΢ΣΞΤϯδχΞʢ2000೥ʙʣ • גࣜձࣾಹ༝ଟ԰ ୅දऔక໾ʢ2007೥ʙʣ ͳ Ώ

    ͨ ΍ • झຯ: • ΋ͷͮ͘Γશൠʢιϑτ/ϋʔυʣ • 3DϓϦϯλʢ2013೥ʙʣ • ϘϧμϦϯάʢ2011೥ʙʣ 2 yuyakato1984 nayutaya
  3. ٕज़ॻయ 3

  4. 4 ٕज़ॻయͱ͸ʁ ৽͍ٕ͠ज़ʹग़ձ͑Δ ͓ࡇΓͰ͢ɻ https://techbookfest.org/ ΑΓҾ༻ ٕज़ಉਓࢽͷଈചձ ௚ۙͰ͸2019೥9݄22೔(೔)ʹ஑ାʹͯ։࠵ ࢀՃͨ͠ਓ

  5. ٕज़ॻయ7ͷઓར඼ 5 ↑࢓ࣄ࿮Ͱ6࡭ ←झຯ࿮Ͱ5࡭ Λ ͓͔͍ͭ ͯ͠΋Β͍·ͨ͠ ͋Γ͕ͱ͏ʂI܅

  6. ϕΞϝλϧ 6

  7. ϕΞϝλϧͱ͸ʁ 7 ʲϕΞϝλϧʳʪ໊ʫ Bare Metal ௚༁Ͱ͸ʮ࿐ग़ͨۚ͠ଐʯʮΉ͖ग़͠ͷۚଐʯɻ సͯ͡ɺOSͳͲ͕Πϯετʔϧ͞Ε͍ͯͳ͍ɺ·ͬ͞Βͳ ίϯϐϡʔλɺ·ͨ͸ετϨʔδɻ

  8. ϕΞϝλϧͱ͸ʁ 8

  9. ϕΞϝλϧͱ͸ʁ 8 OSͷͳ͍Ϛγϯ ཁ͢Δʹ

  10. 9 RustΛѪ͢Δ ϕΞϝλϧΛѪ͢Δ ͔ͭ ͚ͩʹ ࢗ͞Δ3࡭Λ঺հ͠·͢ ͜ͷੈʹԿਓ͍Δ͔෼͔Βͳ͍ ͻͱ

  11. ঺հ͢Δ3࡭ 10 M5StackͰ࢝ΊΔ ૊ΈࠐΈRust Rust on Bare-metal Raspberry Pi Rust

    on Bare-metal Raspberry Pi Vol.2
  12. 1࡭໨ 11

  13. M5StackͰ࢝ΊΔ૊ΈࠐΈRust 12 Kenta IDA ஶ / 58ϖʔδ μ΢ϯϩʔυ൛ 500ԁ https://booth.pm/ja/items/1569213

    ৽ץ
  14. M5StackɺESP32ͱ͸ʁ 13 Wi-FiɺBluetoothΛ಺ଂ͢Δ ҆Ձ͔ͭଟػೳͳϚΠίϯ ESP32ɺӷথσΟεϓϨΠɺ ϘλϯɺόοςϦͳͲ͕಺ଂ͞Εͨ ίϯύΫτͳ։ൃϞδϡʔϧ ͜ͷϞδϡʔϧͷ தʹؚ·ΕΔνοϓ ελοΫͰ͖ΔΑʂ

    US$5͘Β͍Ͱങ͑ΔΑʂ
  15. ର৅ಡऀ • M5Stackɺ·ͨ͸ESP32ʹ৮ͬͨ͜ͱ͕͋Δ • Arduino IDEɺPlatform IOɺ·ͨ͸ESP-IDFͰ
 ϓϩάϥϜΛ࡞ͬͨ͜ͱ͕͋Δ • RustͷʮHello,

    worldʯ͸ܦݧࡁΈ 14 ֘౰͢Δਓ
  16. ͜ͷຊͷεΰΠͱ͜Ζ 15

  17. ͜ͷຊͷεΰΠͱ͜Ζ 15 LLVMɺrustc ͷϏϧυ͔Β͸͡·Δ ESP32ͷCPU͸TensilicaࣾͷXtensa LX6

  18. QiitaهࣄΛॻ͖·ͨ͠ 16 ESP32 + RustͰ Hello world https://qiita.com/yuyakato/items/c11de0a43d14dea6c9dd Ϗϧυ͢Δ͚ͩͰ 30෼ʙ2͔͔࣌ؒΓ·͢

  19. Ωʔϫʔυ #[no_std] #[no_mangle] #[global_allocator] #[alloc_error_handler] extern “C" bindgen FreeRTOS 17

  20. 2࡭໨ 18

  21. 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 طץ
  22. ର৅ಡऀ • OSͷແ͍ੈքʹಌΕ͍ͯΔ • Raspberry Pi 3Λ࣋ͯ༨͍ͯ͠Δ • ϋʔυ΢ΣΞͷ͜ͱΛ΋ͬͱ஌Γ͍ͨ 20

    ※ͪͳΈʹॻ੶ʹ͸ॻ͍ͯ͋Γ·ͤΜ ֘౰͢Δਓ
  23. Raspberry Piͱ͸ʁ 21 ͜Ε͸આ໌ෆཁͩͱࢥΘΕΔͷͰলུ

  24. ͜ͷຊͷεΰΠͱ͜Ζ 22

  25. ͜ͷຊͷεΰΠͱ͜Ζ 22 mainؔ਺·Ͱ͕௕͍ ϕΞϝλϧ͋Δ͋Δ

  26. Ωʔϫʔυ #[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
  27. 3࡭໨ 24

  28. Rust on Bare-metal Raspberry Pi Vol.2 25 naotaco ஶ /

    50ϖʔδ ෺ཧຊ 700ԁ https://booth.pm/ja/items/1575818 ৽ץ
  29. ͜ͷຊͷεΰΠͱ͜Ζ 26

  30. ͜ͷຊͷεΰΠͱ͜Ζ 26 ಺༰͕΄΅DMAC DMAC: DMA Controller

  31. Ωʔϫʔυ DMAC #[repr(C)] ΩϟογϡϝϞϦ 27 DMAC: DMA Controller

  32. ·ͱΊ • ·͢·͢޿͕ΔRustͷద༻ൣғ • ϕΞϝλϧ͔Θ͍͍ΑϕΞϝλϧ 28

  33. Let's dive into bare metal with Rust 29