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 | |
| 42 | 2. Currently, there are two ways of building TF-M reference manual: |
| 43 | |
| 44 | - Using the CMake build system as custom targets |
| 45 | |
| 46 | .. code-block:: bash |
| 47 | |
| 48 | cd <TF-M base folder> |
Anton Komlev | ceafd01 | 2021-10-11 23:21:11 +0100 | [diff] [blame^] | 49 | cmake -S docs -B build_docs |
| 50 | cmake --build build_docs -- tfm_docs_refman_html tfm_docs_refman_pdf |
Summer Qin | 7e74111 | 2021-05-25 15:46:37 +0800 | [diff] [blame] | 51 | |
| 52 | The documentation files will be available under the directory ``cmake_doc/docs/reference_manual``. |
| 53 | |
| 54 | - Manually using the appropriate tools (`sphinx-build`_/ `Doxygen`_) |
| 55 | |
| 56 | .. code-block:: bash |
| 57 | |
| 58 | # Build the documentation from build_docs directory |
| 59 | cd <TF-M base folder> |
| 60 | mkdir build_docs |
| 61 | cp docs/conf.py build_docs/conf.py |
| 62 | cd build_docs |
| 63 | sphinx-build ./ user_guide |
| 64 | |
| 65 | # Build the documentation from a custom location |
| 66 | # setting the build_docs as input |
| 67 | |
| 68 | # Note that using this method will still generate the reference manual |
| 69 | # to the <TF-M base folder>/build_docs/reference_manual |
| 70 | cd <TF-M base folder>/<OTHER_DIR>/<OTHER_DIR2> |
| 71 | sphinx-build <TF-M base folder>/build_docs/ <DESIRED_OUTPUT_DIR> |
| 72 | |
| 73 | .. Note:: |
| 74 | |
| 75 | Invoking Sphinx-build will build both user_guide and |
| 76 | reference_manual targets. |
| 77 | |
| 78 | .. group-tab:: Windows |
| 79 | |
| 80 | 1. Download and install the following tools: |
| 81 | |
| 82 | - `Doxygen 1.8.8 <https://sourceforge.net/projects/doxygen/files/snapshots/doxygen-1.8-svn/windows/doxygenw20140924_1_8_8.zip/download>`__ |
| 83 | - `Graphviz 2.38 <https://graphviz.gitlab.io/_pages/Download/windows/graphviz-2.38.msi>`__ |
| 84 | - The Java runtime is part of the Arm DS installation or can be |
| 85 | downloaded from `here <https://www.java.com/en/download/>`__ |
| 86 | - `PlantUML <http://sourceforge.net/projects/plantuml/files/plantuml.jar/download>`__ |
| 87 | - `MikTeX <https://miktex.org/download>`__ - for PDF generation only |
| 88 | |
| 89 | 2. Set the environment variables, assuming that: |
| 90 | |
| 91 | - doxygen, dot, and MikTeX binaries are available on the PATH. |
| 92 | - Java JVM is used from Arm DS installation. |
| 93 | |
| 94 | .. code-block:: bash |
| 95 | |
| 96 | set PLANTUML_JAR_PATH=<plantuml_Path>\plantuml.jar |
| 97 | set PATH=$PATH;<ARM_DS_PATH>\sw\java\bin |
| 98 | |
| 99 | 3. Using the CMake build system as custom targets to build TF-M |
| 100 | reference manual: |
| 101 | |
| 102 | .. code-block:: bash |
| 103 | |
| 104 | cd <TF-M base folder> |
Anton Komlev | ceafd01 | 2021-10-11 23:21:11 +0100 | [diff] [blame^] | 105 | cmake -S docs -B build_docs -G"Unix Makefiles" |
| 106 | cmake --build build_docs -- tfm_docs_refman_html tfm_docs_refman_pdf |
Summer Qin | 7e74111 | 2021-05-25 15:46:37 +0800 | [diff] [blame] | 107 | |
Anton Komlev | ceafd01 | 2021-10-11 23:21:11 +0100 | [diff] [blame^] | 108 | 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] | 109 | |
| 110 | ********************* |
| 111 | Build TF-M User Guide |
| 112 | ********************* |
| 113 | |
| 114 | The following tools are needed: |
| 115 | |
| 116 | - Python3 and the following modules: |
Summer Qin | 27a9384 | 2021-06-25 15:44:14 +0800 | [diff] [blame] | 117 | - Sphinx v2.0.1 |
Summer Qin | 7e74111 | 2021-05-25 15:46:37 +0800 | [diff] [blame] | 118 | - m2r v0.2.0 |
| 119 | - sphinxcontrib-plantuml |
| 120 | - sphinxcontrib-svg2pdfconverter |
| 121 | - sphinx-rtd-theme |
Summer Qin | 27a9384 | 2021-06-25 15:44:14 +0800 | [diff] [blame] | 122 | - docutils v0.16 |
Summer Qin | 7e74111 | 2021-05-25 15:46:37 +0800 | [diff] [blame] | 123 | - Graphviz dot v2.38.0 or later |
| 124 | - PlantUML v1.2018.11 or later |
| 125 | - Java runtime environment 1.8 or later (for running PlantUML) |
| 126 | - LaTeX - for PDF generation only |
| 127 | - PdfLaTeX - for PDF generation only |
David Hu | 828aa57 | 2021-07-08 22:09:16 +0800 | [diff] [blame] | 128 | - librsvg2-bin - a SVG pictures renderer library to support |
| 129 | sphinxcontrib-svg2pdfconverter |
Summer Qin | 7e74111 | 2021-05-25 15:46:37 +0800 | [diff] [blame] | 130 | |
| 131 | .. tabs:: |
| 132 | |
| 133 | .. group-tab:: Linux |
| 134 | |
| 135 | 1. Set-up the tools and environment: |
| 136 | |
| 137 | .. code-block:: bash |
| 138 | |
Summer Qin | 27a9384 | 2021-06-25 15:44:14 +0800 | [diff] [blame] | 139 | sudo apt-get install -y python3 graphviz default-jre librsvg2-bin |
Summer Qin | 7e74111 | 2021-05-25 15:46:37 +0800 | [diff] [blame] | 140 | 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> |
Anton Komlev | ceafd01 | 2021-10-11 23:21:11 +0100 | [diff] [blame^] | 155 | cmake -S docs -B build_docs |
| 156 | cmake --build build_docs -- tfm_docs_userguide_html tfm_docs_userguide_pdf |
Summer Qin | 7e74111 | 2021-05-25 15:46:37 +0800 | [diff] [blame] | 157 | |
Anton Komlev | ceafd01 | 2021-10-11 23:21:11 +0100 | [diff] [blame^] | 158 | 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] | 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> |
Anton Komlev | ceafd01 | 2021-10-11 23:21:11 +0100 | [diff] [blame^] | 223 | cmake -S docs -B build_docs -G"Unix Makefiles" |
| 224 | cmake --build build_docs -- tfm_docs_userguide_html tfm_docs_userguide_pdf |
Summer Qin | 7e74111 | 2021-05-25 15:46:37 +0800 | [diff] [blame] | 225 | |
Anton Komlev | ceafd01 | 2021-10-11 23:21:11 +0100 | [diff] [blame^] | 226 | 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] | 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.* |