C++20 coroutines on microcontrollers - what we learned

Journal Publication ResearchOnline@JCU
Belson, Bruce;Xiang, Wei;Holdsworth, Jason;Philippa, Bronson
Abstract

Coroutines will be added to C++ as part of the C++20 standard. Coroutines provide native language support for asynchronous operations. This study evaluates the C++ coroutine specification from the perspective of embedded systems developers. We find that the proposed language features are generally beneficial but that memory management of the coroutine state needs to be improved. Our experiments on an ARM Cortex-M4microcontroller evaluate the time and memory costs of coroutines in comparison with alternatives, and we show that context switching with coroutines is significantly faster than with thread-based real time operating systems. Furthermore, we analysed the impact of these language features on prototypical IoT sensor software. We find that the proposed language enhancements potentially bring significant benefits to programming in C++ for embedded computers, but that the implementation imposes constraints that may prevent its widespread acceptance among the embedded development community.

Journal

IEEE Embedded Systems Letters

Publication Name

N/A

Volume

13

ISBN/ISSN

1943-0671

Edition

N/A

Issue

1

Pages Count

4

Location

N/A

Publisher

Institute of Electrical and Electronics Engineers

Publisher Url

N/A

Publisher Location

N/A

Publish Date

N/A

Url

N/A

Date

N/A

EISSN

N/A

DOI

10.1109/LES.2020.2973397