Understand the constraints of an esp-generate project
mainProjects generated by esp-generate are designed for Espressif MCUs and follow specific embedded Rust patterns:
- Target Chip Compatibility: Ensure all dependencies, HAL features, and examples remain compatible with the selected target chip (e.g.,
esp32c6). - No Standard Library: These are
#![no_std]and#![no_main]projects. Do not usestd; usecoreand other embedded-friendly crates. - Memory Management:
- If
allocis enabled, the heap is initialized insrc/bin/main.rsusingesp_alloc::heap_allocator!. You can adjust the heap size there if allocations fail. - If
allocis not enabled, avoid heap-backed types likeVec,String,Box, or boxed futures.
- If
- Configuration: Project defaults, target settings, and runner flags are located in
.cargo/config.toml. Use the[env]section for project-specific environment variables rather than hard-coding them in the source code.