Synchron - An API and Runtime for Embedded Systems

Authors Abhiroop Sarkar , Bo Joel Svensson , Mary Sheeran



PDF
Thumbnail PDF

File

LIPIcs.ECOOP.2022.17.pdf
  • Filesize: 1.34 MB
  • 29 pages

Document Identifiers

Author Details

Abhiroop Sarkar
  • Chalmers University of Technology, Gothenburg, Sweden
Bo Joel Svensson
  • Chalmers University of Technology, Gothenburg, Sweden
Mary Sheeran
  • Chalmers University of Technology, Gothenburg, Sweden

Cite As Get BibTex

Abhiroop Sarkar, Bo Joel Svensson, and Mary Sheeran. Synchron - An API and Runtime for Embedded Systems. In 36th European Conference on Object-Oriented Programming (ECOOP 2022). Leibniz International Proceedings in Informatics (LIPIcs), Volume 222, pp. 17:1-17:29, Schloss Dagstuhl – Leibniz-Zentrum für Informatik (2022) https://doi.org/10.4230/LIPIcs.ECOOP.2022.17

Abstract

Programming embedded applications involves writing concurrent, event-driven and timing-aware programs. Traditionally, such programs are written in machine-oriented programming languages like C or Assembly. We present an alternative by introducing Synchron, an API that offers high-level abstractions to the programmer while supporting the low-level infrastructure in an associated runtime system and one-time-effort drivers. 
Embedded systems applications exhibit the general characteristics of being (i) concurrent, (ii) I/O-bound and (iii) timing-aware. To address each of these concerns, the Synchron API consists of three components - (1) a Concurrent ML (CML) inspired message-passing concurrency model, (2) a message-passing-based I/O interface that translates between low-level interrupt based and memory-mapped peripherals, and (3) a timing operator, syncT, that marries CML’s sync operator with timing windows inspired from the TinyTimber kernel. 
We implement the Synchron API as the bytecode instructions of a virtual machine called SynchronVM. SynchronVM hosts a Caml-inspired functional language as its frontend language, and the backend of the VM supports the STM32F4 and NRF52 microcontrollers, with RAM in the order of hundreds of kilobytes. We illustrate the expressiveness of the Synchron API by showing examples of expressing state machines commonly found in embedded systems. The timing functionality is demonstrated through a music programming exercise. Finally, we provide benchmarks on the response time, jitter rates, memory, and power usage of the SynchronVM.

Subject Classification

ACM Subject Classification
  • Computer systems organization → Embedded software
  • Software and its engineering → Runtime environments
  • Computer systems organization → Real-time languages
  • Software and its engineering → Concurrent programming languages
Keywords
  • real-time
  • concurrency
  • functional programming
  • runtime
  • virtual machine

Metrics

  • Access Statistics
  • Total Accesses (updated on a weekly basis)
    0
    PDF Downloads

