\documentclass[a4paper,11pt,hidelinks]{report}
% {{{ Packages
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage[pdftex]{graphicx}
\usepackage{multirow}
\usepackage{color}
\usepackage[pdftex,
            pdfauthor={Felix Martin},
            colorlinks=false]{hyperref}
\usepackage{units}
\usepackage{csquotes}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{ntheorem}
\newtheorem{hyp}{Hypothesis}
\usepackage{tikz}
\usetikzlibrary{mindmap}
\usepackage[font={small}]{caption}
% }}}
% {{{ Glossary
\usepackage{glossaries}
\makeglossaries
\newglossaryentry{osek}{name=OSEK/VDX, description={Offene Systeme und deren
Schnittstellen für die Elektronik in Kraftfahrzeugen}}
\newglossaryentry{osekos}{name={OSEK OS}, description={OSEK Operating System}}
\newglossaryentry{orti}{name=ORTI, description={OSEK Run Time Interface}}
\newglossaryentry{os}{name=OS, description={Operating System}}
\newglossaryentry{ta}{name=TA, description={Timing-Architects Embedded Systems GmbH}}
\newglossaryentry{ecu}{name=ECU, description={Engine Control Unit}}
\newglossaryentry{autosar}{name=AUTOSAR, description={AUTomotive Open System ARchitecture}}
\newglossaryentry{autosaros}{name={AUTOSAR OS}, description={AUTOSAR Operating System}}
\newglossaryentry{api}{name=API, description={Application Programming Interface}}
\newglossaryentry{io}{name=I/O, description={Input/Output}}
\newglossaryentry{mcal}{name=MCAL, description={Microcontroller Abstraction Layer}}
\newglossaryentry{isr}{name=ISR, description={Interrupt Service Routine}}
\newglossaryentry{osekcc}{name=CC, description={OSEK Conformance Class}}
\newglossaryentry{mta}{name=MTA, description={Multiple Task Activation}}
\newglossaryentry{vfb}{name=VFB, description={Virtual Function Bus}}
\newglossaryentry{id}{name=ID, description={Identifier}}
\newglossaryentry{oil}{name=OIL, description={OSEK Implementation Language}}
\newglossaryentry{koil}{name=KOIL, description={Kernel Object Interface Language}}
\newglossaryentry{pob}{name=POB, description={Processor Observation Block}}
\newglossaryentry{bob}{name=BOB, description={Bus Observation Block}}
\newglossaryentry{etm}{name=ETM, description={Embedded Trace Macrocell}}
\newglossaryentry{dma}{name=DMA, description={Direct Memory Access}}
\newglossaryentry{agbt}{name=AGBT, description={Aurora Gigabit Interface}}
\newglossaryentry{imds}{name=IMDS, description={Infineon Multicore Debug Solution}}
\newglossaryentry{jtag}{name=JTAG, description={Joint Test Action Group}}
\newglossaryentry{daq}{name=DAQ, description={Data AcQuisition}}
\newglossaryentry{elf}{name=ELF, description={Executable and Linkable Format}}
\newglossaryentry{btf}{name=BTF, description={Best Trace Format}}
\newglossaryentry{oem}{name=OEM, description={Original equipment manufacturer}}
\newglossaryentry{rte}{name=RTE, description={Real Time Evaluation}}
\newglossaryentry{ipa}{name=IPA, description={Inter-Process Activation}}
\newglossaryentry{ee}{name=EE, description={ERIKA Enterprise Operating System}}
\newglossaryentry{rpc}{name=RPC, description={Remote Procedure Call}}
% }}}
% {{{ Get nice chapter titles
\usepackage{titlesec}
\titleformat{\chapter}[hang]{\bf\huge}{\thechapter}{2pc}{}
% }}}
% {{{ Package for adding todo comments to pdf
\usepackage[colorinlistoftodos]{todonotes}
\newcommand\todoin[2][]{\todo[inline, caption={2do}, #1]{
  \begin{minipage}
    {\textwidth-4pt}#2
  \end{minipage}}
}
% }}}
% {{{ Listing Configuration
\usepackage{listings}
\usepackage{listing}
\usepackage{float}

\floatstyle{plaintop}
\newfloat{code}{tb}{lop}[chapter]
\floatname{code}{Code}

\lstset{%
  basicstyle=\footnotesize,        % the size of the fonts that are used for the code
  breakatwhitespace=false,         % sets if automatic breaks should only happen at whitespace
  breaklines=true,                 % sets automatic line breaking
  captionpos=b,                    % sets the caption-position to bottom
  escapeinside={\%*}{*)},          % if you want to add LaTeX within your code
  extendedchars=true,              % lets you use non-ASCII characters; for 8-bits encodings only, does not work with UTF-8
  keepspaces=true,                 % keeps spaces in text, useful for keeping indentation of code (possibly needs columns=flexible)
  language=C,                      % the language of the code
  numbers=left,
  keywords={},
  frame=leftline,
  numbersep=10pt,                   % how far the line-numbers are from the code
  numberstyle=\tiny,
  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
  stepnumber=5,                    % the step between two line-numbers. If it's 1, each line will be numbered
  tabsize=2,                       % sets default tabsize to 2 spaces
  % aboveskip=20pt,                  % increase space between text and top of listing
  % belowskip=20pt,                  % increase space between bottom of listing and text
}
% }}}
% {{{ Set page heading design
\input{./config/pageheading.tex}
% }}}
% {{{ Provide meta info
\author{Felix Martin}
\title{Recording of an Operating System Aware Hardware Trace}
\date{\today}
% }}}

