blob: b8bd9ca6db39ab95288692076a7e48574964079b [file] [log] [blame]
Summer Qin7e741112021-05-25 15:46:37 +08001########################
2Documentation generation
3########################
4
5The build system is prepared to support generation of two documents:
6
7- Reference Manual. Doxygen based.
8- User Guide. Sphinx based.
9
Anton Komlevceafd012021-10-11 23:21:11 +010010Both documents can be generated in HTML and PDF format and independently from
11building the project binary artifacts.
Summer Qin7e741112021-05-25 15:46:37 +080012
13***************************
14Build TF-M Reference Manual
15***************************
16
17The following tools are needed:
18
19 - Doxygen v1.8.0 or later
20 - Graphviz dot v2.38.0 or later
21 - PlantUML v1.2018.11 or later
22 - Java runtime environment 1.8 or later (for running PlantUML)
23 - LaTeX - for PDF generation only
24 - PdfLaTeX - for PDF generation only
25
26.. tabs::
27
28 .. group-tab:: Linux
29
30 1. Set-up the needed tools and environment:
31
32 .. code-block:: bash
33
34 sudo apt-get install -y doxygen graphviz default-jre
35 mkdir ~/plantuml
36 curl -L http://sourceforge.net/projects/plantuml/files/plantuml.jar/download --output ~/plantuml/plantuml.jar
37 export PLANTUML_JAR_PATH=~/plantuml/plantuml.jar
38
39 # For PDF generation
40 sudo apt-get install -y doxygen-latex
41
Anton Komlev6be16032021-10-13 21:51:23 +010042 # Additional Python dependencies for documentation
43 pip3 install --upgrade pip
44 cd trusted-firmware-m
45 pip3 install -r tools/requirements_docs.txt
46
Summer Qin7e741112021-05-25 15:46:37 +080047 2. Currently, there are two ways of building TF-M reference manual:
48
49 - Using the CMake build system as custom targets
50
51 .. code-block:: bash
52
53 cd <TF-M base folder>
Anton Komlevceafd012021-10-11 23:21:11 +010054 cmake -S docs -B build_docs
55 cmake --build build_docs -- tfm_docs_refman_html tfm_docs_refman_pdf
Summer Qin7e741112021-05-25 15:46:37 +080056
57 The documentation files will be available under the directory ``cmake_doc/docs/reference_manual``.
58
59 - Manually using the appropriate tools (`sphinx-build`_/ `Doxygen`_)
60
61 .. code-block:: bash
62
63 # Build the documentation from build_docs directory
64 cd <TF-M base folder>
65 mkdir build_docs
66 cp docs/conf.py build_docs/conf.py
67 cd build_docs
68 sphinx-build ./ user_guide
69
70 # Build the documentation from a custom location
71 # setting the build_docs as input
72
73 # Note that using this method will still generate the reference manual
74 # to the <TF-M base folder>/build_docs/reference_manual
75 cd <TF-M base folder>/<OTHER_DIR>/<OTHER_DIR2>
76 sphinx-build <TF-M base folder>/build_docs/ <DESIRED_OUTPUT_DIR>
77
78 .. Note::
79
80 Invoking Sphinx-build will build both user_guide and
81 reference_manual targets.
82
83 .. group-tab:: Windows
84
85 1. Download and install the following tools:
86
87 - `Doxygen 1.8.8 <https://sourceforge.net/projects/doxygen/files/snapshots/doxygen-1.8-svn/windows/doxygenw20140924_1_8_8.zip/download>`__
88 - `Graphviz 2.38 <https://graphviz.gitlab.io/_pages/Download/windows/graphviz-2.38.msi>`__
89 - The Java runtime is part of the Arm DS installation or can be
90 downloaded from `here <https://www.java.com/en/download/>`__
91 - `PlantUML <http://sourceforge.net/projects/plantuml/files/plantuml.jar/download>`__
92 - `MikTeX <https://miktex.org/download>`__ - for PDF generation only
93
94 2. Set the environment variables, assuming that:
95
96 - doxygen, dot, and MikTeX binaries are available on the PATH.
97 - Java JVM is used from Arm DS installation.
98
99 .. code-block:: bash
100
Anton Komlev6be16032021-10-13 21:51:23 +0100101 # Additional Python dependencies for documentation
102 pip3 install --upgrade pip
103 cd trusted-firmware-m
104 pip3 install -r tools\requirements_docs.txt
105
Summer Qin7e741112021-05-25 15:46:37 +0800106 set PLANTUML_JAR_PATH=<plantuml_Path>\plantuml.jar
107 set PATH=$PATH;<ARM_DS_PATH>\sw\java\bin
108
109 3. Using the CMake build system as custom targets to build TF-M
110 reference manual:
111
112 .. code-block:: bash
113
114 cd <TF-M base folder>
Anton Komlevceafd012021-10-11 23:21:11 +0100115 cmake -S docs -B build_docs -G"Unix Makefiles"
116 cmake --build build_docs -- tfm_docs_refman_html tfm_docs_refman_pdf
Summer Qin7e741112021-05-25 15:46:37 +0800117
Anton Komlevceafd012021-10-11 23:21:11 +0100118 The documentation files will be available under the directory ``build_docs\docs\reference_manual``.
Summer Qin7e741112021-05-25 15:46:37 +0800119
120*********************
121Build TF-M User Guide
122*********************
123
124The following tools are needed:
125
126 - Python3 and the following modules:
Summer Qin27a93842021-06-25 15:44:14 +0800127 - Sphinx v2.0.1
Summer Qin7e741112021-05-25 15:46:37 +0800128 - m2r v0.2.0
129 - sphinxcontrib-plantuml
130 - sphinxcontrib-svg2pdfconverter
131 - sphinx-rtd-theme
Summer Qin27a93842021-06-25 15:44:14 +0800132 - docutils v0.16
Summer Qin7e741112021-05-25 15:46:37 +0800133 - Graphviz dot v2.38.0 or later
134 - PlantUML v1.2018.11 or later
135 - Java runtime environment 1.8 or later (for running PlantUML)
136 - LaTeX - for PDF generation only
137 - PdfLaTeX - for PDF generation only
David Hu828aa572021-07-08 22:09:16 +0800138 - librsvg2-bin - a SVG pictures renderer library to support
139 sphinxcontrib-svg2pdfconverter
Summer Qin7e741112021-05-25 15:46:37 +0800140
141.. tabs::
142
143 .. group-tab:: Linux
144
145 1. Set-up the tools and environment:
146
147 .. code-block:: bash
148
Summer Qin27a93842021-06-25 15:44:14 +0800149 sudo apt-get install -y python3 graphviz default-jre librsvg2-bin
Summer Qin7e741112021-05-25 15:46:37 +0800150 pip install -r tools/requirements.txt
151 mkdir ~/plantuml
152 curl -L http://sourceforge.net/projects/plantuml/files/plantuml.jar/download --output ~/plantuml/plantuml.jar
153
154 # For PDF generation
155 sudo apt-get install -y doxygen-latex
156 export PLANTUML_JAR_PATH=~/plantuml/plantuml.jar
157
158 2. Currently, there are two ways of building TF-M user guide:
159
160 - Using the CMake build system as custom targets
161
162 .. code-block:: bash
163
164 cd <TF-M base folder>
Anton Komlevceafd012021-10-11 23:21:11 +0100165 cmake -S docs -B build_docs
166 cmake --build build_docs -- tfm_docs_userguide_html tfm_docs_userguide_pdf
Summer Qin7e741112021-05-25 15:46:37 +0800167
Anton Komlevceafd012021-10-11 23:21:11 +0100168 The documentation files will be available under the directory ``build_docs/docs/user_guide``.
Summer Qin7e741112021-05-25 15:46:37 +0800169
170 - Manually using the appropriate tools (`sphinx-build`_/ `Doxygen`_)
171
172 .. code-block:: bash
173
174 # Build the documentation from build_docs directory
175 cd <TF-M base folder>
176 mkdir build_docs
177 cp docs/conf.py build_docs/conf.py
178 cd build_docs
179 sphinx-build ./ user_guide
180
181 # Build the documentation from a custom location
182 # setting the build_docs as input
183
184 # Note that using this method will still generate the reference manual
185 # to the <TF-M base folder>/build_docs/reference_manual
186 cd <TF-M base folder>/<OTHER_DIR>/<OTHER_DIR2>
187 sphinx-build <TF-M base folder>/build_docs/ <DESIRED_OUTPUT_DIR>
188
189 .. Note::
190
191 Invoking Sphinx-build will build both user_guide and
192 reference_manual targets.
193
194 .. group-tab:: Windows
195
196 1. Download and install the following tools:
197
198 - `Graphviz 2.38 <https://graphviz.gitlab.io/_pages/Download/windows/graphviz-2.38.msi>`__
199 - The Java runtime is part of the Arm DS installation or can be `downloaded from here <https://www.java.com/en/download/>`__
200 - `PlantUML <http://sourceforge.net/projects/plantuml/files/plantuml.jar/download>`__
201 - `MikTeX <https://miktex.org/download>`__ - for PDF generation only
202 - Python3 `(native Windows version) <https://www.python.org/downloads/>`__
203 - The necessary Python3 packages are listed in the requirements.txt file.
204
205 To install all needed packages just do:
206
207 .. code-block:: bash
208
209 pip install -r tools\requirements.txt
210
211 .. Note::
212 When building the documentation the first time, MikTeX might prompt
213 for installing missing LaTeX components. Please allow the MikTeX
214 package manager to set-up these.
215
216 2. Set the environment variables, assuming that:
217
218 - plantuml.jar is available at c:\\plantuml\\plantuml.jar
219 - doxygen, dot, and MikTeX binaries are available on the PATH.
220 - Java JVM is used from DS5 installation.
221
222 .. code-block:: bash
223
224 set PLANTUML_JAR_PATH=<plantuml_Path>\plantuml.jar
225 set PATH=$PATH;<ARM_DS_PATH>\sw\java\bin
226
227 3. Using the CMake build system as custom targets to build TF-M user
228 guide:
229
230 .. code-block:: bash
231
232 cd <TF-M base folder>
Anton Komlevceafd012021-10-11 23:21:11 +0100233 cmake -S docs -B build_docs -G"Unix Makefiles"
234 cmake --build build_docs -- tfm_docs_userguide_html tfm_docs_userguide_pdf
Summer Qin7e741112021-05-25 15:46:37 +0800235
Anton Komlevceafd012021-10-11 23:21:11 +0100236 The documentation files will be available under the directory ``build_docs\docs\user_guide``.
Summer Qin7e741112021-05-25 15:46:37 +0800237
238.. _sphinx-build: https://www.sphinx-doc.org/en/master/man/sphinx-build.html
239.. _Doxygen: https://www.doxygen.nl
240
241--------------
242
243*Copyright (c) 2017-2021, Arm Limited. All rights reserved.*