blob: 967c3380284c406e5879761cb939657de7efba43 [file] [log] [blame]
Summer Qin7e741112021-05-25 15:46:37 +08001########################
2Documentation generation
3########################
4
Anton Komlev4c436bf2021-10-18 21:59:55 +01005Two documents are available for generation:
Summer Qin7e741112021-05-25 15:46:37 +08006
Anton Komlev4c436bf2021-10-18 21:59:55 +01007- Reference Manual (HTML, PDF)
8- User Guide (HTML, PDF)
Summer Qin7e741112021-05-25 15:46:37 +08009
Anton Komlev4c436bf2021-10-18 21:59:55 +010010The documentation build is independent from building the binary artifacts.
Summer Qin7e741112021-05-25 15:46:37 +080011
Anton Komlev4c436bf2021-10-18 21:59:55 +010012******************************
13Tools and building environment
14******************************
Summer Qin7e741112021-05-25 15:46:37 +080015
Anton Komlev4c436bf2021-10-18 21:59:55 +010016These tools are used to generate TF-M documentation:
Summer Qin7e741112021-05-25 15:46:37 +080017
18 - Doxygen v1.8.0 or later
19 - Graphviz dot v2.38.0 or later
20 - PlantUML v1.2018.11 or later
Anton Komlev4c436bf2021-10-18 21:59:55 +010021 - Java runtime environment v1.8 or later (for running PlantUML)
Anton Komlev267e5c02023-01-24 18:18:33 +000022 - Sphinx and other python modules, listed in ``docs/requirements.txt``
Anton Komlev4c436bf2021-10-18 21:59:55 +010023
24Additionally, for PDFs format:
25
26 - LaTeX
27 - PdfLaTeX
28
29There are two ways of building TF-M reference manual:
30
31 1. As a custom target of TF-M CMake build system
32 2. Directly, using the command line tools
33
34
35To prepare your building environment execute the following steps:
Summer Qin7e741112021-05-25 15:46:37 +080036
37.. tabs::
38
39 .. group-tab:: Linux
40
Summer Qin7e741112021-05-25 15:46:37 +080041 .. code-block:: bash
42
43 sudo apt-get install -y doxygen graphviz default-jre
44 mkdir ~/plantuml
45 curl -L http://sourceforge.net/projects/plantuml/files/plantuml.jar/download --output ~/plantuml/plantuml.jar
46 export PLANTUML_JAR_PATH=~/plantuml/plantuml.jar
47
48 # For PDF generation
49 sudo apt-get install -y doxygen-latex
50
Anton Komlev4c436bf2021-10-18 21:59:55 +010051 # Install the required Python modules
Anton Komlev6be16032021-10-13 21:51:23 +010052 pip3 install --upgrade pip
53 cd trusted-firmware-m
Anton Komlev267e5c02023-01-24 18:18:33 +000054 pip3 install -r docs/requirements.txt
Anton Komlev6be16032021-10-13 21:51:23 +010055
Summer Qin7e741112021-05-25 15:46:37 +080056 .. group-tab:: Windows
57
Anton Komlev4c436bf2021-10-18 21:59:55 +010058 Download and install the following tools:
Summer Qin7e741112021-05-25 15:46:37 +080059
Anton Komlev4c436bf2021-10-18 21:59:55 +010060 - `Doxygen 1.8.8 <https://sourceforge.net/projects/doxygen/files/snapshots/doxygen-1.8-svn/windows/doxygenw20140924_1_8_8.zip/download>`__
61 - `Graphviz 2.38 <https://graphviz.gitlab.io/_pages/Download/windows/graphviz-2.38.msi>`__
62 - The Java runtime is part of the Arm DS installation or can be
63 downloaded from `here <https://www.java.com/en/download/>`__
64 - `PlantUML <http://sourceforge.net/projects/plantuml/files/plantuml.jar/download>`__
65 - `MikTeX <https://miktex.org/download>`__ - for PDF generation only
Summer Qin7e741112021-05-25 15:46:37 +080066
Anton Komlev4c436bf2021-10-18 21:59:55 +010067 Set the environment variables, assuming that:
Summer Qin7e741112021-05-25 15:46:37 +080068
Anton Komlev4c436bf2021-10-18 21:59:55 +010069 - doxygen, dot, and MikTeX binaries are available on the PATH.
70 - Java JVM is used from Arm DS installation.
Summer Qin7e741112021-05-25 15:46:37 +080071
72 .. code-block:: bash
73
74 set PLANTUML_JAR_PATH=<plantuml_Path>\plantuml.jar
75 set PATH=$PATH;<ARM_DS_PATH>\sw\java\bin
76
Anton Komlev4c436bf2021-10-18 21:59:55 +010077 # Install the required Python modules
78 pip3 install --upgrade pip
79 cd trusted-firmware-m
Anton Komlev267e5c02023-01-24 18:18:33 +000080 pip3 install -r docs\requirements.txt
Anton Komlev4c436bf2021-10-18 21:59:55 +010081
82***************************
83Build TF-M Reference Manual
84***************************
85
Anton Komlev3356ba32022-03-31 22:02:11 +010086The Reference Manual will be generated in the ``build_docs/reference_manual``.
Anton Komlev4c436bf2021-10-18 21:59:55 +010087
88.. tabs::
89
90 .. group-tab:: Linux
91
92 .. code-block:: bash
93
94 cd <TF-M base folder>
95 cmake -S docs -B build_docs
96 cmake --build build_docs -- tfm_docs_refman_html tfm_docs_refman_pdf
97
98 .. group-tab:: Windows
Summer Qin7e741112021-05-25 15:46:37 +080099
100 .. code-block:: bash
101
102 cd <TF-M base folder>
Anton Komlevceafd012021-10-11 23:21:11 +0100103 cmake -S docs -B build_docs -G"Unix Makefiles"
104 cmake --build build_docs -- tfm_docs_refman_html tfm_docs_refman_pdf
Summer Qin7e741112021-05-25 15:46:37 +0800105
Summer Qin7e741112021-05-25 15:46:37 +0800106*********************
107Build TF-M User Guide
108*********************
109
Anton Komlev3356ba32022-03-31 22:02:11 +0100110The User Manual will be available under the directory ``build_docs/user_guide``.
Summer Qin7e741112021-05-25 15:46:37 +0800111
112.. tabs::
113
114 .. group-tab:: Linux
115
Summer Qin7e741112021-05-25 15:46:37 +0800116 .. code-block:: bash
117
Anton Komlev4c436bf2021-10-18 21:59:55 +0100118 cd <TF-M base folder>
119 cmake -S docs -B build_docs
120 cmake --build build_docs -- tfm_docs_userguide_html tfm_docs_userguide_pdf
Summer Qin7e741112021-05-25 15:46:37 +0800121
122 .. group-tab:: Windows
123
Summer Qin7e741112021-05-25 15:46:37 +0800124 .. code-block:: bash
125
126 cd <TF-M base folder>
Anton Komlevceafd012021-10-11 23:21:11 +0100127 cmake -S docs -B build_docs -G"Unix Makefiles"
128 cmake --build build_docs -- tfm_docs_userguide_html tfm_docs_userguide_pdf
Summer Qin7e741112021-05-25 15:46:37 +0800129
Anton Komlev4c436bf2021-10-18 21:59:55 +0100130
131***************************************
132Direct build using a command line tools
133***************************************
134
135The direct build will build both user_guide and reference_manual.
136
137
138.. tabs::
139
140 .. group-tab:: Linux
141
142 .. code-block:: bash
143
144 # Build the documentation from build_docs directory
145 cd <TF-M base folder>
146 mkdir build_docs
147 cp docs/conf.py build_docs/conf.py
148 cd build_docs
149 sphinx-build ./ user_guide
150
151 .. group-tab:: Windows
152
153 .. code-block:: bash
154
155 # Command line tools is yet not available for Windows
156
Anton Komlev91281f02022-04-22 09:24:20 +0100157************
Anton Komlev4c436bf2021-10-18 21:59:55 +0100158Dependencies
Anton Komlev91281f02022-04-22 09:24:20 +0100159************
Anton Komlev4c436bf2021-10-18 21:59:55 +0100160
161.. uml::
162
163 @startuml
164 skinparam state {
165 BackgroundColor #92AEE0
166 FontColor black
167 FontSize 16
168 AttributeFontColor black
169 AttributeFontSize 16
170 BackgroundColor<<pdf>> #A293E2
171 BackgroundColor<<doc>> #90DED6
172 }
173 state u_guide as "User Guide" <<doc>>
174 state refman as "Reference Manual" <<doc>>
175 state rtd_theme as "sphinx-rtd-theme" <<doc>>
176 state tabs as "sphinx-tabs" <<doc>>
177 state sphnix_puml as "sphinxcontrib-plantuml" <<doc>>
178 state sphnix_svg as "sphinxcontrib-svg2pdfconverter" <<doc>>
179 state JRE as "JRE" <<doc>> : Java Runtime Environment
180 state gwiz as "Graphwiz dot" <<doc>>
181 state Sphinx as "Sphinx" <<doc>>
182 state python as "Python v3" <<doc>>
183 state m2r as "m2r2" <<doc>>
184 state PlantUML as "PlantUML" <<doc>>
185 state LaTex as "LaTex" <<pdf>>
186 state PdfLaTex as "PdfLaTex" <<pdf>>
187 state Doxygen as "Doxygen" <<doc>>
188 state librsvg as "librsvg2-bin" <<doc>>
189
190 [*] --> u_guide
191 u_guide --> Sphinx
192 Sphinx --> m2r
193 Sphinx --> rtd_theme
194 Sphinx --> tabs
195 Sphinx --> sphnix_puml
196 Sphinx --> sphnix_svg
197 m2r --> python
198 rtd_theme --> python
199 tabs --> python
200 sphnix_puml --> python
201 sphnix_svg --> python
202 sphnix_svg --> librsvg
203 Sphinx --> PlantUML
204 PlantUML --> JRE
205 PlantUML --> gwiz
206 Sphinx --> LaTex
207 LaTex --> PdfLaTex
208
209 [*] --> refman
210 refman --> Doxygen
211 Doxygen --> PlantUML
212 Doxygen --> LaTex
213 state Legend {
214 state x as "For PDF generation only" <<pdf>>
215 }
216
217 @enduml
218
Summer Qin7e741112021-05-25 15:46:37 +0800219
220.. _sphinx-build: https://www.sphinx-doc.org/en/master/man/sphinx-build.html
221.. _Doxygen: https://www.doxygen.nl
222
223--------------
224
Anton Komlev267e5c02023-01-24 18:18:33 +0000225*Copyright (c) 2017-2023, Arm Limited. All rights reserved.*