cortex-m icon indicating copy to clipboard operation
cortex-m copied to clipboard

Consider adding declarative macros in `cortex-m-rt`

Open rjsberry opened this issue 2 years ago • 0 comments

It would be great to have a "lite" version of the macros in cortex-m-rt which are written without proc-macro and related dependencies. For smaller applications which do not have a lot of crates in their dependency graphs this would be a nice way to reduce compile times a bit.

This would be a similar to what pin-project-lite is to pin-project. There is probably a discussion around whether this warrants a new crate (such as cortex-m-rt-lite) or simply a feature flag in cortex-m-rt to swap between procedural and declarative macro implementations.

This would allow users to write code like:

#![no_main]
#![no_std]

extern crate panic_halt;

use cortex_m_rt_lite::{entry, exception};

entry! {
    fn main() -> ! {
        // init...

        loop {
            // app logic...
        }
    }
}

exception! {
    fn SysTick() {
        // ...
    }
}

If you broadly agree with the change I'd be happy to implement it and submit a PR.

rjsberry avatar Feb 27 '23 14:02 rjsberry