![]() |
RT-Thread RTOS
An open source embedded real-time operating system
|
RT-Thread Online Documentation is created based on doxygen and is available at: https://rt-thread.github.io/rt-thread/. It is consisted of two parts.
One part is the detailed introduction of Kernel, which is written in markdown format and converted into HTML page by doxygen. It is displayed under "RT-Thread User Guide" in Treeview on the left side of the browser. Each sub-chapter is organized into a hierarchical structure by using doxygen's subpage mechanism. To define a page, we use @page
command. The page name should be prefixed with a "page_", and the page name should be unique. Besides this, there are no special requirements for writing this part, so I will not go into details in this article.
The other part is the description of API. RT-Thread uses doxygen to automate the generation of documentation from source code comments, parsing information about classes, functions, and variables to produce output in format of HTML. It is displayed under "Modules" in Treeview on the left side of the browser. Each sub-chapter is organized into a hierarchical structure by using doxygen's topics mechanism. The main content of this article is to describe how to write API with doxygen.
By default, API documentation is written in header files, but there are exceptions, such as for functions.
There are several ways to mark a comment block as a detailed description. We prefer JavaDoc-style (C-style) comment block with some additional markings to document the code, like this:
When you want to put documentation after members, we prefer a Qt style, like this:
When writing comments based on doxygen, several commands defined by doxygen are used. See https://www.doxygen.nl/manual/commands.html for more details about doxygen commands.
More details refer to Doxygen Docs: Documenting the code
This article provide an example.
Click Doxygen Example for the corresponding HTML documentation that is generated by Doxygen.
The contents of Example are described in the following chapters:
The following steps are verified on Ubuntu 22.04:
The following packages (and dependents) need to be installed:
Assume that the path of RT-Thead code tree is $RTT, execute the following command to build html.
A new html directory will be created and all the html files will be placed in this directory.
If you want to quickly browse HTML locally (in Ubuntu environment), you can enter the html directory and start a local HTML server through Python.
A bash script run.sh
is provided to automatic upon operations.
Then open the browser and enter http://<IP>:8000/index.html
to access the created html web pages. If it is a local access, then <IP>
should be replaced by localhost
. If it is a remote access, then <IP>
should be replaced by the actual accessible IP address of the machine where HTML is located.
Doxywizard
File
-> Open
Run
, Click Run doxygen
There is a script can help you write comments more easily.You can copy the code to your setting.json inner .vscode folder.
If you perfer to write mutiple lines comments at behind one doxygen command, Auto Comment Blocks extension can auto complete "*" at the start of line when you start a new line.