updatesssss
[phd-thesis.git] / top / top.tex
index d777559..63151d3 100644 (file)
 \label{chp:top4iot}
 \todo{betere chapter naam}
 \begin{chapterabstract}
-       This chapter introduces \gls{MTASK} and puts it into perspective compared to traditional microprocessor programming.
-       It does so by showing how to program microprocessors using \gls{ARDUINO}, a popular microprocessor framework, and the equivalent \gls{MTASK} programs.
+       This chapter introduces \gls{MTASK} and puts it into perspective compared to traditional microcontroller programming.
+       It does so by showing how to program microcontrollers using \gls{ARDUINO}, a popular microcontroller framework, and the equivalent \gls{MTASK} programs.
 \end{chapterabstract}
 
-The edge layer of \gls{IOT} system mostly consists of microprocessors that require a different method of programming.
-Usually, programming microprocessors requires an elaborate multi-step toolchain of compilation, linkage, binary image creation, and burning this image onto the flash memory of the microprocessor in order to compile and run a program.
+The edge layer of \gls{IOT} system mostly consists of microcontrollers that require a different method of programming.
+Usually, programming microcontrollers requires an elaborate multi-step toolchain of compilation, linkage, binary image creation, and burning this image onto the flash memory of the microcontroller in order to compile and run a program.
 The programs are usually cyclic executives instead of tasks running in an operating system, i.e.\ there is only a single task that continuously runs on the bare metal.
-Each type of microprocessors comes with vendor-provided drivers, compilers and \glspl{RTS} but there are many platform that abstract away from this such as \gls{MBED} and \gls{ARDUINO} of which \gls{ARDUINO} is specifically designed for education and prototyping and hence used here.
-The popular \gls{ARDUINO} \gls{C}\slash\gls{CPP} dialect and accompanying libraries provide an abstraction layer for common microprocessor behaviour allowing the programmer to program multiple types of microprocessors using a single language.
+Each type of microcontrollers comes with vendor-provided drivers, compilers and \glspl{RTS} but there are many platform that abstract away from this such as \gls{MBED} and \gls{ARDUINO} of which \gls{ARDUINO} is specifically designed for education and prototyping and hence used here.
+The popular \gls{ARDUINO} \gls{C}\slash\gls{CPP} dialect and accompanying libraries provide an abstraction layer for common microcontroller behaviour allowing the programmer to program multiple types of microcontrollers using a single language.
 Originally it was designed for the in-house developed open-source hardware with the same name but the setup allows porting to many architectures.
 It provides an \gls{IDE} and toolchain automation to perform all steps of the toolchain with a single command.
 
 \section{Hello world!}
 Traditionally, the first program that one writes when trying a new language is the so called \emph{Hello World!} program.
 This program has the single task of printing the text \emph{Hello World!} to the screen and exiting again, useful to become familiarised with the syntax and verify that the toolchain and runtime environment is working.
-On microprocessors, there usually is no screen for displaying text.
+On microcontrollers, there usually is no screen for displaying text.
 Nevertheless, almost always there is a built-in monochrome $1\times1$ pixel screen, namely an \gls{LED}.
-The \emph{Hello World!} equivalent on microprocessors blinks this \gls{LED}.
+The \emph{Hello World!} equivalent on microcontrollers blinks this \gls{LED}.
 
 \Cref{lst:arduinoBlink} shows how the logic of a blink program might look when using \gls{ARDUINO}'s \gls{C}\slash\gls{CPP} dialect.
 Every \gls{ARDUINO} program contains a \arduinoinline{setup} and a \arduinoinline{loop} function.
@@ -101,7 +101,7 @@ To overcome this, it is necessary to slice up the blinking behaviour in very sma
 Listing~\ref{lst:blinkthread} shows how three different blinking patterns might be achieved in \gls{ARDUINO} using the slicing method.
 If we want the blink function to be a separate parametrizable function we need to explicitly provide all references to the required state.
 Furthermore, the \arduinoinline{delay} function can not be used and polling \arduinoinline{millis} is required.
