Git Product home page Git Product logo

Comments (3)

perlindgren avatar perlindgren commented on July 28, 2024

Hi

Is this not a special case to determine (for some reason) that a code block has executed without preemptions? Or in a more general setting, atomic implies that the number of preemptions the code has been exposed to is 0.

This is not currently a notion of RTFM (but can be encoded by hand if so wished by manually inserting some entry code in each handler similarly to your suggestion). Alternatively one could think of exploiting the underlying debugging features (not sure exactly how, but I think there are probing counters for interrupts). If this is to be a feature of RTFM either the OH should be 0 when not used, or explicitly opted in. It would require some changes to RTFM app analysis and code generation.

Regarding the implementation:
What you implement is some sort of double buffering for a consistent view. This can likely NOT be implemented in safe Rust, but can be useful here and in other scenarios. I suggest looking at the lock free implementations of SPSC/MPSC in heapless, perhaps double buffer could go there. (Idea is to access the double buffered state through an atomically updated reference).

Best regards
Per

from rfcs.

jmgao avatar jmgao commented on July 28, 2024

Is this not a special case to determine (for some reason) that a code block has executed without preemptions? Or in a more general setting, atomic implies that the number of preemptions the code has been exposed to is 0.

Correct.

This is not currently a notion of RTFM (but can be encoded by hand if so wished by manually inserting some entry code in each handler similarly to your suggestion).

I might be mistaken, but it seems like you can't actually add any code to handlers used for software tasks. (Instead of supporting this directly, would adding something more general to allow this be preferred instead? Maybe something like #[interrupt_{prologue, epilogue}]? Or something less general, like generating and exposing an interrupt sequence number?)

Alternatively one could think of exploiting the underlying debugging features (not sure exactly how, but I think there are probing counters for interrupts).

I searched for a bit but couldn't find one for the cortex-m3, at least.

If this is to be a feature of RTFM either the OH should be 0 when not used, or explicitly opted in. It would require some changes to RTFM app analysis and code generation.

Gating it behind a feature seems like the easiest option for this.

What you implement is some sort of double buffering for a consistent view. This can likely NOT be implemented in safe Rust, but can be useful here and in other scenarios. I suggest looking at the lock free implementations of SPSC/MPSC in heapless, perhaps double buffer could go there. (Idea is to access the double buffered state through an atomically updated reference).

Sure, a better implementation could commit with a double (or triple) buffer (and avoid blocking interrupts entirely), but that's up to the user. A double/triple buffer allows you to publish a consistent view, this proposal allows you to generate the consistent view that you're publishing to your buffer.

from rfcs.

perlindgren avatar perlindgren commented on July 28, 2024

Any further thoughts on this?

from rfcs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.