1. 程式人生 > 其它 >如何使用Doxygen生成keil工程的程式碼文件 (how to use doxygen properly with keil)(轉)

如何使用Doxygen生成keil工程的程式碼文件 (how to use doxygen properly with keil)(轉)

文章轉自:如何使用Doxygen生成keil工程的程式碼文件 (how to use doxygen properly with keil) - 緣起花淵 - 部落格園 (cnblogs.com)

已經體驗過使用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生成文件。