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