Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Book] How to modularize & grow your code w/ 1.0 #444

Open
jhillyerd opened this issue Jan 26, 2021 · 4 comments
Open

[Book] How to modularize & grow your code w/ 1.0 #444

jhillyerd opened this issue Jan 26, 2021 · 4 comments

Comments

@jhillyerd
Copy link
Contributor

jhillyerd commented Jan 26, 2021

It's easy to end up with a very large src/main.rs / mod app with RTIC. Having a next steps section with ideas on how to grow and modularize code would be a nice way to end the book.

Could also touch on creating structs for multiple shared resources, and using an impl block to keep their code together.

@perlindgren
Copy link
Collaborator

perlindgren commented Feb 4, 2022

You can use the app just as a binding for entry points using the extern keyword. This allows for modularization of the code.

We are a bit limited by the current procmacro support in Rust. As RTIC needs to perform system-wide analysis all task/resource information needs to be in a single item (the mod).

Food for thought:

You can think of RTIC just as cortex-m-rt, but with the (much needed) addition of race- and deadlock-free concurrency in safe user code.

The message passing, timers etc. are just icing on the cake. One can have other abstractions on top of RTIC, e.g., asynchronous actors or concurrent reactive objects (essentially actors with both synchronous asynchronous communication).

In this sense RTIC is just the lowest level of abstraction needed for building concurrent applications.

@AfoHT
Copy link
Contributor

AfoHT commented Jul 19, 2022

Related to this: Issue #639

@eflukx
Copy link

eflukx commented Jul 19, 2022

The message passing, timers etc. are just icing on the cake. One can have other abstractions on top of RTIC, e.g., asynchronous actors or concurrent reactive objects (essentially actors with both synchronous asynchronous communication).

In this sense RTIC is just the lowest level of abstraction needed for building concurrent applications.

I would be very interested in the available higher level abstractions available the work nicely along RTIC. For example I could use a pub/sub (or event-broadcast) system that 'unlocks'/starts one or more tasks when some event has happened. Think Semaphores/Eventgroups as available in other RTOSses.

Having a (curated) list of available options (maybe even with some example code! 👍🏻) would be of great help to use RTIC in more advanced scenarios (i.e. real world embedded work).

@perlindgren
Copy link
Collaborator

There is an Actor API PR that provides higher level of abstraction (broadcasting).

#537

@AfoHT AfoHT changed the title [Book] How to modularize & grow your code w/ 0.6 [Book] How to modularize & grow your code w/ 1.0 Jul 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants