3 Project structure and configuration
This chapter covers
- Embedded Rust project structure overview
- Cargo file configurations (
Cargo.toml,Cargo.lock, the optionalEmbed.toml) - Build system and linker script configuration (
.cargo/config.toml,memory.x, the optionalbuild.rs) - Managing features and dependencies using Cargo
- Configuring Rust for
no_stdembedded environments and using common PACs and HALs
Chapter 2 detailed the setup of an embedded Rust development environment and introduced the essential tools involved. We saw that a pragmatic approach can be used to establish the basic project structure. In particular, using the cargo generate sub-command together with a suitable project template allows us to get up and running quickly. Naturally, the depth and quality of the resulting project depend heavily on the quality of the chosen template. It is not uncommon for such templates to become outdated when their authors stop maintaining them. As a consequence, embedded Rust developers eventually need to build a more thorough understanding of how to structure a project manually. Building directly upon these foundations, Chapter 3 will explore the manual process of structuring and configuring embedded Rust projects in greater depth.