導入
The Embedded Rust Bookへようこそ。Rustをマイクロコントローラのような、「ベアメタル」の組込みシステムで使うための入門書です。
組込みRustは誰のためのもの
組込みRustは、Rustの高い抽象度と安全性のもと、組込みプログラミングをしたい人のためのものです。 (https://doc.rust-lang.org/book/ch00-00-introduction.html)[Rustは誰のためのもの]も合わせて見て下さい)
スコープ
この本の目的は、以下の通りです。
- 組込みRustをできる限り速く開始できるようにします。すなわち、開発環境のセットアップ方法です。
- 組込み開発におけるRustの現在のベストプラクティスを共有します。つまり、より正しい組込みソフトウェアを書くための、Rustの最善な利用方法です。
- いくつかのケースに対するマニュアルを提供します。例えば、1つのプロジェクト内で、C言語とRustとを混在する方法です。
本書は出来る限り一般的な事項を取り扱います。ただし、説明を簡単にするために、全ての例で、ARM Cortex-Mアーキテクチャを利用します。 読者は、このアーキテクチャに詳しい必要はありません。本書では、アーキテクチャ固有の詳細について、必要に応じて説明をします。
この本は誰のためのもの
本書は、組込み開発か、Rustかのバックグラウンドを持つ人々に向けたものです。しかし、組込みRustに興味がある人なら、誰でも、この本から何かを得られると思います。本書による学習効果を高めるために、事前知識が不足している読者は、「仮定と前提条件」のセクションを読み、不足している知識を補うことをお勧めします。不足知識を補うリソースを見つけるために、「その他のリソース」セクションをチェックすることができます。
仮定と前提条件
- Rustでのプログラミングを楽しんでおり、デスクトップ環境でRustアプリケーションを書いたり、実行したり、デバッグしたりしたことがあることを前提とします。また、本書ではRust 2018を対象とするため、2018 editionのイディオムに慣れ親しんでいる必要があります。
C, C++, Adaといった言語で組込みシステムを開発、デバッグすることに慣れており、次の概念になじみがあることを想定します。
- クロスコンパイル
- メモリマップ方式のペリフェラル
- 割り込み
- I2C、SPI、シリアルといった一般的なインタフェース
その他のリソース
もしあなたが上述した何らかの事項をよく知らない場合、もしくは、本書内の特定トピックに関して、より詳細な情報を知りたい場合、これらのリソースが役に立つでしょう。
| トピック | リソース | 説明 |
|---|---|---|
| Rust | Rust Book | もしRustに親しんでいない場合、この本を読むことを強くお勧めします。 |
| Rust, Embedded | Discovery Book | If you have never done any embedded programming, this book might be a better start |
| Rust, Embedded | Embedded Rust Bookshelf | Rust組込みワーキンググループによるいくらかのリソースがあります。 |
| Rust, Embedded | Embedonomicon | Rustで組込みプログラミングを行うときのより深い詳細が記載されています。 |
| Rust, Embedded | embedded FAQ | 組込みでRustを使う際のよくある質問と回答です。 |
| Rust, Embedded | Comprehensive Rust 🦀: Bare Metal | Teaching material for a 4-day class on bare-metal Rust development |
| Interrupts | Interrupt | - |
| Memory-mapped IO/Peripherals | Memory-mapped I/O | - |
| SPI, UART, RS232, USB, I2C, TTL | Stack Exchange about SPI, UART, and other interfaces | - |
Translations
This book has been translated by generous volunteers. If you would like your translation listed here, please open a PR to add it.
この本はどう使う
この本は、前から順番に読んでいくことを想定しています。後半の章は、前半の章で説明する概念に基づいて成り立っています。前半の章では、トピックの詳細に深入りせず、後半の章で再訪問します。
この本は、ほとんどの例で、STマイクロエレクトロニクスのSTM32F3DISCOVERY開発ボードを使用します。このボードは、ARM Cortex-Mアーキテクチャをベースとしています。基本機能はこのアーキテクチャベースのCPUでは共通です。一方、ペリフェラルとマイクロコントローラ実装の詳細は、他のベンダーと異なります。同じSTマイクロエレクトロニクスのマイクロコントローラファミリでも、違いがあります。
上記の理由から、本書内の例を理解するために、STM32F3DISCOVERY開発ボードを購入することをお勧めします。
Contributing to This Book
The work on this book is coordinated in this repository and is mainly developed by the resources team.
If you have trouble following the instructions in this book or find that some section of the book is not clear enough or hard to follow then that’s a bug and it should be reported in the issue tracker of this book.
Pull requests fixing typos and adding new content are very welcome!
Re-using this material
This book is distributed under the following licenses:
- The code samples and free-standing Cargo projects contained within this book are licensed under the terms of both the MIT License and the Apache License v2.0.
- The written prose, pictures and diagrams contained within this book are licensed under the terms of the Creative Commons CC-BY-SA v4.0 license.
TL;DR: If you want to use our text or images in your work, you need to:
- Give the appropriate credit (i.e. mention this book on your slide, and provide a link to the relevant page)
- Provide a link to the CC-BY-SA v4.0 licence
- Indicate if you have changed the material in any way, and make any changes to our material available under the same licence
Also, please do let us know if you find this book useful!