.
[msc-thesis1617.git] / arch.devices.tex
index cca4449..32e28fd 100644 (file)
@@ -1,13 +1,13 @@
-A device is suitable for the system if it can run the engine.
+A device is suitable for the system as a client if it can run the engine.
 The engine is compiled from one codebase and devices implement (part of) the
 device specific interface. The shared codebase only uses standard \gls{C} and
 no special libraries or tricks are used. Therefore, the code is compilable for
 almost any device or system. Note that it is not needed to implement a full
 interface. The full interface --- excluding the device specific settings --- is
-listed in Appendix~\ref{app:device-interface}.  The interface works in a
+listed in Appendix~\ref{app:device-interface}. The interface works in a
 similar fashion as the \gls{EDSL}. Devices do not have to implement all
 functionality, this is analogous to the fact that views do not have to
-implement all type classes in the \gls{EDSL}.  When the device connects with
+implement all type classes in the \gls{EDSL}. When the device connects with
 the server for the first time, the specifications of what is implemented is
 communicated.
 
@@ -17,11 +17,17 @@ the device software.
        \item \texttt{POSIX} compatible systems connected via the \gls{TCP}.
 
                This includes systems running \emph{Linux} and \emph{MacOS}.
-       \item The \texttt{STM32} microcontrollers family supported by
-               \texttt{ChibiOS} connected via serial communication.
+       \item Microcontrollers supported by the
+               \texttt{mbed}\footnote{\url{https://www.mbed.com/en/}}.
 
                This is tested in particular on the \texttt{STM32f7x} series \gls{ARM}
                development board.
+       \item Microcontrollers family supported by
+               \texttt{ChibiOS}\footnote{\url{chibios.org}} connected via serial
+               communication.
+
+               This is also tested in particular on the \texttt{STM32f7x} series
+               \gls{ARM} development board.
        \item Microcontrollers which are programmable in the \gls{Arduino} \gls{IDE}
                connected via serial communication or via \gls{TCP} over WiFi or
                Ethernet.
@@ -77,17 +83,17 @@ device.
 \end{algorithm}
 
 \subsubsection{Storage}
-\glspl{Task} and \glspl{SDS} are stored on the client in memory. Some devices
-have very little memory and therefore memory space is very expensive and needs
-to be used optimally. Almost all microcontrollers support heaps nowadays,
-however, the functions for allocating and freeing the memory on the heap are
-not very space optimal and often leave holes in the heap if allocations are not
-freed in reverse order. To overcome this problem the client will allocate a big
-memory segment in the global data block. This block of memory resides under the
-stack and its size can be set in the interface implementation. This block of
-memory will be managed in a similar way as the entire memory space of the
-device is managed. \Glspl{Task} will grow from the bottom up and \glspl{SDS}
-will grow from the top down.
+\glspl{Task} and \glspl{SDS} are stored on the client not in program memory but
+in memory. Some devices have very little memory and therefore memory space is
+very expensive and needs to be used optimally. Almost all microcontrollers
+support heaps nowadays, however, the functions for allocating and freeing the
+memory on the heap are not very space optimal and often leave holes in the heap
+if allocations are not freed in a last in first out fashion. To overcome this
+problem, the client will allocate a big memory segment in the global data
+block.  This block of memory resides under the stack and its size can be set in
+the interface implementation. This block of memory will be managed in a similar
+way as the entire memory space of the device is managed. \Glspl{Task} will grow
+from the bottom up and \glspl{SDS} will grow from the top down.
 
 When a \gls{Task} is received, the program will traverse the memory space from
 the bottom up, jumping over all \glspl{Task}. A \gls{Task} is stored as the
@@ -97,18 +103,19 @@ to determine the size of the \gls{Task}. When the program arrived at the last
 copied to there. This method is analogously applied for \glspl{SDS}, however,
 the \glspl{SDS} grow from the bottom down.
 
-When a \gls{Task} or \gls{SDS} is removed, all remaining objects are compressed
-again. This means that if the first received \gls{Task} is removed, all
+When a \gls{Task} or \gls{SDS} is removed, all the remaining objects in the
+memory space are reordered in such a way that there are no holes left. In
+practice this means that if the first received \gls{Task} is removed, all
 \glspl{Task} received later will have to move back. Obviously, this is quite
 time intensive but it can not be permitted to leave holes in the memory since
 the memory space is so limited. This techniques allows for even the smallest
 tested microcontrollers with only $2K$ \emph{RAM} to hold several \glspl{Task}
-and \glspl{SDS}. If this technique would not be used the memory space will
-decrease over time and the client can then not run for very long since holes
-are evidently created at some point.
+and \glspl{SDS}. Without this technique, the memory space will decrease over
+time and the client can then not run for very long since holes are evidently
+created at some point.
 
-The structure instances and helper functions for traversing them in memory for
-\glspl{Task} and \glspl{SDS} are shown in Listing~\ref{lst:structs}.
+The structure instances and helper functions for traversing for \glspl{Task}
+and \glspl{SDS} are shown in Listing~\ref{lst:structs}.
 
 \begin{lstlisting}[language=C,label={lst:structs},%
        caption={The data type storing the \glspl{Task}},float]
@@ -177,29 +184,8 @@ void run_task(struct task *t){
                case BCJMPT: trace("jmpt to %d", program[pc]);
                        pc = stack[--sp] ? program[pc]-1 : pc+1;
                        break;
-}
-\end{lstlisting}
-
-\subsection{Specification}
-The server stores a description for every device available in a record type.
-From the macro settings in the interface file, a profile is created that
-describes the specification of the device. When the connection between the
-server and a client is established, the server will send a request for
-specification. The client serializes its specification and send it to the
-server so that the server knows what the client is capable of.  The exact
-specification is shown in Listing~\ref{lst:devicespec} and stores the
-peripheral availability, the memory available for storing \glspl{Task} and
-\glspl{SDS} and the size of the stack.
-
-\begin{lstlisting}[label={lst:devicespec},
-       caption={Device specification for \gls{mTask}-\glspl{Task}}]
-:: MTaskDeviceSpec =
-       { haveLed     :: Bool
-       , haveLCD     :: Bool
-       , have...
-       , bytesMemory :: Int
-       , stackSize   :: Int
-       , aPins       :: Int
-       , dPins       :: Int
+               // ...
+               }
        }
+}
 \end{lstlisting}