b556398892c4ef591f06952eb3acb4a0e5ae12de
[msc-thesis1617.git] / methods.arch.tex
1 \section{Architecture}
2 \subsection{Devices}
3 The client code for the devices is compiled from one codebase. For a device to
4 be eligible for \glspl{mTask} it must be able to compile the shared codebase
5 and implement (part of) the device specific interface. The shared codebase only
6 uses standard \gls{C} and no special libraries or tricks are used. Therefore
7 the code is compilable for almost any device or system. Note that it is not
8 needed to implement a full interface. The full interface excluding the device
9 specific settings is listed in Appendix~\ref{app:device-interface}. The
10 interface works in a similar fashion as the \gls{EDSL}. Devices do not have to
11 implement all functionality, this is analogous to the fact that views do not
12 have to implement all type classes in the \gls{EDSL}. When the device connects
13 for the first time with a server the specifications of what is implemented is
14 communicated.
15
16 At the time of writing the following device families are supported and can run
17 the device software.
18 \begin{itemize}
19 \item \texttt{POSIX} compatible systems
20
21 This includes systems running \emph{Linux} and \emph{MacOS}.
22 \item \texttt{STM32} family microcontrollers supported by \texttt{ChibiOS}.
23
24 This is tested in particular on the \texttt{STM32f7x} series \gls{ARM}
25 development board.
26 \item Microcontrollers programmable by the \emph{Arduino} \gls{IDE}.\\
27
28 This does not only include \emph{Arduino} compatible boards but also
29 other boards capable of running \emph{Arduino} code. The code
30 has been found working on the \texttt{ESP8266} powered \emph{NodeMCU}.
31 It is tested on devices as small as the regular \emph{Arduino UNO}
32 board that only boasts a meager \emph{2K} of \emph{RAM}.
33 \end{itemize}
34
35 \subsection{Specification}
36 Devices are stored in a record type and all devices in the system are stored in
37 a \gls{SDS} containing all devices. From the macro settings in the interface
38 file a profile is created for the device that describes the specification. When
39 a connection between the server and a client is established the server will
40 send a request for specification. The client will serialize his specification
41 and send it to the server so that the server knows what the client is capable
42 of. The exact specification is listed in Listing~\ref{lst:devicespec}
43
44 \begin{lstlisting}[language=Clean,label={lst:devicespec},
45 caption={Device specification for \glspl{mTask}}]
46 :: MTaskDeviceSpec =
47 {haveLed :: Bool
48 ,haveAio :: Bool
49 ,haveDio :: Bool
50 ,bytesMemory :: Int
51 }
52 \end{lstlisting}
53
54 \subsection{Memory Management}
55 \todo{Explain specification, combine task and share space}
56
57 \subsection{Communication}