References

  1. WAMR - WebAssembly Micro Runtime, 2019. URL: https://github.com/bytecodealliance/wasm-micro-runtime.
  2. Synchron Virtual Machine, 2022. URL: https://github.com/SynchronVM/SynchronVM.
  3. Thomas W. Barr and Scott Rixner. Medusa: Managing Concurrency and Communication in Embedded Systems. In Garth Gibson and Nickolai Zeldovich, editors, 2014 USENIX Annual Technical Conference, USENIX ATC '14, Philadelphia, PA, USA, June 19-20, 2014, pages 439-450. USENIX Association, 2014. URL: https://www.usenix.org/conference/atc14/technical-sessions/presentation/barr.
  4. Gérard Berry and Manuel Serrano. Hiphop.js: (A)Synchronous reactive web programming. In Alastair F. Donaldson and Emina Torlak, editors, Proceedings of the 41st ACM SIGPLAN International Conference on Programming Language Design and Implementation, PLDI 2020, London, UK, June 15-20, 2020, pages 533-545. ACM, 2020. URL: https://doi.org/10.1145/3385412.3385984.
  5. Davide Bettio. AtomVM, 2017. URL: https://github.com/bettio/AtomVM.
  6. Andrew P Black, Magnus Carlsson, Mark P Jones, Richard Kieburtz, and Johan Nordlander. Timber: A programming language for real-time embedded systems. Technical report, OGI School of Science and Engineering, Oregon Health and Sciences University, Technical Report CSE 02-002. April 2002, 2002. Google Scholar
  7. Guy Cousineau, Pierre-Louis Curien, and Michel Mauny. The Categorical Abstract Machine. In Jean-Pierre Jouannaud, editor, Functional Programming Languages and Computer Architecture, FPCA 1985, Nancy, France, September 16-19, 1985, Proceedings, volume 201 of Lecture Notes in Computer Science, pages 50-64. Springer, 1985. URL: https://doi.org/10.1007/3-540-15975-4_29.
  8. Robert de Simone, Jean-Pierre Talpin, and Dumitru Potop-Butucaru. The Synchronous Hypothesis and Synchronous Languages. In Richard Zurawski, editor, Embedded Systems Handbook. CRC Press, 2005. URL: https://doi.org/10.1201/9781420038163.ch8.
  9. Ahmed Elhasairi and Alexandre N. Pechev. Humanoid Robot Balance Control Using the Spherical Inverted Pendulum Mode. Frontiers Robotics AI, 2:21, 2015. URL: https://doi.org/10.3389/frobt.2015.00021.
  10. Trevor Elliott, Lee Pike, Simon Winwood, Patrick C. Hickey, James Bielman, Jamey Sharp, Eric L. Seidel, and John Launchbury. Guilt free ivory. In Ben Lippmeier, editor, Proceedings of the 8th ACM SIGPLAN Symposium on Haskell, Haskell 2015, Vancouver, BC, Canada, September 3-4, 2015, pages 189-200. ACM, 2015. URL: https://doi.org/10.1145/2804302.2804318.
  11. Zephyr examples. Zephyr button blinky, 2021. URL: https://pastecode.io/s/szpf673u.
  12. Damien George. Micropython, 2014. URL: https://micropython.org/.
  13. R. Kingsy Grace and S. Manju. A Comprehensive Review of Wireless Sensor Networks Based Air Pollution Monitoring Systems. Wirel. Pers. Commun., 108(4):2499-2515, 2019. URL: https://doi.org/10.1007/s11277-019-06535-3.
  14. Niels Hallenberg, Martin Elsman, and Mads Tofte. Combining Region Inference and Garbage Collection. In Jens Knoop and Laurie J. Hendren, editors, Proceedings of the 2002 ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI), Berlin, Germany, June 17-19, 2002, pages 141-152. ACM, 2002. URL: https://doi.org/10.1145/512529.512547.
  15. Ralf Hinze. The Categorical Abstract Machine: Basics and Enhancements. Technical report, University of Bonn, 1993. Google Scholar
  16. C. A. R. Hoare. Communicating Sequential Processes. Commun. ACM, 21(8):666-677, 1978. URL: https://doi.org/10.1145/359576.359585.
  17. Martin Kero, Pawel Pietrzak, and Johan Nordlander. Live Heap Space Bounds for Real-Time Systems. In Kazunori Ueda, editor, Programming Languages and Systems - 8th Asian Symposium, APLAS 2010, Shanghai, China, November 28 - December 1, 2010. Proceedings, volume 6461 of Lecture Notes in Computer Science, pages 287-303. Springer, 2010. URL: https://doi.org/10.1007/978-3-642-17164-2_20.
  18. Xavier Leroy. The ZINC experiment: an economical implementation of the ML language. PhD thesis, INRIA, 1990. Google Scholar
  19. Per Lindgren, Johan Eriksson, Simon Aittamaa, and Johan Nordlander. TinyTimber, Reactive Objects in C for Real-Time Embedded Systems. In 2008 Design, Automation and Test in Europe, pages 1382-1385, 2008. URL: https://doi.org/10.1109/DATE.2008.4484933.
  20. Tommi Mikkonen and Antero Taivalsaari. Web Applications - Spaghetti Code for the 21st Century. In Walter Dosch, Roger Y. Lee, Petr Tuma, and Thierry Coupaye, editors, Proceedings of the 6th ACIS International Conference on Software Engineering Research, Management and Applications, SERA 2008, 20-22 August 2008, Prague, Czech Republic, pages 319-328. IEEE Computer Society, 2008. URL: https://doi.org/10.1109/SERA.2008.16.
  21. Johan Nordlander. Programming with the TinyTimber kernel. Luleå tekniska universitet, 2007. Google Scholar
  22. Lee Pike, Alwyn Goodloe, Robin Morisset, and Sebastian Niller. Copilot: A Hard Real-Time Runtime Monitor. In Howard Barringer, Yliès Falcone, Bernd Finkbeiner, Klaus Havelund, Insup Lee, Gordon J. Pace, Grigore Rosu, Oleg Sokolsky, and Nikolai Tillmann, editors, Runtime Verification - First International Conference, RV 2010, St. Julians, Malta, November 1-4, 2010. Proceedings, volume 6418 of Lecture Notes in Computer Science, pages 345-359. Springer, 2010. URL: https://doi.org/10.1007/978-3-642-16612-9_26.
  23. Filip Pizlo, Lukasz Ziarek, Petr Maj, Antony L. Hosking, Ethan Blanton, and Jan Vitek. Schism: fragmentation-tolerant real-time garbage collection. In Benjamin G. Zorn and Alexander Aiken, editors, Proceedings of the 2010 ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI 2010, Toronto, Ontario, Canada, June 5-10, 2010, pages 146-159. ACM, 2010. URL: https://doi.org/10.1145/1806596.1806615.
  24. Filip Pizlo, Lukasz Ziarek, and Jan Vitek. Real time Java on resource-constrained platforms with Fiji VM. In M. Teresa Higuera-Toledano and Martin Schoeberl, editors, Proceedings of the 7th International Workshop on Java Technologies for Real-Time and Embedded Systems, JTRES 2009, Madrid, Spain, September 23-25, 2009, ACM International Conference Proceeding Series, pages 110-119. ACM, 2009. URL: https://doi.org/10.1145/1620405.1620421.
  25. John H. Reppy. Concurrent ML: Design, Application and Semantics. In Peter E. Lauer, editor, Functional Programming, Concurrency, Simulation and Automated Reasoning: International Lecture Series 1991-1992, McMaster University, Hamilton, Ontario, Canada, volume 693 of Lecture Notes in Computer Science, pages 165-198. Springer, 1993. URL: https://doi.org/10.1007/3-540-56883-2_10.
  26. Abhiroop Sarkar, Robert Krook, Bo Joel Svensson, and Mary Sheeran. Higher-Order Concurrency for Microcontrollers. In Herbert Kuchen and Jeremy Singer, editors, MPLR '21: 18th ACM SIGPLAN International Conference on Managed Programming Languages and Runtimes, Münster, Germany, September 29-30, 2021, pages 26-35. ACM, 2021. URL: https://doi.org/10.1145/3475738.3480716.
  27. Lui Sha, Ragunathan Rajkumar, and John P. Lehoczky. Priority Inheritance Protocols: An Approach to Real-Time Synchronization. IEEE Trans. Computers, 39(9):1175-1185, 1990. URL: https://doi.org/10.1109/12.57058.
  28. Bhargav Shivkumar, Jeffrey C. Murphy, and Lukasz Ziarek. RTMLton: An SML Runtime for Real-Time Systems. In Ekaterina Komendantskaya and Yanhong Annie Liu, editors, Practical Aspects of Declarative Languages - 22nd International Symposium, PADL 2020, New Orleans, LA, USA, January 20-21, 2020, Proceedings, volume 12007 of Lecture Notes in Computer Science, pages 113-130. Springer, 2020. URL: https://doi.org/10.1007/978-3-030-39197-3_8.
  29. Vincent St-Amour and Marc Feeley. PICOBIT: A Compact Scheme System for Microcontrollers. In Marco T. Morazán and Sven-Bodo Scholz, editors, Implementation and Application of Functional Languages - 21st International Symposium, IFL 2009, South Orange, NJ, USA, September 23-25, 2009, Revised Selected Papers, volume 6041 of Lecture Notes in Computer Science, pages 1-17. Springer, 2009. URL: https://doi.org/10.1007/978-3-642-16478-1_1.
  30. Mads Tofte and Jean-Pierre Talpin. Region-based Memory Management. Inf. Comput., 132(2):109-176, 1997. URL: https://doi.org/10.1006/inco.1996.2613.
  31. Hideyuki Tokuda, Clifford W. Mercer, Yutaka Ishikawa, and Thomas E. Marchok. Priority Inversions in Real-Time Communication. In Proceedings of the Real-Time Systems Symposium - 1989, Santa Monica, California, USA, December 1989, pages 348-359. IEEE Computer Society, 1989. URL: https://doi.org/10.1109/REAL.1989.63587.
  32. Blase Ur, Elyse McManus, Melwyn Pak Yong Ho, and Michael L. Littman. Practical Trigger-Action Programming in the Smart Home. In Matt Jones, Philippe A. Palanque, Albrecht Schmidt, and Tovi Grossman, editors, CHI Conference on Human Factors in Computing Systems, CHI'14, Toronto, ON, Canada - April 26 - May 01, 2014, pages 803-812. ACM, 2014. URL: https://doi.org/10.1145/2556288.2557420.
  33. Steven Varoumas, Benoît Vaugon, and Emmanuel Chailloux. A Generic Virtual Machine Approach for Programming Microcontrollers: the OMicroB Project. In 9th European Congress on Embedded Real Time Software and Systems (ERTS 2018), 2018. Google Scholar
  34. Benjamin Vedder, Jonny Vinter, and Magnus Jonsson. A Low-Cost Model Vehicle Testbed with Accurate Positioning for Autonomous Driving. J. Robotics, 2018:4907536:1-4907536:10, 2018. URL: https://doi.org/10.1155/2018/4907536.
  35. Ge Wang and Perry R. Cook. ChucK: A Concurrent, On-the-fly, Audio Programming Language. In Proceedings of the 2003 International Computer Music Conference, ICMC 2003, Singapore, September 29 - October 4, 2003. Michigan Publishing, 2003. URL: http://hdl.handle.net/2027/spo.bbp2372.2003.055.
  36. Stephen Weeks. Whole-program compilation in MLton. In Andrew Kennedy and François Pottier, editors, Proceedings of the ACM Workshop on ML, 2006, Portland, Oregon, USA, September 16, 2006, page 1. ACM, 2006. URL: https://doi.org/10.1145/1159876.1159877.
  37. Gordon Williams. Espruino, 2012. URL: http://www.espruino.com/.
Questions / Remarks / Feedback
X

Feedback for Dagstuhl Publishing


Thanks for your feedback!

Feedback submitted

Could not send message

Please try again later or send an E-mail