blob: 2dca171501b964a7a3bc0d1d893fd0fecd963e80 [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
Nik Dewallye6cd9da2024-06-14 14:23:12 +010041 Install the required tools:
42
Summer Qin7e741112021-05-25 15:46:37 +080043 .. code-block:: bash
44
45 sudo apt-get install -y doxygen graphviz default-jre
46 mkdir ~/plantuml
47 curl -L http://sourceforge.net/projects/plantuml/files/plantuml.jar/download --output ~/plantuml/plantuml.jar
Summer Qin7e741112021-05-25 15:46:37 +080048
49 # For PDF generation
Nik Dewallye6cd9da2024-06-14 14:23:12 +010050 sudo apt-get install -y doxygen-latex librsvg2-bin
Summer Qin7e741112021-05-25 15:46:37 +080051
Anton Komlev4c436bf2021-10-18 21:59:55 +010052 # Install the required Python modules
Anton Komlev6be16032021-10-13 21:51:23 +010053 pip3 install --upgrade pip
Nik Dewallye6cd9da2024-06-14 14:23:12 +010054 cd <TF-M base folder>
Anton Komlev267e5c02023-01-24 18:18:33 +000055 pip3 install -r docs/requirements.txt
Anton Komlev6be16032021-10-13 21:51:23 +010056
Nik Dewallye6cd9da2024-06-14 14:23:12 +010057 Set the environment variables:
58
59 .. code-block:: bash
60
61 export PLANTUML_JAR_PATH=~/plantuml/plantuml.jar
62
Summer Qin7e741112021-05-25 15:46:37 +080063 .. group-tab:: Windows
64
Anton Komlev4c436bf2021-10-18 21:59:55 +010065 Download and install the following tools:
Summer Qin7e741112021-05-25 15:46:37 +080066
Anton Komlev4c436bf2021-10-18 21:59:55 +010067 - `Doxygen 1.8.8 <https://sourceforge.net/projects/doxygen/files/snapshots/doxygen-1.8-svn/windows/doxygenw20140924_1_8_8.zip/download>`__
68 - `Graphviz 2.38 <https://graphviz.gitlab.io/_pages/Download/windows/graphviz-2.38.msi>`__
69 - The Java runtime is part of the Arm DS installation or can be
70 downloaded from `here <https://www.java.com/en/download/>`__
71 - `PlantUML <http://sourceforge.net/projects/plantuml/files/plantuml.jar/download>`__
72 - `MikTeX <https://miktex.org/download>`__ - for PDF generation only
Summer Qin7e741112021-05-25 15:46:37 +080073
Anton Komlev4c436bf2021-10-18 21:59:55 +010074 Set the environment variables, assuming that:
Summer Qin7e741112021-05-25 15:46:37 +080075
Anton Komlev4c436bf2021-10-18 21:59:55 +010076 - doxygen, dot, and MikTeX binaries are available on the PATH.
77 - Java JVM is used from Arm DS installation.
Summer Qin7e741112021-05-25 15:46:37 +080078
79 .. code-block:: bash
80
81 set PLANTUML_JAR_PATH=<plantuml_Path>\plantuml.jar
82 set PATH=$PATH;<ARM_DS_PATH>\sw\java\bin
83
Anton Komlev4c436bf2021-10-18 21:59:55 +010084 # Install the required Python modules
85 pip3 install --upgrade pip
86 cd trusted-firmware-m
Anton Komlev267e5c02023-01-24 18:18:33 +000087 pip3 install -r docs\requirements.txt
Anton Komlev4c436bf2021-10-18 21:59:55 +010088
89***************************
90Build TF-M Reference Manual
91***************************
92
Anton Komlev3356ba32022-03-31 22:02:11 +010093The Reference Manual will be generated in the ``build_docs/reference_manual``.
Anton Komlev4c436bf2021-10-18 21:59:55 +010094
95.. tabs::
96
97 .. group-tab:: Linux
98
99 .. code-block:: bash
100
101 cd <TF-M base folder>
102 cmake -S docs -B build_docs
103 cmake --build build_docs -- tfm_docs_refman_html tfm_docs_refman_pdf
104
105 .. group-tab:: Windows
Summer Qin7e741112021-05-25 15:46:37 +0800106
107 .. code-block:: bash
108
109 cd <TF-M base folder>
Anton Komlevceafd012021-10-11 23:21:11 +0100110 cmake -S docs -B build_docs -G"Unix Makefiles"
111 cmake --build build_docs -- tfm_docs_refman_html tfm_docs_refman_pdf
Summer Qin7e741112021-05-25 15:46:37 +0800112
Summer Qin7e741112021-05-25 15:46:37 +0800113*********************
114Build TF-M User Guide
115*********************
116
Anton Komlev3356ba32022-03-31 22:02:11 +0100117The User Manual will be available under the directory ``build_docs/user_guide``.
Summer Qin7e741112021-05-25 15:46:37 +0800118
119.. tabs::
120
121 .. group-tab:: Linux
122
Summer Qin7e741112021-05-25 15:46:37 +0800123 .. code-block:: bash
124
Anton Komlev4c436bf2021-10-18 21:59:55 +0100125 cd <TF-M base folder>
126 cmake -S docs -B build_docs
127 cmake --build build_docs -- tfm_docs_userguide_html tfm_docs_userguide_pdf
Summer Qin7e741112021-05-25 15:46:37 +0800128
129 .. group-tab:: Windows
130
Summer Qin7e741112021-05-25 15:46:37 +0800131 .. code-block:: bash
132
133 cd <TF-M base folder>
Anton Komlevceafd012021-10-11 23:21:11 +0100134 cmake -S docs -B build_docs -G"Unix Makefiles"
135 cmake --build build_docs -- tfm_docs_userguide_html tfm_docs_userguide_pdf
Summer Qin7e741112021-05-25 15:46:37 +0800136
Anton Komlev4c436bf2021-10-18 21:59:55 +0100137
138***************************************
139Direct build using a command line tools
140***************************************
141
142The direct build will build both user_guide and reference_manual.
143
144
145.. tabs::
146
147 .. group-tab:: Linux
148
149 .. code-block:: bash
150
151 # Build the documentation from build_docs directory
152 cd <TF-M base folder>
153 mkdir build_docs
154 cp docs/conf.py build_docs/conf.py
155 cd build_docs
156 sphinx-build ./ user_guide
157
158 .. group-tab:: Windows
159
160 .. code-block:: bash
161
162 # Command line tools is yet not available for Windows
163
Anton Komlev91281f02022-04-22 09:24:20 +0100164************
Anton Komlev4c436bf2021-10-18 21:59:55 +0100165Dependencies
Anton Komlev91281f02022-04-22 09:24:20 +0100166************
Anton Komlev4c436bf2021-10-18 21:59:55 +0100167
168.. uml::
169
170 @startuml
171 skinparam state {
172 BackgroundColor #92AEE0
173 FontColor black
174 FontSize 16
175 AttributeFontColor black
176 AttributeFontSize 16
177 BackgroundColor<<pdf>> #A293E2
178 BackgroundColor<<doc>> #90DED6
179 }
180 state u_guide as "User Guide" <<doc>>
181 state refman as "Reference Manual" <<doc>>
182 state rtd_theme as "sphinx-rtd-theme" <<doc>>
183 state tabs as "sphinx-tabs" <<doc>>
184 state sphnix_puml as "sphinxcontrib-plantuml" <<doc>>
185 state sphnix_svg as "sphinxcontrib-svg2pdfconverter" <<doc>>
186 state JRE as "JRE" <<doc>> : Java Runtime Environment
187 state gwiz as "Graphwiz dot" <<doc>>
188 state Sphinx as "Sphinx" <<doc>>
189 state python as "Python v3" <<doc>>
190 state m2r as "m2r2" <<doc>>
191 state PlantUML as "PlantUML" <<doc>>
192 state LaTex as "LaTex" <<pdf>>
193 state PdfLaTex as "PdfLaTex" <<pdf>>
194 state Doxygen as "Doxygen" <<doc>>
195 state librsvg as "librsvg2-bin" <<doc>>
196
197 [*] --> u_guide
198 u_guide --> Sphinx
199 Sphinx --> m2r
200 Sphinx --> rtd_theme
201 Sphinx --> tabs
202 Sphinx --> sphnix_puml
203 Sphinx --> sphnix_svg
204 m2r --> python
205 rtd_theme --> python
206 tabs --> python
207 sphnix_puml --> python
208 sphnix_svg --> python
209 sphnix_svg --> librsvg
210 Sphinx --> PlantUML
211 PlantUML --> JRE
212 PlantUML --> gwiz
213 Sphinx --> LaTex
214 LaTex --> PdfLaTex
215
216 [*] --> refman
217 refman --> Doxygen
218 Doxygen --> PlantUML
219 Doxygen --> LaTex
220 state Legend {
221 state x as "For PDF generation only" <<pdf>>
222 }
223
224 @enduml
225
Summer Qin7e741112021-05-25 15:46:37 +0800226
227.. _sphinx-build: https://www.sphinx-doc.org/en/master/man/sphinx-build.html
228.. _Doxygen: https://www.doxygen.nl
229
230--------------
231
Nik Dewallye6cd9da2024-06-14 14:23:12 +0100232*Copyright (c) 2017-2024, Arm Limited. All rights reserved.*