Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Keyboard Firmware in Rust

Keyboard Firmware in Rust

Bcbc80799bc32840662a366768318a9b?s=128

Kobayashi

July 03, 2019
Tweet

Transcript

  1. ࣗ࡞ΩʔϘʔυͷ
 ϑΝʔϜ΢ΣΞΛ
 3VTUͰॻ͘ KOBA789

  2. ,0#" w ΫοΫύουגࣜձٕࣾज़෦σʔλج൫άϧʔϓ w ϝΠϯͷ࢓ࣄ͸େྔͷσʔλΛ͍͍ײ͡ʹ͢Δ͜ͱ
 ͱ͍͏͜ͱʹͳ͍ͬͯΔ  w ࣮ࡍ͸͓΋͠Ζͦ͏ͳ͜ͱΛͳΜͰ΋΍͍ͬͯΔ w

    ݱࡏ৽ଔ೥໨
  3. ࣗ࡞ΩʔϘʔυ

  4. None
  5. ࠷ۙ<͍ͭ >ਓؾͳझຯ<ཁग़య>

  6. https://techlife.cookpad.com/entry/2018/08/14/172130

  7. ฐࣾʹ΋ͨ͘͞ΜͷѪ޷Ո͕

  8. Ͱɺ

  9. https://internship.cookpad.com/2019/spring/

  10. Πϯλʔϯγοϓ ࣗ࡞ΩʔϘʔυίʔε

  11. None
  12. څྉ΋Βͬͯࣗ࡞ΩʔϘʔυΛ
 ΍Δ͜ͱʹͳͬͯ͠·ͬͨ

  13. ͑Β͍ਓʮόζΒ͍ͤͨʯ Զʮ͡Ό͋ΧϦΩϡϥϜ͸աܹʹʯ

  14. ݁Ռ

  15. w͸Μͩ෇͚͸΋ͪΖΜ΍Δ w؆୯ͳిࢠճ࿏΋΍Δ wϓϦϯτج൘ͷઃܭ΋΍Δ wϑΝʔϜ΢ΣΞ͸3VTUͰॻ͘

  16. ϑΝʔϜ΢ΣΞ͸
 3VTUͰॻ͘

  17. 1SP.JDSP https://www.switch-science.com/catalog/1623/ ࣗ࡞ΩʔϘʔυͰ͸Ұൠత

  18. 1SP.JDSPͷੴ͸"5NFHB6 "5NFHB6͸"73

  19. 3VTUͰ"73͸ͩΔ͍

  20. ૊ΈࠐΈ3VTU͓͢͢Ί͸ $PSUFY.γϦʔζ "3. 3*4$7͡Όͳͯ͘͝ΊΜͳ

  21. ௨শCMVFQJMM w 45.'$͕৐ͬͯΔ w 45.'$͸$PSUFY. w 3".,# w $16$MPDLVQUP.)[ w

    'MBTI,# ࣮ࡍ͸ͳ͔ͥ,# https://wiki.stm32duino.com/index.php?title=File:STM32_Blue_Pill_perspective.jpg
  22. ௨শCMVFQJMM ͓͍͘Βͩͱࢥ͍·͔͢
 https://wiki.stm32duino.com/index.php?title=File:STM32_Blue_Pill_perspective.jpg

  23. ௨শCMVFQJMM  https://wiki.stm32duino.com/index.php?title=File:STM32_Blue_Pill_perspective.jpg

  24. ։ൃͷͨΊͷπʔϧ

  25. ͍͍ͩͨ
 5IF&NCFEEFE3VTU#PPL
 ʹॻ͍ͯ͋ΔͷͰলུ

  26. ͱ͘ʹศརͳ΋ͷΛ঺հ

  27. #MBDL.BHJD1SPCF w 1SPHSBNNFS%FCVHHFS w ιϑτ΢ΣΞ͸Φʔϓϯιʔε w ϋʔυ΢ΣΞ͸CMVFQJMMͳͲ͕࢖͑Δ w ࢲ͸CMBDLQJMMΛ࢖ͬͯ࡞ͬͨ w

    ϑϦεΫέʔεͰ͍͍ײ͡
  28. None
  29. cargo runͰ͖Δ ຊ೔ೋ౓໨  Demo

  30. HEC࢖͑Δ ϒϨʔΫϙΠϯτషΕΔ ϝϞϦμϯϓͰ͖Δ

  31. println!Ͱ͖Δ Demo

  32. cortex_m_semihosting

  33. ૊ΈࠐΈϓϩάϥϛϯάͰ
 ආ͚ΒΕͳ͍΋ͷ

  34. पลػثϖϦϑΣϥϧ

  35. ϖϦϑΣϥϧͷػೳݺͼग़͠
 ϨδελΞΫηε

  36. ΞηϯϒϦ  /P

  37. JO$ ϝʔΧʔ͕ϥΠϒϥϦΛఏڙ JO3VTU ศརΫϨʔτ͕͋Δ

  38. TWESVTU wΈΜͳ͍͖ͩ͢ίʔυδΣωϨʔλ wσόΠεఆٛϑΝΠϧTWE͔Β wϨδελΞΫηεؔ਺ͷίʔυΛు͘

  39. TUNG wTWESVTUͰు͔ΕͨίʔυΛ w͍͍ײ͡ʹௐ੔ͨ͠ΫϨʔτ wTUNGͰ࢖͑Δ

  40. -νΧͱ͔͸Ͱ͖Δ

  41. None
  42. ͔͠͠ɺ

  43. ΩʔϘʔυͳͷͰ 64#)*%Λ
 ͠Ό΂Βͳ͍ͱ͍͚ͳ͍

  44. ϨδελΛ਺ݸୟ͘͘Β͍Ͱ͸ 64#͸͠Ό΂Εͳ͍

  45. ෼ް͍64#ͷ࢓༷ॻͱ
 ΍΍ް͍64#)*%ͷ࢓༷ॻͱ
 Ϋι෼ް͍45.ͷ࢓༷ॻΛಡΜͰ ద੾ͳϨδελɾϝϞϦΛ
 ͨ͘͞ΜಡΈॻ͖͢ΔίʔυΛॻ͘ඞཁΞϦ

  46. ࣮૷͠·ͨ͠

  47. 64#)*%࣮૷΍Γ͔ͨ w 64#ͷ࢓༷ΛಡΉ w 64#)*%$MBTTͷ࢓༷ΛಡΉ w 45.'ͷϚχϡΞϧΛಡΉ w ͕ۭ݀͘΄ͲಡΉ w

    MJCPQFODNͷίʔυΛࢀߟʹ͢Δ w 3VTUͰॻ͘ˠϩδΞφͰݟΔˠ௚͢ w ҎԼ܁Γฦ͠
  48. Զ͸Ӧۀ೔͘Β͍͔͔ͬͨ

  49. ͜͜ͰϩδΞφ Demo

  50. 3VTUؔ܎ͳ͍ؾ͕͢Δͳ

  51. ίʔυยΛͪΐͬͱ঺հ

  52. 64#ͷ௨৴Ͱ࢖͏όοϑΝ

  53. https://www.stmcu.jp/design/document/reference_manual/51428/ IUUQTXXXTUNDVKQEFTJHOEPDVNFOUSFGFSFODF@NBOVBM

  54. ͜ΕΛ͍͍ײ͡ʹϞσϦϯά

  55. None
  56. VolatileCell

  57. VolatileCell w ϝϞϦ΁ͷWPMBUJMFΞΫηεΛ w ͍͍ײ͡ʹ͢ΔϥΠϒϥϦ w std::ptr::read_volatileͱ͔͸unsafeͰࠔΔ

  58. MJCPQFODNΛ
 ࢀߟʹ͸͕ͨ͠ʜʜ

  59. 3VTUಛ༗ͷ೉͠͞ w ϓϩτίϧͷ࣮૷͸εςʔτϚγϯʹͳΓ͕ͪ w εςʔτΛܕ҆શʹ͢Δͷ͸ͪΐͬͱίπ͕͍Δ w งғؾͰߏ଄࡞Δͱ్தͰ٧Ή w ݩͷ࣮૷ΛಡΜͰ $ͷࡶ͞ʹΩϨΔ

  60. None
  61. None
  62. ͠Γ͖ΕͱΜ΅