《Rust on ESP 编程指南》
The Rust on ESP Book

原始链接: https://docs.espressif.com/projects/rust/book/

本指南旨在帮助 Rust 开发者——无论其是否有嵌入式开发经验——开始构建适用于乐鑫(Espressif)产品的应用程序。它介绍了乐鑫的软件栈、必备工具以及项目工作流,为进阶开发奠定基础。 本书强调,尽管该生态系统已相当成熟,但仍处于活跃开发阶段。虽然已稳定的模块遵循语义化版本控制(SemVer),但许多组件(如 `esp-hal` 及各类驱动程序)仍被视为不稳定版本。用户在使用这些组件时应预料到会有频繁的更新和潜在的破坏性变更,这与 Rust 的 Nightly 生态特性相符。团队为主要 crate 提供了迁移指南,以帮助应对这些变动。 鼓励读者与社区互动、报告问题,并通过项目仓库为文档做出贡献。通过遵循本指南并利用所提供的资源,您将掌握使用 Rust 在乐鑫硬件上创建安全、高效嵌入式系统所需的知识。

Hacker News 上关于《The Rust on ESP Book》的讨论,凸显了开发者在测试嵌入式代码时面临的挑战。该书建议尽可能在宿主机上进行测试,以简化开发流程。 然而,用户指出这种做法在实践中往往难以实现。常见的障碍包括:Rust 测试框架对 `std` 的依赖,这在 `no_std` 嵌入式环境中会造成冲突;以及许多特定于硬件的 crate(如 `esp-hal`)无法在非目标架构上编译。 评论者指出,这些测试障碍是嵌入式开发中反复出现的问题,但通过 QEMU 进行模拟的项目除外。该讨论贴最后表达了一个共同的愿望,即希望该书的作者能为宿主机测试提供更具体的指导或最佳实践。
相关文章

原文

Welcome to our guide to embedded Rust development on Espressif products. This book is designed to help you get started and become comfortable using our tools and ecosystem. Along the way, we’ll introduce the structure of our software stack, and walk through basic workflows using project generation and tooling. By the end, you’ll be ready to explore more advanced material through our reference documentation and external training resources.

This book is intended for Rust developers who are interested in embedded development, even if they don’t have prior experience with embedded systems. While some familiarity with low-level programming concepts can be helpful, we aim to introduce key ideas as they come up. If you would like to expand your baseline knowledge, consider studying the additional Resources.

While we strive for stability, users should expect periodic modifications as we improve the API, enhance performance, and introduce new features. Modules that are already stabilized will not be subject to breaking changes, in accordance with semantic versioning - SemVer. However, unstable features—such as parts of the esp-hal and certain drivers are actively being developed and are not covered by SemVer guarantees. This means that using these unstable components may break your project with a simple cargo update, much like working with Rust’s nightly compiler. This kind of instability is common across the broader Rust embedded ecosystem, which is still rapidly evolving. Expect frequent changes and track dependencies closely. For all major crates, we provide migration guides between releases to help you stay up to date.

If you’re unfamiliar with certain concepts covered in this book or would like to deepen your understanding, the following resources may be helpful:

The work on this book is coordinated in this repository.

If you encounter difficulties following the instructions or find unclear sections, please report them in the issue tracker. Contributions in the form of pull requests for typo fixes or clarity improvements are always welcome!

If you need help, have questions, or would like to discuss topics related to esp-rs, you can reach out through the following channels:

We hope this book provides you with the knowledge and confidence to build robust, efficient, and safe embedded applications using Rust on Espressif products. Let’s get started!

联系我们 contact @ memedata.com