Higher-Order Concurrency for Microcontrollers
Paper i proceeding, 2021

Programming microcontrollers involves low-level interfacing with hardware and peripherals that are concurrent and reactive. Such programs are typically written in a mixture of C and assembly using concurrent language extensions (like FreeRTOS tasks and semaphores), resulting in unsafe, callback-driven, error-prone and difficult-to-maintain code.

We address this challenge by introducing SenseVM - a bytecode-interpreted virtual machine that provides a message-passing based higher-order concurrency model, originally introduced by Reppy, for microcontroller programming. This model treats synchronous operations as first-class values (called Events) akin to the treatment of first-class functions in functional languages. This primarily allows the programmer to compose and tailor their own concurrency abstractions and additionally, abstracts away unsafe memory operations, common in shared-memory concurrency models, thereby making microcontroller programs safer, composable and easier-to-maintain.

Our VM is made portable via a low-level bridge interface, built atop the embedded OS - Zephyr. The bridge is implemented by all drivers and designed such that programming in response to a software message or a hardware interrupt remains uniform and indistinguishable. In this paper we demonstrate the features of our VM through an example, written in a Caml-like functional language, running on the nRF52840 and STM32F4 microcontrollers.

concurrency

virtual machine

microcontroller

Functional Programming

Författare

Abhiroop Sarkar

Chalmers, Data- och informationsteknik, Funktionell programmering

Robert Krook

Chalmers, Data- och informationsteknik, Funktionell programmering

Joel Svensson

Chalmers, Data- och informationsteknik, Funktionell programmering

Mary Sheeran

Chalmers, Data- och informationsteknik, Funktionell programmering

MPLR 2021 - Proceedings of the 18th ACM SIGPLAN International Conference on Managed Programming Languages and Runtimes

26-36
9781450386753 (ISBN)

18th ACM SIGPLAN International Conference on Managed Programming Languages and Runtimes, MPLR 2021
Münster, Germany,

Octopi: Säker Programering för Sakernas Internet

Stiftelsen för Strategisk forskning (SSF) (RIT17-0023), 2018-03-01 -- 2023-02-28.

Ämneskategorier

Datorteknik

Inbäddad systemteknik

Datorsystem

Styrkeområden

Informations- och kommunikationsteknik

DOI

10.1145/3475738.3480716

ISBN

9781450386753

Mer information

Senast uppdaterat

2023-04-21