blob: d027b3b5e0e82a1985967db2e7cfd815bfb78935 [file] [log] [blame]
David B. Kinder9c50ac32017-09-26 14:11:08 -07001.. _zephyr_doc:
Inaky Perez-Gonzaleze3683c22016-06-13 12:53:57 -07002
David B. Kinder9c50ac32017-09-26 14:11:08 -07003Zephyr documentation
4####################
Rodrigo Caballeroa4a50fa2015-05-15 11:38:34 -05005
David B. Kinder9c50ac32017-09-26 14:11:08 -07006These instructions will walk you through generating the Zephyr Project's
7documentation on your local system using the same documentation sources
8as we use to create the online documentation found at
9https://zephyrproject.org/doc
Rodrigo Caballeroa4a50fa2015-05-15 11:38:34 -050010
David B. Kinder9c50ac32017-09-26 14:11:08 -070011Documentation overview
12**********************
Rodrigo Caballeroa4a50fa2015-05-15 11:38:34 -050013
David B. Kinder9c50ac32017-09-26 14:11:08 -070014Zephyr Project content is written using the reStructuredText markup
15language (.rst file extension) with Sphinx extensions, and processed
16using sphinx to create a formatted stand-alone website. Developers can
17view this content either in its raw form as .rst markup files, or you
18can generate the HTML content and view it with a web browser directly on
19your workstation. This same .rst content is also fed into the Zephyr
20Project's public website documentation area (with a different theme
21applied).
Rodrigo Caballeroa4a50fa2015-05-15 11:38:34 -050022
David B. Kinder9c50ac32017-09-26 14:11:08 -070023You can read details about `reStructuredText`_, and `Sphinx`_ from
David B. Kinder6b554142017-01-15 12:43:03 -080024their respective websites.
25
David B. Kinder9c50ac32017-09-26 14:11:08 -070026The project's documentation contains the following items:
Rodrigo Caballeroa4a50fa2015-05-15 11:38:34 -050027
David B. Kinder9c50ac32017-09-26 14:11:08 -070028* ReStructuredText source files used to generate documentation found at the
David B. Kinder6b554142017-01-15 12:43:03 -080029 https://zephyrproject.org/doc website. Most of the reStructuredText sources
David B. Kinder9c50ac32017-09-26 14:11:08 -070030 are found in the ``/doc`` directory, but others are stored within the
David B. Kinder6b554142017-01-15 12:43:03 -080031 code source tree near their specific component (such as ``/samples`` and
32 ``/boards``)
Rodrigo Caballeroa4a50fa2015-05-15 11:38:34 -050033
David B. Kinder6b554142017-01-15 12:43:03 -080034* Doxygen-generated material used to create all API-specific documents
35 also found at https://zephyrproject.org/doc
Rodrigo Caballeroa4a50fa2015-05-15 11:38:34 -050036
David B. Kinder9c50ac32017-09-26 14:11:08 -070037* Script-generated material for kernel configuration options based on Kconfig
David B. Kinder6b554142017-01-15 12:43:03 -080038 files found in the source code tree
39
David B. Kinder6b554142017-01-15 12:43:03 -080040The reStructuredText files are processed by the Sphinx documentation system,
41and make use of the breathe extension for including the doxygen-generated API
42material. Additional tools are required to generate the
43documentation locally, as described in the following sections.
Rodrigo Caballeroa4a50fa2015-05-15 11:38:34 -050044
45Installing the documentation processors
46***************************************
47
David B. Kinder6b554142017-01-15 12:43:03 -080048Our documentation processing has been tested to run with:
49
David B. Kinder9c50ac32017-09-26 14:11:08 -070050* Doxygen version 1.8.11
51* Sphinx version 1.5.5
52* Breathe version 4.6.0
53* docutils version 0.13.1
David B. Kinder6b554142017-01-15 12:43:03 -080054
55Begin by cloning a copy of the git repository for the zephyr project and
56setting up your development environment as described in :ref:`getting_started`
57or specifically for Ubuntu in :ref:`installation_linux`. (Be sure to
58export the environment variables ``ZEPHYR_GCC_VARIANT`` and
59``ZEPHYR_SDK_INSTALL_DIR`` as documented there.)
60
David B. Kinder9c50ac32017-09-26 14:11:08 -070061Other than ``doxygen``, the documentation tools should be installed using ``pip``.
62If you don't already have pip installed, these commands will install it:
63
64.. code-block:: bash
65
66 $ curl -O 'https://bootstrap.pypa.io/get-pip.py'
67 $ ./get-pip.py
68 $ rm get-pip.py
69
70The documentation generation tools are included in the set of tools
71expected for the Zephyr build environment and so are included in
72``requirements.txt``:
David B. Kinder6b554142017-01-15 12:43:03 -080073
Rodrigo Caballeroa4a50fa2015-05-15 11:38:34 -050074.. code-block:: bash
75
David B. Kinder11d74492017-05-17 13:55:20 -070076 $ sudo -E apt-get install doxygen
Anas Nashif35a70b42017-07-14 17:35:20 +030077 $ pip install -r scripts/requirements.txt
David B. Kinder6b554142017-01-15 12:43:03 -080078
David B. Kinderee713322017-10-17 09:46:49 -070079Documentation presentation theme
80********************************
Rodrigo Caballeroa4a50fa2015-05-15 11:38:34 -050081
David B. Kinder9c50ac32017-09-26 14:11:08 -070082Sphinx supports easy customization of the generated documentation
83appearance through the use of themes. Replace the theme files and do
84another ``make htmldocs`` and the output layout and style is changed.
85The ``read-the-docs`` theme is installed as part of the
86``requirements.txt`` list above, and will be used if it's available, for
87local doc generation.
88
89
90Running the documentation processors
Rodrigo Caballeroa4a50fa2015-05-15 11:38:34 -050091************************************
92
David B. Kinder9c50ac32017-09-26 14:11:08 -070093The ``/doc`` directory in your cloned copy of the Zephyr project git
94repo has all the .rst source files, extra tools, and Makefile for
95generating a local copy of the Zephyr project's technical documentation.
96Assuming the local Zephyr project copy is ``~/zephyr``, here are the
97commands to generate the html content locally:
Rodrigo Caballeroa4a50fa2015-05-15 11:38:34 -050098
99.. code-block:: bash
100
David B. Kinder6b554142017-01-15 12:43:03 -0800101 $ cd ~/zephyr
102 $ source zephyr-env.sh
Anas Nashif602a1432017-10-31 08:35:24 -0400103 $ cd doc
Anas Nashif1e60eff2017-01-09 11:00:08 -0500104 $ make htmldocs
Rodrigo Caballeroa4a50fa2015-05-15 11:38:34 -0500105
David B. Kinder9c50ac32017-09-26 14:11:08 -0700106Depending on your development system, it will take about 15 minutes to
107collect and generate the HTML content. When done, the HTML output will
108be in ``~/zephyr/doc/_build/html/index.html``
Rodrigo Caballeroa4a50fa2015-05-15 11:38:34 -0500109
David B. Kinder9c50ac32017-09-26 14:11:08 -0700110Filtering expected warnings
111***************************
Rodrigo Caballeroc0871e42015-12-08 14:30:34 -0600112
David B. Kinder9c50ac32017-09-26 14:11:08 -0700113Alas, there are some known issues with the doxygen/Sphinx/Breathe
114processing that generates warnings for some constructs, in particular
115around unnamed structures in nested unions or structs. Also, adding
116qualifiers to a function declaration, like __deprecated, can generate a
117warning. While these issues are being considered for fixing in
118Sphinx/Breathe, we've added a post-processing filter on the output of
119the documentation build process to remove "expected" messages from the
120generation process output.
121
122The output from the Sphinx build is processed by the python script
123``scripts/filter-known-issues.py`` together with a set of filter
124configuration files in the ``.known-issues/doc`` folder. (This
125filtering is done as part of the ``doc/Makefile``.)
126
127If you're contributing components included in the Zephyr API
David B. Kinderee713322017-10-17 09:46:49 -0700128documentation and run across these warnings, you can include filtering
David B. Kinder9c50ac32017-09-26 14:11:08 -0700129them out as "expected" warnings by adding a conf file to the
130``.known-issues/doc`` folder, following the example of other conf files
131found there.
132
133.. _reStructuredText: http://sphinx-doc.org/rest.html
134.. _Sphinx: http://sphinx-doc.org/