From: Mart Lubbers Date: Wed, 10 May 2017 13:21:06 +0000 (+0200) Subject: update listing, polish arch, dsl and top X-Git-Tag: hand-in~130 X-Git-Url: https://git.martlubbers.net/?a=commitdiff_plain;h=b0fc85be57e369c5a04adaba4d6920a59d3d36e2;p=msc-thesis1617.git update listing, polish arch, dsl and top --- diff --git a/Makefile b/Makefile index eadae05..6c581a2 100644 --- a/Makefile +++ b/Makefile @@ -8,6 +8,9 @@ MAKEGLOSSARIESFLAGS?= LATEXFLAGS:=-file-line-error -halt-on-error -no-shell-escape FIGURES:=$(addsuffix .png,$(addprefix img/,$(notdir $(basename $(wildcard fig/*.dot))))) +LISTINGS:=$(wildcard listings/*) +TEXS:=$(wildcard *.bib) +BIBS:=$(wildcard *.tex) .PHONY: all clean .SECONDARY: $(addsuffix .fmt,$(DOCS)) $(FIGURES) @@ -20,7 +23,7 @@ all: $(addsuffix .pdf,$(DOCS)) %.pdf: %.mlog if $(GREP) -iFq 'Rerun' $<; then $(LATEX) $(LATEXFLAGS) $(basename $<); fi -%.mlog: %.tex %.fmt $(wildcard *.bib) $(wildcard *.tex) $(FIGURES) +%.mlog: %.tex %.fmt $(BIBS) $(TEXS) $(FIGURES) $(LISTINGS) $(LATEX) $(LATEXFLAGS) $< if $(GREP) -q '^\\bibdata{' $(basename $<).aux; then $(BIBTEX) $(BIBTEXFLAGS) $(basename $<); fi if $(GREP) -q '\@istfilename' $(basename $<).aux; then $(MAKEGLOSSARIES) $(MAKEGLOSSARIESFLAGSFLAGS) $(basename $<); fi diff --git a/listings/interface.h b/listings/interface.h index 24e369a..1903941 100644 --- a/listings/interface.h +++ b/listings/interface.h @@ -5,26 +5,43 @@ #include #include -#define read16() 256*(uint8_t)read_byte() + (uint8_t)read_byte() -#define from16(a, b) 256*a+b -#define write16(i) { write_byte((uint8_t)i/256); write_byte((uint8_t)i%256); } +#ifdef LINUX +#define STACKSIZE 1024 +#define MEMSIZE 1024 +#define HAVELED 1 +#define HAVEAIO 1 +#define HAVEDIO 1 +#elif defined STM +... +#endif + +/* Communication */ +bool input_available(void); uint8_t read_byte(void); void write_byte(uint8_t b); +/* Analog and digital pins */ +#if HAVEDIO == 1 void write_dpin(uint8_t i, bool b); bool read_dpin(uint8_t i); - +#endif +#if HAVEAIO == 1 void write_apin(uint8_t i, uint8_t a); uint8_t read_apin(uint8_t i); +#endif +/* UserLED */ +#if HAVELED == 1 void led_on(uint8_t i); void led_off(uint8_t i); +#endif -long millis(void); -bool input_available(void); -void delay(long ms); +/* Delay and communication */ +unsigned long getmillis(void); +void msdelay(unsigned long ms); -void setup(void); +/* Auxilliary */ +void real_setup(void); void debug(char *fmt, ...); void pdie(char *s); void die(char *fmt, ...); diff --git a/methods.arch.tex b/methods.arch.tex index 9f41e56..226bc40 100644 --- a/methods.arch.tex +++ b/methods.arch.tex @@ -5,21 +5,31 @@ be eligible for \glspl{mTask} it must be able to compile the shared codebase and 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, listed in -Appendix~\label{app:device-interface}\todo{update interface listing}, also -includes functions for accessing the peripherals that not every device might -have. Devices can choose what to implement by setting the correct macros in the -top of the file. When a server connects to a client the specifications are +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 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 +for the first time with a server the specifications of what is implemented is communicated. -The current list of supported and tested devices is as follows: +At the time of writing the following device families are supported and can run +the device software. \begin{itemize} - \item $^*$\texttt{NIX} systems such as Linux - \item \emph{STM32} like development boards supported by \texttt{ChibiOS} - such as the \emph{STM32f7x} series. - \item \emph{Arduino} compatible microcontrollers. Even development boards - with as little as \emph{2K} \emph{RAM} such as the \emph{Arduino UNO} - are supported. + \item \texttt{POSIX} compatible systems + + This includes systems running \emph{Linux} and \emph{MacOS}. + \item \texttt{STM32} family microcontrollers supported by \texttt{ChibiOS}. + + This is tested in particular on the \texttt{STM32f7x} series \gls{ARM} + development board. + \item Microcontrollers programmable by the \emph{Arduino} \gls{IDE}.\\ + + This does not only include \emph{Arduino} compatible boards but also + other boards capable of running compiled \emph{Arduino} code. The code + has been found working on the \texttt{ESP8266} powered \emph{NodeMCU}. + It is tested on devices as small as the regular \emph{Arduino UNO} + board that only boasts a meager \emph{2K} of \emph{RAM}. \end{itemize} \subsection{Specification} @@ -27,9 +37,9 @@ Devices are stored in a record type and all devices in the system are stored in a \gls{SDS} containing all devices. From the macro settings in the interface file a profile is created for the device that describes the specification. When a connection between the server and a client is established the server will -send a request for specification. The client will serialize his specs and send -it to the server so that the server knows what the client is capable of. The -exact specification is listed in Listing~\ref{lst:devicespec} +send a request for specification. The client will serialize his specification +and send it to the server so that the server knows what the client is capable +of. The exact specification is listed in Listing~\ref{lst:devicespec} \begin{lstlisting}[language=Clean,label={lst:devicespec}, caption={Device specification for \glspl{mTask}}] @@ -40,6 +50,8 @@ exact specification is listed in Listing~\ref{lst:devicespec} ,bytesMemory :: Int } \end{lstlisting} + +\subsection{Memory Management} \todo{Explain specification, combine task and share space} \subsection{Communication} diff --git a/methods.dsl.tex b/methods.dsl.tex index bd41dbb..2d0aab2 100644 --- a/methods.dsl.tex +++ b/methods.dsl.tex @@ -32,13 +32,14 @@ be done individually for all views. The first downside of the type of \gls{EDSL} can be overcome by using \glspl{GADT}. Listing~\ref{lst:exdeepgadt} shows the same language, but -type-safe with a \gls{GADT}\footnote{Note that \glspl{GADT} are not supported -in \gls{Clean}. They can be simulated using bimaps}\todo{cite}. Unfortunately -the lack of extendability stays a problem. If a language construct is added no -compile time guarantee is given that all views support it. +type-safe with a \gls{GADT}\footnote{\glspl{GADT} are not supported +in the current version of \gls{Clean}. However, they can be simulated using +bimaps}. Unfortunately the lack of extendability stays a problem. If a language +construct is added no compile time guarantee is given that all views support +it. \begin{lstlisting}[language=Clean,label={lst:exdeepgadt},% - caption={A minimal deep \gls{EDSL}}] + caption={A minimal deep \gls{EDSL} using \glspl{GADT}}] :: DSL a = LitI Int -> DSL Int | LitB Bool -> DSL Bool @@ -51,9 +52,9 @@ compile time guarantee is given that all views support it. \subsection{Shallow embedding} In a shallowly \gls{EDSL} all language constructs are expressed as functions in -the host language. Our example language then looks something like the code -shown in Listing~\ref{lst:exshallow} if implementing the evaluator. Note that -much of the internals of the language can be hidden away using monads. +the host language. An evaluator view for our example language then looks +something like the code shown in Listing~\ref{lst:exshallow}. Note that much of +the internals of the language can be hidden away using monads. \begin{lstlisting}[language=Clean,label={lst:exshallow},% caption={A minimal shallow \gls{EDSL}}] @@ -88,15 +89,15 @@ implement all views. This makes it slow for multiple views and complex to implement. \subsection{Class based shallow embedding} -The third type of embedding is called class based shallow embedding and is -supposed to have the best of both shallow and deep embedding. In class based -shallow embedding the language constructs are defined as type classes. The same -language is shown with the new method in Listing~\ref{lst:exclassshallow}. - -This type of embedding inherits the easyness of adding views from shallow -embedding. A view is just a different type implementing one or more type -classes as shown in the aforementioned Listing where an evaluator and a pretty -printer are implemented. +The third type of embedding is called class based shallow embedding and has the +best of both shallow and deep embedding. In class based shallow embedding the +language constructs are defined as type classes. The same language is shown +with the new method in Listing~\ref{lst:exclassshallow}. + +This type of embedding inherits the easiness of adding views from shallow +embedding. A view is just a different data type implementing one or more of the +type classes as shown in the aforementioned Listing where an evaluator and a +pretty printer are implemented. Just as with \glspl{GADT} in deep embedding type safety is guaranteed. Type constraints are enforced through phantom types. One can add as many phantom diff --git a/methods.top.tex b/methods.top.tex index cbf65eb..52ed983 100644 --- a/methods.top.tex +++ b/methods.top.tex @@ -59,5 +59,5 @@ functions that are captured in the class \CI{iTask}. Basic types have specialization instances for these functions and show an according interface. Generated interfaces can be modified with decoration operators. - \subsection{Combinators} +\todo{Stukje over combinators, in ieder geval bind en paralel} diff --git a/thesis.pre b/thesis.pre index f0b453b..bb610fb 100644 --- a/thesis.pre +++ b/thesis.pre @@ -96,7 +96,6 @@ commentstyle=\itshape, % comment style keywordstyle=\bfseries, % keyword style stringstyle=\ttfamily, % string literal style - language=Clean, % the language of the code showspaces=false, % show spaces everywhere adding particular underscores; it overrides 'showstringspaces' showstringspaces=false, % underline spaces within strings only showtabs=false, % show tabs within strings adding particular underscores diff --git a/thesis.tex b/thesis.tex index caaef4e..10a6f81 100644 --- a/thesis.tex +++ b/thesis.tex @@ -11,6 +11,7 @@ \newacronym{RISC}{RISC}{Reduced Instruction Set Computer} \newacronym{ARM}{ARM}{Acorn \acrshort{RISC} Machine} \newacronym{LTN}{LTN}{Low Throughput Network} +\newacronym{IDE}{IDE}{Integrated Development Environment} \newglossaryentry{Clean}{name=Clean, description={is a pure lazy functional programming language based on graph rewriting}}