-The \arduinoinline{millis} function returns the number of milliseconds that have passed since the boot of the microprocessor.
+The \arduinoinline{millis} function returns the number of milliseconds that have passed since the boot of the microcontroller.
 Some devices use very little energy when in \arduinoinline{delay} or sleep state.
 Resulting in \arduinoinline{millis} potentially affects power consumption since the processor is basically busy looping all the time.
 In the simple case of blinking three \glspl{LED} on fixed intervals, it might be possible to calculate the delays in advance using static analysis and generate the appropriate \arduinoinline{delay} code.
@@ -155,7 +155,7 @@ blinktask =
 
 \section{\texorpdfstring{\Gls{MTASK}}{MTask} history}
 \subsection{Generating \texorpdfstring{\gls{C}/\gls{CPP}}{C/C++} code}
-A first throw at a class-based shallowly \gls{EDSL} for microprocessors was made by \citet{plasmeijer_shallow_2016}.
+A first throw at a class-based shallowly \gls{EDSL} for microcontrollers was made by \citet{plasmeijer_shallow_2016}.
 The language was called \gls{ARDSL} and offered a type safe interface to \gls{ARDUINO} \gls{CPP} dialect.
 A \gls{CPP} code generation backend was available together with an \gls{ITASK} simulation backend.
 There was no support for tasks or even functions.
