如何使用Doxygen生成keil工程的代码文档 (how to use doxygen properly with keil)

书接上文,Doxygen生成美丽注释文档(1):初体验

已经体验过使用Doxygen,以注释的方式,同时生成代码文档。

那么对于使用Keil开发单片机程序的话,是否可以集成到Keil软件中使用Doxygen呢。

 

通过查看ARM官网,找到了相应的方法,如下图所示。(小知识:2011年,Keil软件公司被ARM公司收购,Keil公司资产总额为450万美元。)

具体方式如下:

1. 安装Doxygen和graphviz(见前文博客)

2. 打开Keil的 Tool -> Customize Tools Menu...

3. 添加一个名为 Doxygen : Make Template 的工具栏实体。在此项目中:

  * Command : 填写doxygen.exe程序的绝对路径名称

  * Arguments: 填写 -g @p.doxyfile

4. 添加一个名为 Doxygen : Generate Documentation 的工具栏实体。在此项目中:

  * Command: 填写doxygen.exe程序的绝对路径名称

  * Arguments: 填写 @p.doxyfile

步骤3中 -g 是生成doxyfile文档,同doxygen的命令行中帮助内容的1),@p 指代工程名称 ,@p.xxxx 后缀名可以任意内容,但是要保持两个工具栏实体的配置文件名称相同

步骤4中 Arguments 为 @p.doxyfile 表示使用配置文件,生成代码文档,同doxygen命令行中帮助内容的3)

C:\Users>doxygen /? # 帮助
error: configuration file /? not found!
Doxygen version 1.8.14
Copyright Dimitri van Heesch 1997-2015

You can use doxygen in a number of ways:

1) Use doxygen to generate a template configuration file: 
    doxygen [-s] -g [configName] # 生成配置文件  

    If - is used for configName doxygen will write to standard output.

2) Use doxygen to update an old configuration file:
    doxygen [-s] -u [configName]

3) Use doxygen to generate documentation using an existing configuration file:
    doxygen [configName] # 依据配置文件,生成文档

    If - is used for configName doxygen will read from standard input.

4) Use doxygen to generate a template file controlling the layout of the
   generated documentation:
    doxygen -l [layoutFileName.xml]

5) Use doxygen to generate a template style sheet file for RTF, HTML or Latex.
    RTF:        doxygen -w rtf styleSheetFile
    HTML:       doxygen -w html headerFile footerFile styleSheetFile [configFile]
    LaTeX:      doxygen -w latex headerFile footerFile styleSheetFile [configFile]

6) Use doxygen to generate a rtf extensions file
    RTF:   doxygen -e rtf extensionsFile

If -s is specified the comments of the configuration items in the config file will be omitted.
If configName is omitted `Doxyfile' will be used as a default.

-v print version string

C:\Users>

上述2,3,4步骤操作如下图:

 

 

 使用演示如下:

1.  打开一个工程

2. 使用 Tools - Doxygen: Make Template 生成一个配置文件,文件生成路径为uv5文件的路径,名称是工程名称,后缀是.doxyfile

3. 添加这个配置文件 projectName.doxyfile 到工程项目中,打开文件,按照 官网的配置文件说明 配置相关参数。

4. 使用 Tools - Doxygen: Make Documetation 生成文档。

 

参考文献

[1]. ARM Information Center

[2]. Doxygen Manual: Configuration

 

posted @ 2019-09-10 16:13  缘起花渊  阅读(1022)  评论(0编辑  收藏  举报