Skip to content

Replace custom #[entry] spinlock code with pre-init function #945

@thejpster

Description

@thejpster

We use custom code in the #[entry] macro to unlock the spinlocks on start-up. But, if you use rtic, you don't use macro and the spinlocks can remain locked (see knurling-rs/defmt#975 for real-world consequences).

embassy rp-rs uses a _pre_init function to clear all the locks, which is executed by cortex-m-rt before main and regardless of which mechanism you use to get to main. See https://github.com/embassy-rs/embassy/blob/main/embassy-rp/src/lib.rs#L633. However, a pre-init function written in Rust is UB, so we should probably write it in assembly language.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions