Summer Qin | 7e74111 | 2021-05-25 15:46:37 +0800 | [diff] [blame] | 1 | ######################## |
| 2 | Documentation generation |
| 3 | ######################## |
| 4 | |
| 5 | The build system is prepared to support generation of two documents: |
| 6 | |
| 7 | - Reference Manual. Doxygen based. |
| 8 | - User Guide. Sphinx based. |
| 9 | |
Anton Komlev | ceafd01 | 2021-10-11 23:21:11 +0100 | [diff] [blame] | 10 | Both documents can be generated in HTML and PDF format and independently from |
| 11 | building the project binary artifacts. |
Summer Qin | 7e74111 | 2021-05-25 15:46:37 +0800 | [diff] [blame] | 12 | |
| 13 | *************************** |
| 14 | Build TF-M Reference Manual |
| 15 | *************************** |
| 16 | |
| 17 | The 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 Komlev | 6be1603 | 2021-10-13 21:51:23 +0100 | [diff] [blame^] | 42 | # 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 Qin | 7e74111 | 2021-05-25 15:46:37 +0800 | [diff] [blame] | 47 | 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 Komlev | ceafd01 | 2021-10-11 23:21:11 +0100 | [diff] [blame] | 54 | cmake -S docs -B build_docs |
| 55 | cmake --build build_docs -- tfm_docs_refman_html tfm_docs_refman_pdf |
Summer Qin | 7e74111 | 2021-05-25 15:46:37 +0800 | [diff] [blame] | 56 | |
| 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 Komlev | 6be1603 | 2021-10-13 21:51:23 +0100 | [diff] [blame^] | 101 | # 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 Qin | 7e74111 | 2021-05-25 15:46:37 +0800 | [diff] [blame] | 106 | 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 Komlev | ceafd01 | 2021-10-11 23:21:11 +0100 | [diff] [blame] | 115 | cmake -S docs -B build_docs -G"Unix Makefiles" |
| 116 | cmake --build build_docs -- tfm_docs_refman_html tfm_docs_refman_pdf |
Summer Qin | 7e74111 | 2021-05-25 15:46:37 +0800 | [diff] [blame] | 117 | |
Anton Komlev | ceafd01 | 2021-10-11 23:21:11 +0100 | [diff] [blame] | 118 | The documentation files will be available under the directory ``build_docs\docs\reference_manual``. |
Summer Qin | 7e74111 | 2021-05-25 15:46:37 +0800 | [diff] [blame] | 119 | |
| 120 | ********************* |
| 121 | Build TF-M User Guide |
| 122 | ********************* |
| 123 | |
| 124 | The following tools are needed: |
| 125 | |
| 126 | - Python3 and the following modules: |
Summer Qin | 27a9384 | 2021-06-25 15:44:14 +0800 | [diff] [blame] | 127 | - Sphinx v2.0.1 |
Summer Qin | 7e74111 | 2021-05-25 15:46:37 +0800 | [diff] [blame] | 128 | - m2r v0.2.0 |
| 129 | - sphinxcontrib-plantuml |
| 130 | - sphinxcontrib-svg2pdfconverter |
| 131 | - sphinx-rtd-theme |
Summer Qin | 27a9384 | 2021-06-25 15:44:14 +0800 | [diff] [blame] | 132 | - docutils v0.16 |
Summer Qin | 7e74111 | 2021-05-25 15:46:37 +0800 | [diff] [blame] | 133 | - 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 Hu | 828aa57 | 2021-07-08 22:09:16 +0800 | [diff] [blame] | 138 | - librsvg2-bin - a SVG pictures renderer library to support |
| 139 | sphinxcontrib-svg2pdfconverter |
Summer Qin | 7e74111 | 2021-05-25 15:46:37 +0800 | [diff] [blame] | 140 | |
| 141 | .. tabs:: |
| 142 | |
| 143 | .. group-tab:: Linux |
| 144 | |
| 145 | 1. Set-up the tools and environment: |
| 146 | |
| 147 | .. code-block:: bash |
| 148 | |
Summer Qin | 27a9384 | 2021-06-25 15:44:14 +0800 | [diff] [blame] | 149 | sudo apt-get install -y python3 graphviz default-jre librsvg2-bin |
Summer Qin | 7e74111 | 2021-05-25 15:46:37 +0800 | [diff] [blame] | 150 | 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 Komlev | ceafd01 | 2021-10-11 23:21:11 +0100 | [diff] [blame] | 165 | cmake -S docs -B build_docs |
| 166 | cmake --build build_docs -- tfm_docs_userguide_html tfm_docs_userguide_pdf |
Summer Qin | 7e74111 | 2021-05-25 15:46:37 +0800 | [diff] [blame] | 167 | |
Anton Komlev | ceafd01 | 2021-10-11 23:21:11 +0100 | [diff] [blame] | 168 | The documentation files will be available under the directory ``build_docs/docs/user_guide``. |
Summer Qin | 7e74111 | 2021-05-25 15:46:37 +0800 | [diff] [blame] | 169 | |
| 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 Komlev | ceafd01 | 2021-10-11 23:21:11 +0100 | [diff] [blame] | 233 | cmake -S docs -B build_docs -G"Unix Makefiles" |
| 234 | cmake --build build_docs -- tfm_docs_userguide_html tfm_docs_userguide_pdf |
Summer Qin | 7e74111 | 2021-05-25 15:46:37 +0800 | [diff] [blame] | 235 | |
Anton Komlev | ceafd01 | 2021-10-11 23:21:11 +0100 | [diff] [blame] | 236 | The documentation files will be available under the directory ``build_docs\docs\user_guide``. |
Summer Qin | 7e74111 | 2021-05-25 15:46:37 +0800 | [diff] [blame] | 237 | |
| 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.* |