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