Functional Programming for Embedded Systems
Licentiatavhandling, 2022

Embedded Systems application development has traditionally been carried out in low-level machine-oriented programming languages like C or Assembler that can result in unsafe, error-prone and difficult-to-maintain code. Functional programming with features such as higher-order functions, algebraic data types, polymorphism, strong static typing and automatic memory management appears to be an ideal candidate to address the issues with low-level languages plaguing embedded systems.

However, embedded systems usually run on heavily memory-constrained devices with memory in the order of hundreds of kilobytes and applications running on such devices embody the general characteristics of being (i) I/O- bound, (ii) concurrent and (iii) timing-aware. Popular functional language compilers and runtimes either do not fare well with such scarce memory resources or do not provide high-level abstractions that address all the three listed characteristics.

This work attempts to address this gap by investigating and proposing high-level abstractions specialised for I/O-bound, concurrent and timing-aware embedded-systems programs. We implement the proposed abstractions on eagerly-evaluated, statically-typed functional languages running natively on microcontrollers. Our contributions are divided into two parts -

Part 1 presents a functional reactive programming language - Hailstorm - that tracks side effects like I/O in its type system using a feature called resource types. Hailstorm’s programming model is illustrated on the GRiSP microcontroller board.

Part 2 comprises two papers that describe the design and implementation of Synchron, a runtime API that provides a uniform message-passing framework for the handling of software messages as well as hardware interrupts. Additionally, the Synchron API supports a novel timing operator to capture the notion of time, common in embedded applications. The Synchron API is implemented as a virtual machine - SynchronVM - that is run on the NRF52 and STM32 microcontroller boards. We present programming examples that illustrate the concurrency, I/O and timing capabilities of the VM and provide various benchmarks on the response time, memory and power usage of SynchronVM.

Embedded Systems

Timing

Concurrency

Functional Programming

Virtual Machine

Language Runtime

EDIT Analysen (Floor 3);
Opponent: Jeremy Singer, University of Glasgow, Scotland

Författare

Abhiroop Sarkar

Chalmers, Data- och informationsteknik, Funktionell programmering

Hailstorm : A Statically-Typed, Purely Functional Language for IoT Applications

Proceedings of the 22nd ACM SIGPLAN International Conference on Principles and Practice of Declarative Programming,;(2020)

Paper i proceeding

Higher-Order Concurrency for Microcontrollers

Proceedings of the 18th ACM SIGPLAN International Conference on Managed Programming Languages and Runtimes,;(2021)p. 26-36

Paper i proceeding

Synchron - An API and Runtime for Embedded Systems

Leibniz International Proceedings in Informatics, LIPIcs,;Vol. 222(2022)p. 17:1-17:28

Paper i proceeding

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

Drivkrafter

Innovation och entreprenörskap

Utgivare

Chalmers

EDIT Analysen (Floor 3);

Online

Opponent: Jeremy Singer, University of Glasgow, Scotland

Mer information

Senast uppdaterat

2022-05-17