Programming embedded systems applications involve writing concurrent, event-driven and timing-aware programs. Traditionally, such programs are written in low-level 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.
翻译:嵌入式系统应用程序包含同时写、事件驱动和时间感识程序。 传统上, 此类程序是用C 或 American 等低级别的机器导向编程语言撰写的。 我们通过引入 Synchron (CML) 推出一个替代方案, 向程序员提供高层次的抽象信息, 同时在相关的运行时制和一次性努力驱动器中支持低层次基础设施。 嵌入式系统应用程序具有以下一般特征:(i) 同时、 以事件驱动和时间感知程序。 为了解决其中每一个问题, Synchron API 由三个部分组成:(1) 同步 ML (CML) 受启发的信息传动控制控制控制控制控制控制控制控制系统( Cych-proach ) 运行Sypreformal- milleralM 系统。 我们通过TnyTimberM 服务器运行Syral-RM 运行系统, 运行Syral-M Ral- mal- syal-hold 运行系统。