Add storage section to doc

This commit is contained in:
Florian Hoss 2022-07-19 11:18:30 +02:00
parent aeb2189197
commit c6c6ef4677
5 changed files with 83 additions and 37 deletions

View file

@ -21,3 +21,11 @@
year = {2022},
url = {https://docs.platformio.org/en/latest//what-is-platformio.html}
}
@online{eeprom-doc,
author = {Arduino},
title = {EEPROM Library},
urldate = {2022-07-19},
year = {2022},
url = {https://docs.arduino.cc/learn/built-in-libraries/eeprom}
}

View file

@ -1,8 +1,8 @@
\section{PlatformIO Core}
\section{PlatformIO}
There are several ways to compile and upload code to a Mikrocontroller. The first Tests where written and compiled in the Arduino IDE\footnote{\href{https://www.arduino.cc/en/software}{https://www.arduino.cc/en/software}}. Because references and cross-platform developing was not easy with this approach, developing in this project will be done with the help of PlatformIO.
There are several ways to compile and upload code to a micro-controller. The first tests where written and compiled in the Arduino IDE\footnote{\href{https://www.arduino.cc/en/software}{https://www.arduino.cc/en/software}}. Because references and cross-platform developing was not easy with this approach, developing in this project will be done with the help of PlatformIO.
``PlatformIO is a must-have tool for professional embedded systems engineers who develop solutions on more than one specific platform. In addition, by having a decentralized architecture, PlatformIO offers both new and existing developers a quick integration path for developing commercial-ready products, and reduces the overall time-to-market. [...] The build system structure automatically tags software dependencies and applies them using a modular hierarchy that takes away the usual complexity and pain. Developers no longer have to manually find and assemble an environment of toolchains, compilers, and library dependencies to develop applications for a specific target. With PlatformIO, clicking the compile button will bring in all necessary dependencies automatically.'
``PlatformIO is a must-have tool for professional embedded systems engineers who develop solutions on more than one specific platform. In addition, by having a decentralized architecture, PlatformIO offers both new and existing developers a quick integration path for developing commercial-ready products, and reduces the overall time-to-market. [...] The build system structure automatically tags software dependencies and applies them using a modular hierarchy that takes away the usual complexity and pain. Developers no longer have to manually find and assemble an environment of tool-chains, compilers, and library dependencies to develop applications for a specific target. With PlatformIO, clicking the compile button will bring in all necessary dependencies automatically.''
\cite[cf.][]{pio-about}
@ -12,10 +12,36 @@ A dependency of PlatformIO is Python\footnote{\href{https://www.python.org/}{htt
PlatformIO can now simply installed by downloading a script called ``get-platformio.py'' and executing it. On Apple MacOS\footnote{\href{https://en.wikipedia.org/wiki/MacOS}{https://en.wikipedia.org/wiki/MacOS}} it can simply be installed with the help of Homebrew Packages Manager\footnote{\href{https://brew.sh/}{https://brew.sh/}}.
\subsubsection{Configure IDE}
\subsubsection{Configuration}
The configuration can be initialized with PIO Home or directly written into a \verb|plaftormio.ini| file. Following configuration will be used for simultaneous \verb|esp8266| and \verb|ESP32| usage:
\lstset{style=platform-io}
\begin{lstlisting}
[platformio]
default_envs = esp8266
[env:esp32]
platform = espressif32
board = esp32dev
framework = arduino
monitor_speed = 115200
[env:esp8266]
platform = espressif8266
board = d1_mini
framework = arduino
monitor_speed = 115200
\end{lstlisting}
\subsection{IDE}
Developing and writing code for this project will be done in Visual Studio Code\footnote{\href{https://code.visualstudio.com/}{https://code.visualstudio.com/}}.
``Visual Studio Code is a lightweight but powerful source code editor which runs on your desktop and is available for Windows, macOS and Linux. It comes with built-in support for JavaScript, TypeScript and Node.js and has a rich ecosystem of extensions for other languages (such as C++, C\#, Java, Python, PHP, Go) and runtimes (such as .NET and Unity).''
\cite[][]{vscode-about}
\subsection{Documentation}
Documentation is written in \LaTeX and will be added to the library as source-code only.

View file

@ -25,33 +25,17 @@
\usepackage[official]{eurosym}
\definecolor{codegreen}{rgb}{0,0.6,0}
\definecolor{codegray}{rgb}{0.5,0.5,0.5}
\definecolor{codepurple}{rgb}{0.58,0,0.82}
\definecolor{backcolour}{rgb}{0.95,0.95,0.92}
\definecolor{weborange}{rgb}{1,0.65,0}
\lstdefinestyle{mystyle}{
backgroundcolor=\color{backcolour},
commentstyle=\color{codegreen},
keywordstyle=\color{magenta},
numberstyle=\tiny\color{codegray},
stringstyle=\color{codepurple},
emph={int,char,double,float,unsigned,void,bool},
emphstyle={\color{weborange}},
basicstyle=\ttfamily\footnotesize,
breakatwhitespace=false,
breaklines=true,
captionpos=b,
keepspaces=true,
numbers=left,
numbersep=5pt,
showspaces=false,
showstringspaces=false,
showtabs=false,
tabsize=2,
firstnumber=1,
\lstdefinestyle{c++}{
language=C++,
directivestyle={\color{codepurple}},
emph={firewall_rule_t,uint8_t},
emphstyle={\color{codegreen}},
}
\lstdefinestyle{platform-io}{
emph={platformio,esp32,esp8266,arduino},
emphstyle={\color{codegreen}},
}
\lstset{style=mystyle}
\setuptoc{toc}{totoc}
@ -67,7 +51,6 @@
\addbibresource{bib/online.bib}
\addbibresource{bib/book.bib}
\DeclareNameAlias{default}{family-given/given-family}
\renewcommand*{\finalnamedelim}{\addspace{}und\space}
@ -90,12 +73,12 @@
\newcommand{\corequirement}[1]{\paragraph{#1}\hfill\textbf{\textcolor{could-have-orange}{could-have}}\\}
\newcommand{\wrequirement}[1]{\paragraph{#1}\hfill\textbf{\textcolor{wont-have-blue}{won't-have}}\\}
\ihead{Example Header}
\ihead{IoT Firewall - ESP8266/ESP32}
\chead{}
\ohead{Surname Lastname}
\ofoot{Seite~\thepage{}/\pageref{LastPage}}
\ohead{Florian Hoss}
\ofoot{Page~\thepage{}/\pageref{LastPage}}
\cfoot{}
\title{Example Title}
\title{IoT Firewall - ESP8266/ESP32}
\usepackage[breaklinks,colorlinks,linkcolor=black,citecolor=black,filecolor=black,urlcolor=black]{hyperref}
\begin{document}
@ -105,7 +88,8 @@
\newpage
\listoffigures
\include{firststeps/firststeps}
\include{storage/storage}
\printbibliography[title=Literaturverzeichnis]
\printbibliography[title=Bibliography]
\end{document}

View file

@ -0,0 +1,28 @@
\section{ESP Storage}
To store the firewall rules there will be a class to handle storing and retrieving of the currently active rules. For each board there is a library available that will handle most of the work for us.
\subsection{esp8266}
A library called EEPROM can be used to access the memory that will be kept when the board is powered off. With this library we can easily write and read from this area.
``The supported micro-controllers on the various Arduino [...] boards have different amounts of EEPROM: [...] The Arduino [...] boards have an emulated EEPROM space of 1024 bytes.''
\cite[][]{eeprom-doc}
\subsection{esp32}
To save and retrieve data on the esp32, the Preferences.h\footnote{\href{https://github.com/espressif/arduino-esp32/blob/master/libraries/Preferences/src/Preferences.h}{preferences.h on github}} library will be used. It is a replacement for the deprecated EEPROM library that is used with the esp8266.
\subsection{Storage class}
To use the individual library with the firewall rules the firewall can be extended with the storage class. Following protected methods will be available to store and retrieve firewall rules:
\lstset{style=c++}
\begin{lstlisting}
uint8_t retrieve_amount_of_rules();
void store_amount_of_rules(const uint8_t new_amount);
firewall_rule_t *retrieve_firewall_rule(const uint8_t key);
void store_all_firewall_rules(firewall_rule_t *rule_head);
void store_firewall_rule(firewall_rule_t *rule_ptr);
\end{lstlisting}

View file

@ -24,5 +24,5 @@
\vfill
\raggedright{}
\HRule{13pt}{1pt} \\
\titleemph{Dozent:} Prof. Dr. rer. nat. Tobias Heer
\titleemph{Professor:} Prof. Dr. rer. nat. Tobias Heer
\end{titlepage}