\begin{document}
  % {{{ Title
  \input{./config/title.tex}

  %empty page - only needed for twoside
  %\clearpage\mbox{}\thispagestyle{empty}\clearpage
  % }}}
  % {{{ Abstract and List of contents
  \setcounter{page}{1}
  \pagestyle{fancy}
  \pagenumbering{roman}

  \newpage
  \input{./content/abstract.tex}
  \addcontentsline{toc}{section}{Abstract}

  \newpage
  \tableofcontents
  \addcontentsline{toc}{section}{Contents}

  \newpage

  \parskip = 0pt %avoid empty lines

  %empty page - only needed for twoside
  %\clearpage\mbox{}\thispagestyle{empty}\clearpage
  % }}}
  % {{{ Content
  \setcounter{page}{1}
  \pagenumbering{arabic}

  \input{./content/introduction.tex}
  %   * Show what related tools cannot do
  %   * AUTOSAR OS measures task execution times
  %     * http://www.eetimes.com/document.asp?doc_id=1278315
  %     * Figure out how they do it and why we are better
  %     * http://www.bmw-carit.com/downloads/publications/RealtimeSystemDesignUtilizingAUTOSARMethodology.pdf
  %     * https://en.wikipedia.org/wiki/Tracing_(software)
  %   * Paper von Andreas von den Typen in Muenchen vom Tuev/Frauenhofer
  %   * System level performance analysis for real-time automotive multicore and network architectures
  %     * http://ieeexplore.ieee.org/xpl/login.jsp?tp=&arnumber=5075823&url=http%3A%2F%2Fieeexplore.ieee.org%2Fxpls%2Fabs_all.jsp%3Farnumber%3D5075823
  %   * MultiCore Benefits & Challenges for Automotive Applications
  %     * http://papers.sae.org/2008-01-0989/

  \input{./content/fundamentals.tex}
  \input{./content/osek.tex}
  \input{./content/system_trace.tex}

  \input{./content/hardware_tracing.tex}

  \input{./content/mapping.tex}

  \chapter{Validation}
  \label{chapter:validation}
  \input{./content/validation_intro.tex}
  \input{./content/testbench.tex}
  \input{./content/tests.tex}

  \input{./content/conclusion.tex}

  \input{./content/future.tex}

  % }}}
  % {{{ Appendix

  % Some work is necessary to get the appendix as we want it.  At first we
  % change chapter numbers to letters (Alph).  Then we reset the counter.  This
  % confuses hyperref which is why we have to renew theHchapter.
  \renewcommand\thechapter{\Alph{chapter}}
  \setcounter{chapter}{0}
  \renewcommand*{\theHchapter}{chX.\the\value{chapter}}
  \chapter{Appendix}

  \listoffigures
  \addcontentsline{toc}{section}{\protect\numberline{\thesection}List of Figures}
  \stepcounter{section}

  \newpage
  \listoftables
  \addcontentsline{toc}{section}{\protect\numberline{\thesection}List of Tables}
  \stepcounter{section}

  \newpage
  \listoflistings
  \addcontentsline{toc}{section}{\protect\numberline{\thesection}List of Listings}
  \stepcounter{section}

  \newpage
  \printglossary[title={Keywords}]
  \addcontentsline{toc}{section}{\protect\numberline{\thesection}Keywords}
  \stepcounter{section}

  % Bibliographie
  % see http://en.wikibooks.org/wiki/LaTeX/Bibliography_Management for help
  % this helps to get bibtex entries http://literatur-generator.de/
  \bibliographystyle{plain}
  \bibliography{./bib/main}
  \addcontentsline{toc}{section}{\protect\numberline{\thesection}Bibliography}
  \stepcounter{section}

  % Verzichtserklärung
  \newpage
  \input{./content/erkl.tex}
  % }}}
\end{document}
