rust-embedded / rust-embedded/cortex-m

Update __pre_init docs in cortex-m-rt to suggest use of naked ASM fn

Open
#618 0 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
1k
Forks
202
Avg merge
6d 2h
Merged PRs (30d)
2

Description

https://docs.rs/cortex-m-rt/0.7.5/cortex_m_rt/#features

A #[pre_init] macro is also provided to run a function before RAM initialisation, but its use is deprecated as it is not defined behaviour to execute Rust code before initialisation. It is still possible to create a custom pre_init function using assembly.

I think it might be better advice to recommend a naked function, now that we have them.
https://blog.rust-lang.org/2025/07/03/stabilizing-naked-functions/

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the docs.rs cortex-m-rt features section and the linked #[pre_init] documentation, then review the linked Rust naked-functions announcement for the current guidance. Update the pre_init advice to recommend a naked assembly function where appropriate, while retaining the warning about running Rust code before RAM initialization.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
embedded-iot
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.