Skip to content

Clarify std vs no-std #148

Closed
Closed
@Timmmm

Description

@Timmmm

The book currently says:

When You Might Want to Use the Core Library (no_std)

  1. Small memory footprint: If your embedded system has limited resources and needs to have a small memory footprint, you will likely want to use bare-metal because std features add a significant amount of final binary size and compilation time.
  2. Direct hardware control: If your embedded system requires more direct control over the hardware, such as low-level device drivers or access to specialized hardware features you will likely want to use bare-metal because std adds abstractions that can make it harder to interact directly with the hardware.
  3. Real-time constraints or time-critical applications: If your embedded system requires real-time performance or low-latency response times because std can introduce unpredictable delays and overhead that can affect real-time performance.
  4. Custom requirements: bare-metal allows more customization and fine-grained control over the behavior of an application, which can be useful in specialized or non-standard environments.

Are these really true?

  1. As I understand it, esp32-rs uses build-std which (when using LTO) should allow unused code to be eliminated (tbf I haven't tested this).
  2. Low level device drivers can surely work fine with std - any abstractions it adds (I guess you're thinking stuff like filesystem access?) are surely optional?
  3. I guess this is talking about multithreading? But is there really any overhead if you never spawn more than one thread?
  4. Seems pretty nebulous?

I'm sure there are reasons to use no_std but these descriptions didn't really convince me. More specifics would be great here!

It would also be great if there was a section on which parts of std are implemented. Seems like threads are? Presumably std::fs isn't, etc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions