ARM 之二 Keil 项目/生成的各类文件类型(.AXF、.D、.crf、.exf)说明

  Keil 是 ARM 推出(收购)的针对 Cortex-M 系列等低功耗芯片芯片的集成开发环境的品牌名称。目前 Keil 的最新版本为 µVision5。旧版本的 Keil 目前使用的已经很是少了,当前使用主要以 µVision4 和 µVision5 这两个版本为主。针对不一样的芯片其名称有不一样的叫法,具体参见https://blog.csdn.net/ZCShouCSDN/article/details/81836601。
  在使用 Keil 时,Keil 构建项目时会产生不少扩展名的文件,了解各文件的做用对于深刻研究编译有很大帮助(主要是各类编译输出文件)。例如,.map文件就是个很是有必要在项目开发阶段实时查看,而且深刻研究的文档。一样,其余文件将是深刻研究时有效的参考。
  随着 Keil 的升级,各类文件在不一样版本可能有区别。部分文件在高版本中已经弃用,或者被新的文件代替。具体见下文的说明。适用范围包括 Keil 所有产品:MDK-ARM、C5一、C16六、C251。
  严格来讲,如下部分文件不该该算是 Keil 的文件,由于他们是由编译器产生的,而 Keil 就是个 IDE,ARM 公司除了提供了各类方便的 IDE 以外,还提供独立版的编译套件,能够方便的在命令行中使用。web

Project Files

  项目文件主要是经过 Keil 建立项目(工程)时生成的各类文件,这些文件记录项目(工程)的各类信息。在使用 Keil 打开项目时,Keil 会使用这些文件。app

  • .OPT: Keil 早期版本使用的项目配置选项文件,已经被新的文件替代(具体见下面的说明)。
  • .UVGUI[.user-name]:µVision4 窗口布局文件。即:使用者在调整了Keil 中各窗口布局后,再次打开 Keil 会保持以前的修改,修改就是记录在该文件中。
  • .UVGUIX[.user-name]:µVision5 窗口布局文件,XML格式,记录了 MDK 软件的 GUI 布局,如代码编辑区窗口的大小、编译输出提示窗口的位置等等。
  • .UVMPW:用于多个项目的 μVision4 项目文件(工做空间项目文件)。 包含对其余项目文件的引用,并将它们绑定到一个项目中。 当多个项目分组到一个项目中时,该文件是必需的。 具备 XML 结构,能够在工做组中共享。
  • .UVPROJ: Keil µVision4 的项目文件,它使用了 XML 格式记录了工程的结构,双击它能够打开整个工程。
  • .UVPROJX: Keil µVision5 的项目文件,它使用了 XML 格式记录了工程的结构,就是咱们平时双击打开的工程文件,它记录了整个工程的结构,如芯片类型、工程包含了哪些源文件等内容。
  • .UVOPT: Keil µVision4 项目配置文件,XML 格式,包括调试配置、跟踪信息配置、断点等。
  • .UVOPTX:Keil µVision5 项目配置文件,记录了工程的配置选项,以下载器的类型、变量跟踪配置、断点位置以及当前已打开的文件等等。
  • .UV2: μVision3 项目文件。 使用更高版本的 μVision 打开文件,将文件转换为新的项目类型。

具体见下图:
这里写图片描述编辑器

Source Files

  源码文件应该没啥可说的。表示了Keil 所支持的源码文件类型(支持代码高亮、错误提示等)。ide

  • .A51:汇编源码文件
  • .A66:汇编源码文件
  • .C:C 语言源码文件
  • .CPP:C++ 语言源码文件
  • .H:C/C++ 语言的头文件
  • .INC:汇编语言的头文件(使用"$include"来包含)
  • .S:Assembler source file (typical used for ARM source files).
  • .SRC:Other source file generated by the C compiler.

Listing Files

这部分主要是一些由编译器和链接器输出的中间文件,对于研究编译过程很是有帮助。svg

  • .COD:Complete program listing file. Includes mixed C and Assembly code. All references are resolved and addresses are fixed-up.
  • .HTM:连接器的列表文件。
  • .I: C Preprocessor Output File. 预处理后的文件
  • .LST:Listing file generated by the C Compiler or Assembler. C及汇编编译器产生的列表文件。
  • .MAP:Listing file (or Map file) generated by the Linker. 这个文件仍是很是有用的。咱们查看编译信息利器。
  • .M51: Listing file (or Map file) generated by the Linker.
  • .M66: Listing file (or Map file) generated by the Linker.
  • .SCR: Linker scatter loader file. Generated by the Linker. Can be altered manually.连接器产生的分散加载文件。一般会使用手动指定的.sct文件.

Keil 中能够经过以下配置,来输出其中的某些文件
Listing
用户在选择了这些条目以后,其实就是在命令行工具中增长对应的参数。例如链接器参数
link函数

Object and HEX Files

这部分主要是编译器输出(链接器输出)的各类编译后的文件,包括可执行文件、库文件、对象文件等。工具

  • .(no extension): Absolute Object File (executable programs generated by the Linker).
  • .AXF:Absolute and executable object file generated by the Linker. (链接器产生)可执行文件(ELF文件格式),该格式文件包含大量调试信息。
  • .Bxx:Absolute object file generated by OC51 for individual code banks (xx may be from 00 to 31).
  • .D:Dependency file generated by the ARMCC or GCC compiler.描述了对应.o的依赖的文件
  • .CRF:Cross-Reference file containing browse information (definitions, references for identifiers). 交叉引用文件,它主要包含了浏览信息(browse information),即源代码中的宏定义、变量及函数的定义和声明的位置。,可由上图中的Listing标签配置产生。
      咱们在代码编辑器中右键菜单"Go To Definition Of ‘xxxx’"的时候,,MDK就是经过*.crf文件查找出跳转位置的。该文件使用了特定的格式,具体以下
    这里写图片描述
  • .ELF:ELF/DWARF files generated by the Linker/Locater.
  • .HEX:Intel Hex file, generated by the Object-Hex Conversion Utility. 在单片机中经常使用,MDK中不多用。
  • .H86:Intel Hex file, generated by the Object-Hex Conversion Utility.
  • .LIB:Library object file. (静态)链接库文件。
  • .OBJ: Relocatable object file.
  • .O:Relocatable object files.编译器输出的各类重定位文件,供链接器使用产生可执行文件。
  • .SBR:Source Browser Information file generated by the Linker/Locater.

关于该部分的.ELF.AXF.HEX、文件,详细可见博文ARM 之一 ELF文件、镜像(Image)文件、可执行文件、对象文件 详解布局

Build Files

  • .BAT:batch file that re-creates a project from the command prompt. µVision may create a batch file when Project - Output - Create Batch File is enabled. 构建项目的批处理文件。在 Keil 中能够选择产生这个文件,主要是在命令行中使用。
    Bat
  • ._IA, *.__I, *._II, *.SCR: tool invocation files.

Debugger Files

调试文件没啥可说的。ui

  • .INI:Source code file used typically for initializing the debugger. 这个文件在使用在线调试和Trace时常常用到。能够经过 Keil 的以下界面使用
    Ini
    经常使用的功能以下:
// 在线调试时使用
LOAD %L INCREMENTAL

// 在使用Keil的Trace功能时使用
///*-------------------------------------------------------------------
//** Define the function to enable the trace port
//**-----------------------------------------------------------------*/
//FUNC void EnableTPIU(void) {

// _WDWORD(0xE0042004, 0x000000E0); // Set 4-pin tracing via DBGMCU_CR
//}

///*-------------------------------------------------------------------
//** Invoke the function at debugger startup
//**-----------------------------------------------------------------*/
//EnableTPIU();
  • .dbgconf:Pack options (available for some devices) define default configuration settings for debugging, tracing, or Flash programming and are applied to the options in the dialogs Debug, Trace, and Flash Download. Possibly, not all options have been set. Hence, verify the settings and adapt the configuration when needed.
    关于这部分,详细参见 Keil 官网文章http://www.keil.com/support/man/docs/ulinkpro/ulinkpro_ctx_pack.htm。

Other Files

在部分文件有的是编译器输出,有的是Keil输出的。spa

  • .BUILD_LOG.HTM: Build Log file of the latest project build.
  • .CDB: µVision Device Database file.
  • .DEP: Dependency file for a target build. 整个工程的依赖文件
  • .IC: Intermediate C source file created by the EC++ Compiler.
  • .LIN:Linker control file.
  • .LNP:Linker Input file generated by µVision to be passed to the command line.
  • .ORC: Global Register Coloring file for optimization.
  • .PACK:Software Pack file. Zip-file containing the software and one *.PDSC description file. Mechanism file to distribute device support, Software Components, APIs, and example projects. 存在于 Keil-MDK 5 中
  • .PDSC: Pack Description file. Describes the content of a Software Pack and dependencies to devices, processors, tool chains, or other software components.
  • .PLG:Protocol file that summarizes the last build process.
  • PROJECT_GUI.XSD:XML schema file describing the *.UVGUI file structure. Located in the \UV4 folder.
  • PROJECT_MPW.XSD:XML schema file describing the *.UVMPW file structure. Located in the \UV4 folder.
  • PROJECT_OPT.XSD:XML schema file describing the *.UVOPT file structure. Located in the \UV4 folder.
  • PROJECT_PROJ.XSD:XML schema file describing the *.UVPROJ file structure. Located in the \UV4 folder.
  • .SCT:Linker control file (scatter loading). ***分散加载文件,这个文件很是有用,也很是值得研究研究。***下面是个相对来讲复杂点的分散加载文件:
LR_IROM1 0x08003000 0x00005000  {    ; load region size_region
  ER_IROM1 0x08003000 0x00005000  {  ; load address = execution address
   *.o (RESET, +First)				; 中断向量表
  }

  ER_IROM2 + 0 {					; 应用程序信息
   *.o (SECTION_APP_INFO, +First)
  }

  ER_IROM3 + 0 {					; 初始化相关代码+其余代码
   *(InRoot$$Sections)	; 初始化相关
   .ANY (+RO)			; 其余全部代码
  }

  RW_IRAM1 0x20000000 0x00001800  {  ; 内存
   *.o (SECTION_APP_VECTOR, +First)				/* APP的中断向量表 */
   .ANY (+RW +ZI)
  }
}
  • .SCVD: XML schema file for the Component Viewer (System Component Viewer Description file). The file is provided by the vendor or can be build by the user.
  • .UVL:Signal definition file. Saves the signals that have been defined in the Logic Analyzer.
  • .UVLA:File to store signals that have been recorded with the Logic Analyzer.
  • .UVTSK:Event Viewer file. Saves the recorded task-switching events.
  • .SFD: Intermediary pseudo-XML file used to create an .SFR file (.SVD.XML files are used as input).
  • .SFR:Binary file that stores information which is read by the System Viewer.
  • .SVD.XML, *.SVD, *.XML:CMSIS-XML file formats describing the device (CMSIS System View Description file). The file is provided by the vendor.
  • .XSD: XML schema description file.

参考

http://www.keil.com/support/man/docs/uv4/uv4_b_filetypes.htm