blob: 29032be807a197010532958d96d9645ba56d13da [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:
119 - Sphinx v1.7.9
120 - m2r v0.2.0
121 - sphinxcontrib-plantuml
122 - sphinxcontrib-svg2pdfconverter
123 - sphinx-rtd-theme
124 - Graphviz dot v2.38.0 or later
125 - PlantUML v1.2018.11 or later
126 - Java runtime environment 1.8 or later (for running PlantUML)
127 - LaTeX - for PDF generation only
128 - PdfLaTeX - for PDF generation only
129
130.. tabs::
131
132 .. group-tab:: Linux
133
134 1. Set-up the tools and environment:
135
136 .. code-block:: bash
137
138 sudo apt-get install -y python3 graphviz default-jre
139 pip install -r tools/requirements.txt
140 mkdir ~/plantuml
141 curl -L http://sourceforge.net/projects/plantuml/files/plantuml.jar/download --output ~/plantuml/plantuml.jar
142
143 # For PDF generation
144 sudo apt-get install -y doxygen-latex
145 export PLANTUML_JAR_PATH=~/plantuml/plantuml.jar
146
147 2. Currently, there are two ways of building TF-M user guide:
148
149 - Using the CMake build system as custom targets
150
151 .. code-block:: bash
152
153 cd <TF-M base folder>
154 cmake -S . -B cmake_doc -DTFM_PLATFORM=arm/mps2/an521
155 cmake --build cmake_doc -- tfm_docs_userguide_html tfm_docs_userguide_pdf
156
157 The documentation files will be available under the directory ``cmake_doc/docs/user_guide``.
158
159 - Manually using the appropriate tools (`sphinx-build`_/ `Doxygen`_)
160
161 .. code-block:: bash
162
163 # Build the documentation from build_docs directory
164 cd <TF-M base folder>
165 mkdir build_docs
166 cp docs/conf.py build_docs/conf.py
167 cd build_docs
168 sphinx-build ./ user_guide
169
170 # Build the documentation from a custom location
171 # setting the build_docs as input
172
173 # Note that using this method will still generate the reference manual
174 # to the <TF-M base folder>/build_docs/reference_manual
175 cd <TF-M base folder>/<OTHER_DIR>/<OTHER_DIR2>
176 sphinx-build <TF-M base folder>/build_docs/ <DESIRED_OUTPUT_DIR>
177
178 .. Note::
179
180 Invoking Sphinx-build will build both user_guide and
181 reference_manual targets.
182
183 .. group-tab:: Windows
184
185 1. Download and install the following tools:
186
187 - `Graphviz 2.38 <https://graphviz.gitlab.io/_pages/Download/windows/graphviz-2.38.msi>`__
188 - The Java runtime is part of the Arm DS installation or can be `downloaded from here <https://www.java.com/en/download/>`__
189 - `PlantUML <http://sourceforge.net/projects/plantuml/files/plantuml.jar/download>`__
190 - `MikTeX <https://miktex.org/download>`__ - for PDF generation only
191 - Python3 `(native Windows version) <https://www.python.org/downloads/>`__
192 - The necessary Python3 packages are listed in the requirements.txt file.
193
194 To install all needed packages just do:
195
196 .. code-block:: bash
197
198 pip install -r tools\requirements.txt
199
200 .. Note::
201 When building the documentation the first time, MikTeX might prompt
202 for installing missing LaTeX components. Please allow the MikTeX
203 package manager to set-up these.
204
205 2. Set the environment variables, assuming that:
206
207 - plantuml.jar is available at c:\\plantuml\\plantuml.jar
208 - doxygen, dot, and MikTeX binaries are available on the PATH.
209 - Java JVM is used from DS5 installation.
210
211 .. code-block:: bash
212
213 set PLANTUML_JAR_PATH=<plantuml_Path>\plantuml.jar
214 set PATH=$PATH;<ARM_DS_PATH>\sw\java\bin
215
216 3. Using the CMake build system as custom targets to build TF-M user
217 guide:
218
219 .. code-block:: bash
220
221 cd <TF-M base folder>
222 cmake -S . -B cmake_doc -DTFM_PLATFORM=arm/mps2/an521
223 cmake --build cmake_doc -- tfm_docs_userguide_html tfm_docs_userguide_pdf
224
225 The documentation files will be available under the directory ``cmake_doc\docs\user_guide``.
226
227.. _sphinx-build: https://www.sphinx-doc.org/en/master/man/sphinx-build.html
228.. _Doxygen: https://www.doxygen.nl
229
230--------------
231
232*Copyright (c) 2017-2021, Arm Limited. All rights reserved.*