rust-embedded / rust-embedded/cortex-m

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

Open
#473 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

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.

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 by reviewing the existing entry and exception macros in cortex-m-rt and the pin-project-lite approach referenced in the issue. Clarify whether this should be a new cortex-m-rt-lite crate or a cortex-m-rt feature, then define how the shown entry! and exception! examples would work without proc-macro dependencies.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
embedded-iot
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.