@@ -175,7 +175,7 @@ Moreover, a course on the \gls{MTASK} simulator was provided at the 2018 \gls{CE
 The \gls{MTASK} language as it is now was introduced in 2018 \citep{koopman_task-based_2018}.
 This paper updated the language to support functions, tasks and \glspl{SDS} but still compiled to \gls{CPP} \gls{ARDUINO} code.
 Later the bytecode compiler and \gls{ITASK} integration was added to the language \citep{lubbers_interpreting_2019}.
-Moreover, it was shown that it is very intuitive to write microprocessor applications in a \gls{TOP} language \citep{lubbers_multitasking_2019}.
+Moreover, it was shown that it is very intuitive to write microcontroller applications in a \gls{TOP} language \citep{lubbers_multitasking_2019}.
 One reason for this is that a lot of design patterns that are difficult using standard means are for free in \gls{TOP} (e.g.\ multithreading).
 In 2019, the \gls{CEFP} summer school in Budapest, Hungary hosted a course on developing \gls{IOT} applications with \gls{MTASK} as well \citep{lubbers_writing_2019}.
 
@@ -200,7 +200,7 @@ Currently, power efficiency behaviour of traditional versus \gls{TOP} \gls{IOT}
 This chapter serves as a complete guide to the \gls{MTASK} language, from an \gls{MTASK} programmer's perspective.
 \end{chapterabstract}
 
-The \gls{MTASK} system is a complete \gls{TOP} programming environment for programming microprocessors.
+The \gls{MTASK} system is a complete \gls{TOP} programming environment for programming microcontrollers.
 It is implemented as an \gls{EDSL} in \gls{CLEAN} using class-based---or tagless-final---embedding (see \cref{sec:tagless-final_embedding}).
 
 Due to the nature of the embedding technique, it is possible to have multiple views on-programs written in the \gls{MTASK} language.
@@ -216,17 +216,17 @@ The following interpretations are available for \gls{MTASK}.
        \item[Byte code compiler]
 
                The compiler compiles the \gls{MTASK} program at runtime to a specialised byte code.
-               Using a handful of integration functions and tasks, \gls{MTASK} tasks can be executed on microprocessors and integrated in \gls{ITASK} as if they were regular \gls{ITASK} tasks.
+               Using a handful of integration functions and tasks, \gls{MTASK} tasks can be executed on microcontrollers and integrated in \gls{ITASK} as if they were regular \gls{ITASK} tasks.
                Furthermore, with special language constructs, \glspl{SDS} can be shared between \gls{MTASK} and \gls{ITASK} programs.
 \end{description}
 
 When using the compiler interpretation in conjunction with the \gls{ITASK} integration, \gls{MTASK} is a heterogeneous \gls{DSL}.
-I.e.\ some components---e.g.\ the \gls{RTS} on the microprocessor---is largely unaware of the other components in the system, and it is executed on a completely different architecture.
+I.e.\ some components---e.g.\ the \gls{RTS} on the microcontroller---is largely unaware of the other components in the system, and it is executed on a completely different architecture.
 The \gls{MTASK} language is an enriched simply-typed $\lambda$-calculus with support for some basic types, arithmetic operations, and function definition; and a task language (see \cref{sec:top}).
 
 \section{Types}
 To leverage the type checker of the host language, types in the \gls{MTASK} language are expressed as types in the host language, to make the language type safe.
-However, not all types in the host language are suitable for microprocessors that may only have \qty{2}{\kibi\byte} of \gls{RAM} so class constraints are therefore added to the \gls{DSL} functions.
+However, not all types in the host language are suitable for microcontrollers that may only have \qty{2}{\kibi\byte} of \gls{RAM} so class constraints are therefore added to the \gls{DSL} functions.
 The most used class constraint is the \cleaninline{type} class collection containing functions for serialization, printing, \gls{ITASK} constraints \etc.
 Many of these functions can be derived using generic programming.
 An even stronger restriction on types is defined for types that have a stack representation.
@@ -423,7 +423,7 @@ swapTuple =
 \Gls{MTASK}'s task language can be divided into three categories, namely
 \begin{enumerate*}
        \item Basic tasks, in most \gls{TOP} systems, the basic tasks are called editors, modelling the interactivity with the user.
-               In \gls{MTASK}, there are no \emph{editors} in that sense but there is interaction with the outside world through microprocessor peripherals such as sensors and actuators.
+               In \gls{MTASK}, there are no \emph{editors} in that sense but there is interaction with the outside world through microcontroller peripherals such as sensors and actuators.
        \item Task combinators provide a way of describing the workflow.
                They combine one or more tasks into a compound task.
        \item \glspl{SDS} in \gls{MTASK} can be seen as references to data that can be shared using many-to-many communication and are only accessible from within the task language to ensure atomicity.
@@ -482,7 +482,7 @@ measureTemp = DHT (DHT_SHT (i2c 0x36)) \dht->
 
 \Gls{GPIO} access is divided into three classes: analog, digital and pin modes.
 For all pins and pin modes an \gls{ADT} is available that enumerates the pins.
-The analog \gls{GPIO} pins of a microprocessor are connected to an \gls{ADC} that translates the voltage to an integer.
+The analog \gls{GPIO} pins of a microcontroller are connected to an \gls{ADC} that translates the voltage to an integer.
 Analog \gls{GPIO} pins can be either read or written to.
 Digital \gls{GPIO} pins only report a high or a low value.
 The type class definition is a bit more complex since analog \gls{GPIO} pins can be used as digital \gls{GPIO} pins as well.
@@ -746,7 +746,7 @@ class liftsds v where
 \label{chp:implementation}
 \begin{chapterabstract}
        This chapter shows the implementation of the \gls{MTASK} system.
-       It is threefold: first it shows the implementation of the byte code compiler for \gls{MTASK}'s \gls{TOP} language, then is details of the implementation of \gls{MTASK}'s \gls{TOP} engine that executes the \gls{MTASK} tasks on the microprocessor, and finally it shows how the integration of \gls{MTASK} tasks and \glspl{SDS} is implemented both on the server and on the device.
+       It is threefold: first it shows the implementation of the byte code compiler for \gls{MTASK}'s \gls{TOP} language, then is details of the implementation of \gls{MTASK}'s \gls{TOP} engine that executes the \gls{MTASK} tasks on the microcontroller, and finally it shows how the integration of \gls{MTASK} tasks and \glspl{SDS} is implemented both on the server and on the device.
 \end{chapterabstract}
 IFL19 paper, bytecode instructieset~\cref{chp:bytecode_instruction_set}