It is important to note that C++20 coroutines were designed primarily for use on desktop and server environments, and not optimized for embedded systems such as AVR. That being said, it is possible to use coroutines on AVR with some limitations and additional requirements.
Compiler support: Coroutines require a compiler that supports C++20 features such as std::coroutine and co_await. Currently, none of the major compilers for AVR (avr-gcc, avr-clang) support these features, so a custom implementation or port may be necessary.
Stack size: Coroutines require a larger stack than regular functions, as they maintain additional state information. AVR devices typically have limited RAM, so ensuring adequate stack space is important.
Context switches: Coroutines rely heavily on context switching, which can be expensive in terms of execution time and memory usage on AVR. Additional optimizations may be required to reduce the cost of context switches.
Use case: It is important to consider whether using coroutines on AVR is the best solution for a given use case. The added complexity and overhead of coroutines may not be necessary for simple applications.
In summary, using C++20 coroutines on AVR requires careful consideration and possible custom implementation. It may not be the most efficient or practical solution in many cases.
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2023-05-18 10:55:02 +0000
Seen: 16 times
Last updated: May 18 '23
What is the method to get a printable output of a C++11 time_point?
What is the process of redefining a c++ macro with fewer parameters?
How can a list be sorted alphabetically within a console application?
How can boost c++11 be used to resolve the symlinks of a file path?
What distinguishes the jsonlite and rjson packages from each other at their core?
How can the issue of accessing a member within an address that is misaligned be resolved at runtime?
Does a C++ constructor get passed down through inheritance?
What is the difference between deallocating memory in C and deallocating memory in C++?