-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tex
433 lines (350 loc) · 16.5 KB
/
main.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% The Legrand Orange Book
% LaTeX Template
% Version 2.3 (8/8/17)
%
% This template has been downloaded from:
% http://www.LaTeXTemplates.com
%
% Original author:
% Mathias Legrand (legrand.mathias@gmail.com) with modifications by:
% Vel (vel@latextemplates.com)
%
% License:
% CC BY-NC-SA 3.0 (http://creativecommons.org/licenses/by-nc-sa/3.0/)
%
% Compiling this template:
% This template uses biber for its bibliography and makeindex for its index.
% When you first open the template, compile it from the command line with the
% commands below to make sure your LaTeX distribution is configured correctly:
%
% 1) pdflatex main
% 2) makeindex main.idx -s StyleInd.ist
% 3) biber main
% 4) pdflatex main x 2
%
% After this, when you wish to update the bibliography/index use the appropriate
% command above and make sure to compile with pdflatex several times
% afterwards to propagate your changes to the document.
%
% This template also uses a number of packages which may need to be
% updated to the newest versions for the template to compile. It is strongly
% recommended you update your LaTeX distribution if you have any
% compilation errors.
%
% Important note:
% Chapter heading images should have a 2:1 width:height ratio,
% e.g. 920px width and 460px height.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Forum: https://latex.org/forum/app.php/tag/legrand-orange-book
%----------------------------------------------------------------------------------------
% PACKAGES AND OTHER DOCUMENT CONFIGURATIONS
%----------------------------------------------------------------------------------------
% INSTRUCCIONS D'´US
% Cada capitol a un fitxer separat
% Faig servir \chapter, \section, \subsection i \subsubsection
% Sota cada apartat hi ha un \label amb etiqueta ch:<nom>, sec:<nom>, sub:<nom> o subsub:<nom>
% Les funcions les poso amb negreta iles indexo amb \index: {\bf funcio()}\index{funcio()}
% Referen ies entre seccions amb \fullref{<nom>}
% Llistats amb \begin{lstlisting}[style=customc,caption={<titol>},label=<etiqueta>]
% Cites a articles, llibres, DS, etc. sempre amb numero de pàgina \cite[p. 5]{CITA}
\documentclass[11pt,fleqn]{book} % Default font size and left-justified equations
%----------------------------------------------------------------------------------------
\input{structure} % Insert the commands.tex file which contains the majority of the structure behind the template
\usepackage{listings}
\renewcommand{\lstlistingname}{Llistat}
\renewcommand*{\lstlistlistingname}{Índex de llistats}
\renewcommand{\listfigurename}{Índex de figures}
\usepackage[acronym,toc,footnote,nopostdot]{glossaries}
\usepackage{textcomp}
\usepackage{parskip} % More space between paragraphs
\usepackage{colortbl}
\usepackage{gensymb}
% Style for glossary index (https://en.wikibooks.org/wiki/LaTeX/Glossary)
\setglossarystyle{altlist}
% Table borders in ``ocre`` color
\arrayrulecolor{ocre}
%% Href use ocre color
\let\oldhref\href
\renewcommand*{\href}[2]{\oldhref{#1}{\color{ocre}{#2}}}
%% Font style for C code
\usepackage{courier}
% \renewcommand{\lstlistingname}{Llistat}
\lstdefinestyle{customc}{
breaklines=true,
frame=single,
xleftmargin=\parindent,
language=C,
showstringspaces=false,
basicstyle=\footnotesize\ttfamily,
keywordstyle=\bfseries\color{green!40!black},
commentstyle=\itshape\color{purple!40!black},
identifierstyle=\color{blue},
stringstyle=\color{orange},
framesep=8pt,
float
}
\lstdefinelanguage
[ARM]{Assembler}
[x86masm]{Assembler}
{morekeywords={push, sub, add, str, ldr, bl, mov, adds, pop, vstr.32, vldr.32,
vmul.f32, vmov.f32, bx, vstr.64, ldrd, vmov, vldr.64, vmul.f64,
vmov.f64}
}
\lstdefinestyle{customasm}{
breaklines=true,
frame=single,
xleftmargin=\parindent,
language=[ARM]Assembler,
showstringspaces=false,
basicstyle=\footnotesize\ttfamily,
keywordstyle=\bfseries\color{green!40!black},
commentstyle=\itshape\color{purple!40!black},
identifierstyle=\color{blue},
stringstyle=\color{orange},
framesep=8pt,
float
}
\lstset{
rulecolor=\color{ocre},
rulesepcolor=\color{ocre}
}
\definecolor{cccolor}{rgb}{.67,.7,.67}
\usepackage{nameref}
\usepackage[section]{placeins}
\usepackage{siunitx}
\makeglossaries
\loadglsentries{acronyms}
%----------------------------------------------------------------------------------------
% Watermark ''Esborrany''
%----------------------------------------------------------------------------------------
%\usepackage{draftwatermark}
%\SetWatermarkText{Esborrany}
%----------------------------------------------------------------------------------------
% New command, \fullref with full reference to a part/section/figure, etc.
%----------------------------------------------------------------------------------------
\newcommand*{\fullref}[1]{\hyperref[{#1}]{\bf \color{ocre}\autoref*{#1} - \nameref*{#1}}} % One single link
% \renewcommand{\ref}[1]{\bf \color{ocre}\ref{#1}}
% \let\origref\ref
% \def\ref#1{\textbf{\color{ocre}\origref{#1}}}
%----------------------------------------------------------------------------------------
% Pàgina en blanc amb text per avisar que tot OK
% No surt espres de l'inici de cada part, no se pq
%----------------------------------------------------------------------------------------
\newcommand*{\blankpage}{%
\vspace*{\fill}
{\centering Aquesta pàgina està en blanc expressament, tot va bé.\par}
\vspace{\fill}}
\makeatletter
\renewcommand*{\cleardoublepage}{\clearpage\if@twoside \ifodd\c@page\else
\blankpage
\thispagestyle{empty}
\newpage
\if@twocolumn\hbox{}\newpage\fi\fi\fi}
\makeatother
%----------------------------------------------------------------------------------------
% Pàgina dedicatòria
%----------------------------------------------------------------------------------------
\newenvironment{dedication}
{%\clearpage % we want a new page %% I commented this
\cleardoublepage % Forces the first chapter to start on an odd page so it's on the right
\pagestyle{empty} % No headers
\thispagestyle{empty}% no header and footer
\vspace*{\stretch{1}}% some space at the top
\itshape % the text is in italics
\raggedleft % flush to the right margin
}
{\par % end the paragraph
\vspace{\stretch{3}} % space at bottom is three times that at the top
\clearpage % finish off the page
}
%----------------------------------------------------------------------------------------
% Posem color i negreta a les etiquetes de figura, llistat i taula
%----------------------------------------------------------------------------------------
\usepackage{caption}
% \renewcommand{\figurename}{Figurabb}
\captionsetup[figure]{labelfont={color=ocre,bf}}
\captionsetup[lstlisting]{labelfont={color=ocre,bf}}
\captionsetup[table]{labelfont={color=ocre,bf}}
%----------------------------------------------------------------------------------------
% Per dibuixar FSMs
%----------------------------------------------------------------------------------------
\usepackage{tikz}
\usetikzlibrary{arrows,automata}
%----------------------------------------------------------------------------------------
% Només fem index de part i chapter, no sections ni subsections ni res
%----------------------------------------------------------------------------------------
\setcounter{tocdepth}{0}
\begin{document}
%----------------------------------------------------------------------------------------
% TITLE PAGE
%----------------------------------------------------------------------------------------
\begingroup
\thispagestyle{empty}
\begin{tikzpicture}[remember picture,overlay]
\node[inner sep=0pt] (background) at (current page.center) {\includegraphics[width=\paperwidth]{background}};
\draw (current page.center) node [fill=ocre!30!white,fill opacity=0.6,text opacity=1,inner sep=1cm]{\Huge\centering\bfseries\sffamily\parbox[c][][t]{\paperwidth}{\centering Programació de sistemes encastats\\[15pt] % Book title
{\Large Un altre llibre sobre el mateix}\\[20pt] % Subtitle
% {\LARGE Màrius Montón, PhD}\\{\large Amb contribucions de: Lluís Gesa}}}; % Author name
{\LARGE Màrius Montón, PhD}}}; % Author name
\end{tikzpicture}
\vfill
\endgroup
%----------------------------------------------------------------------------------------
% COPYRIGHT PAGE
%----------------------------------------------------------------------------------------
\cleardoublepage
\newpage
~\vfill
\thispagestyle{empty}
\noindent Copyright \copyright\ 2018, 2019 Màrius Montón\\ % Copyright notice
% \noindent Copyright \copyright\ 2018 del captítol \ref{part:test} Lluís Gesa
\noindent \textit{Versió: 1.0} % Printing/edition date
\noindent \textit{Data: \today}
\par
\begin{mdframed}[outerlinecolor=black,outerlinewidth=2pt,linecolor=cccolor,middlelinewidth=3pt,roundcorner=10pt]
Distribuit segons la llicència Creative Commons Reconeixement-NoComercial-CompartirIgual 4.0 Internacional (CC BY-NC-SA 4.0) (\href{https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode}{link al text de la llicència})
\begin{center}
\includegraphics[scale=0.2]{imatges/1280px-CC-BY-NC-SA}
\end{center}
\end{mdframed}
\noindent Sou lliure de:
\begin{description}[leftmargin=\parindent]
\item {\bf Compartir} — copiar i redistribuir el material en qualsevol mitjà i format
\item {\bf Adaptar} — remesclar, transformar i crear a partir del material
\end{description}
\noindent Amb els termes següents:
\begin{description}[leftmargin=\parindent]
\item {\bf Reconeixement} — Heu de reconèixer l'autoria de manera apropiada, proporcionar un enllaç a la llicència i indicar si heu fet algun canvi. Podeu fer-ho de qualsevol manera raonable, però no d'una manera que suggereixi que el llicenciador us dóna suport o patrocina l'ús que en feu.
\item {\bf NoComercial} — No podeu utilitzar el material per a finalitats comercials.
\item {\bf CompartirIgual} — Si remescleu, transformeu o creeu a partir del material, heu de difondre les vostres creacions amb la mateixa llicència que l'obra original.
\end{description}
\noindent Latex Template based on \href{https://www.latextemplates.com/template/the-legrand-orange-book}{The Legrand Orange Book} by Mathias Legrand.
%----------------------------------------------------------------------------------------
% DEDICATÒRIA
%----------------------------------------------------------------------------------------
\begin{dedication}
A tots els meus alumnes, que m'han ajudat a entendre i aprendre.
\par %% or a blank line
% \vspace{2\baselineskip}
\vspace{\baselineskip}
% \usefont{T1}{LobsterTwo-LF}{bx}{it}
\usefont{T1}{Arial}{bx}{it}
Màrius
\vspace{4\baselineskip}
\vspace{4\baselineskip}
Vull agrair a Aitor Mejias, Borja Martínez, Lluís Gesa, Cristina Cano, Francisco Vázquez, Pere Tuset, Xose Pérez, Jordi Binefa, Xavier Fitó i Lluís Ribas pels comentaris i correccions fetes al text. Com de costum tots els errors que encara hi hagi al text i al codi son cosa meva i no pas seva.
\vspace{\baselineskip}
Màrius
\end{dedication}
%----------------------------------------------------------------------------------------
% TABLE OF CONTENTS
%----------------------------------------------------------------------------------------
%\usechapterimagefalse % If you don't want to include a chapter image, use this to toggle images off - it can be enabled later with \usechapterimagetrue
\chapterimage{chapter_head_1.pdf} % Table of contents heading image
\pagestyle{empty} % No headers
\tableofcontents % Print the table of contents itself
\cleardoublepage % Forces the first chapter to start on an odd page so it's on the right
\pagestyle{fancy} % Print headers again
%----------------------------------------------------------------------------------------
% PART
%----------------------------------------------------------------------------------------
\part{Nocions bàsiques}
%----------------------------------------------------------------------------------------
% CHAPTER 1
%----------------------------------------------------------------------------------------
\chapterimage{chapter_head_2.pdf} % Chapter heading image
%----------------------------------------------------------------------------------------
% 1a Part: Introducció & Breu introducció als sistemes encastats
%----------------------------------------------------------------------------------------s
\include{capitol_1}
\include{capitol_2}
%----------------------------------------------------------------------------------------
% 2a i 3a Part: Programació de perifèrics
%----------------------------------------------------------------------------------------s
\part{Programació de perifèrics I}
\label{part:programacio}
\include{capitol_3}
%----------------------------------------------------------------------------------------
% 4a Part: FreeRTOS
%----------------------------------------------------------------------------------------s
\part{FreeRTOS}
\label{part:freertos}
\include{capitol_4}
%----------------------------------------------------------------------------------------
% 5a Part: Models de programació
%----------------------------------------------------------------------------------------s
\part{Models de programació}
\label{part:modelsprogramacio}
\include{capitol_5}
%----------------------------------------------------------------------------------------
% 6a Part: Temes avançats
%----------------------------------------------------------------------------------------s
\part{Temes avançats}
\label{part:avançats}
\include{capitol_6}
\part{Bones pràctiques}
\label{part:bonespractiques}
\include{capitol_7}
%----------------------------------------------------------------------------------------
% 6a Part: Test
%----------------------------------------------------------------------------------------s
% \part{Test i Qualitat}
% \label{part:test}
% \include{capitol_6}
%----------------------------------------------------------------------------------------
% 7a Part: Indexs
%----------------------------------------------------------------------------------------s
\part{Índex, Bibliografia, Glossari}
%----------------------------------------------------------------------------------------
% Enllaços dels exemples
%----------------------------------------------------------------------------------------s
\include{links}
%----------------------------------------------------------------------------------------
% BIBLIOGRAPHY
%----------------------------------------------------------------------------------------
\chapter*{Bibliografia}
\addcontentsline{toc}{chapter}{\textcolor{ocre}{Bibliografia}}
%------------------------------------------------
%\section*{Articles}
%\addcontentsline{toc}{section}{Articles}
\printbibliography[heading=bibempty, type=misc]
%------------------------------------------------
\section*{Llibres}
\addcontentsline{toc}{section}{Llibres}
\printbibliography[heading=bibempty,type=book]
%----------------------------------------------------------------------------------------
% GLOSSARY
%----------------------------------------------------------------------------------------
% \chapter*{Glossari}
\cleardoublepage
\printglossary[title=Glossari,toctitle={\textcolor{ocre}{Glossari}}]
\printglossary[type=\acronymtype, title=Acrònims,toctitle={\textcolor{ocre}{Acrònims}}]
%----------------------------------------------------------------------------------------
% Índex de figures
%----------------------------------------------------------------------------------------
\cleardoublepage
\listoffigures
\addcontentsline{toc}{chapter}{\textcolor{ocre}{\listfigurename}}
%----------------------------------------------------------------------------------------
% Llistats
%----------------------------------------------------------------------------------------
% \chapter*{Llistats}
% \clearpage\addcontentsline{toc}{chapter}{\lstlistlistingname}
\cleardoublepage
\addcontentsline{toc}{chapter}{\textcolor{ocre}{\lstlistlistingname}}
\lstlistoflistings
%----------------------------------------------------------------------------------------
% INDEX
%----------------------------------------------------------------------------------------
\renewcommand\indexname{Index de funcions}
\cleardoublepage
\phantomsection
\setlength{\columnsep}{0.75cm}
\addcontentsline{toc}{chapter}{\textcolor{ocre}{Índex de funcions}}
\printindex
%----------------------------------------------------------------------------------------
\cleardoublepage
\end{document}
% https://www.embedded.com/design/mcus-processors-and-socs/4026075/Building-Bare-Metal-ARM-Systems-with-GNU-Part-2