liveBook · Manning

Entry point

As explained in Embedded Software with Rust

The function or location at which execution begins for a program or runtime path.

An entry point is where firmware begins running user code. After reset, the reset handler performs minimal initialization and transfers control to it. User code then owns the program’s flow, often running a main loop or yielding to an executor. section 1.2.3

In bare-metal Rust, hosted `fn main()` depends on a standard-library startup path that assumes a host environment. A `no_std` program disables that path and supplies an entry recognized by the linker, such as `_start` or a linker `ENTRY` setting. A non-returning panic handler must also be provided. section 1.3.2 section 4.4.2

#[unsafe(no_mangle)]
pub unsafe extern "C" fn _start() -> ! {
    // Application initialization tasks
    // Just like the reset handler

    main();

    loop {}
}

See a linker-visible `_start` function that calls application logic and then remains in a loop. section 4.4.2

How Embedded Software with Rust covers it

How deep it goes
Explains reset-to-entry flow and linker-recognized `_start` setup, but does not detail all target-specific startup mechanisms.
Examples
Uses `_start` functions that loop or call `main`, alongside a panic handler.
What it assumes
Explains why hosted `fn main()` cannot serve as a bare entry in `no_std` firmware.
What you can do after
Build it from scratch: define a linker-visible `_start` function, disable hosted startup, and provide a non-returning panic handler.
How it connects
Connects reset handlers, `no_std`, linkers, panic handlers, main loops, and executors.

Also explained in

Compare how 14 books explain entry point →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Embedded Software with Rust. The section links point to the parts of the book it draws on.