您的位置:首页 > 其它

CCSv7使用指南连载3:CCS文件及编译构建过程

2017-12-03 21:33 411 查看
版权声明:本系列文章欢迎转载,请注明出处,谢谢!

1 摘要

CCSv7是Texas Instruments针对自家嵌入式处理器或者单片机开发推出的集成开发环境,同时CCSv7也是完全免费的开发软件。本系列文章主要目的是介绍CCS使用入门及在实际项目开发过程中有用的技巧及方法,第3篇介绍如何在同一个workspace下面管理工程以及相应CCS文件的介绍。

2 打开或者关闭工程

有时候在同一个workspace里面会有多个工程,短时间内不会用到的工程建议将其close掉,如下图所示。当这个工程被close了,仍然会在workspace里面保留,但是没法打开其中的源文件或者修改,而且关闭的工程会占用更少的电脑缓存,会提高CCS的使用性能。另外,被close的工程又可以通过右键将其open。



3 CCS工程文件夹下的文件

当我们打开CCS工程(以C2000 controlsuite下的例程为例)后,可以看到如下图所示的文件。



基本作用如下所示

基本作用如下所示(摘自TI相关文档)

.ccsproject: Stores project settings contributed by TI

Ex: Stores initial device/toolchain settings entered by user at project creation

.cproject: Stores project settings contributed by CDT (C/C++ Development Tooling)

Ex: Stores most of the build properties under the ‘Build’ section (most of the compiler/linker options)

.project: Stores project settings contributed by Eclipse

Ex: Stores information for linked resources, linked resource variables, resource filters

.settings (folder): Stores project specific settings that differ from the default CCS settings (workspace preferences)

makefile.defs (SYS/BIOS): Additional make rules included by the generated project makefile for SYS/BIOS projects

4 构建过程

在CCS中构建项目是将编译命令和输入文件传递到RTSC和编译器工具的步骤。 RTSC工具仅适用于涉及RTSC组件(IPC,SYS / BIOS等)的项目,并在构建器工具之前调用。每个构建工具接受组输入文件并生成输出文件。

下图显示了典型的软件开发流程,并提供了编译CCS项目时涉及的编译工具和文件的概念。所有这些都由makefile在后台处理,理解这个过程有助于理解工程编译的整个过程。



软件开发流程的最常见流程是通过Compliler/Assembler/Linker从C / C ++源文件到可执行文件。Assembler步骤通常在后台运行,对用户是隐藏的。

Compiler: accepts C/C++ source files and produces assembly language source code.

Assembler: translates assembly language source files into machine language relocatable object files.

Linker: combines relocatable object files into a single absolute executable object file. It accepts relocatable object files and object libraries as input.

Archiver: allows you to collect a group of files into a single archive file, called a library. It also allows you to modify a library by deleting, replacing, extracting, or adding members.

Library build utility: allows you to build customized run-time-support libraries.

5 后构建过程

.out可执行文件生成了以后,可以使用CCS将文件加载到芯片中进行调试,或者将其转化为hex格式,使用hex编程器去进行编程。后构建过程主要包括下图中标注成蓝色的过程,



Hex conversion utility: converts an object file into other hex formats.

Absolute Lister: accepts linked object files as input and creates .abs files as output. You can assemble these .abs files to produce a listing that contains absolute, rather than relative, addresses.

Cross-reference Lister: uses object files to produce a cross-reference listing showing symbols, their definitions, and their references in the linked source files.

Object file utilities: comprises of utilities such as Object File Display utility, Disassembler, Name utility and Strip utility.

使用TI提供的mkhex4bin.exe即可在CCS下面生成所需的.bin,任何使用CCS开发的芯片平台都可以支持。C:\ti\ccsv5\utils\tiobj2bin

d238
具体步骤:

A 修改tiobj2bin.bat脚本

此脚本完成指定平台的hex到bin文件格式的转换。在ControlSuite的安装目录C:\ti\ccsv5\utils\tiobj2bin下。

原始文件是支持470平台的,修改为C2000,平台把hex470 改为hex2000,ofd470改为ofd2000,诸如此法。

B 添加处理命令

(1)点击“Project”->”Properties”进入设置

(2)点击“Build”->”Steps”,在Post_build steps的Command里加入如下指令。

“CCEINSTALLROOT/utils/tiobj2bin/tiobj2bin""{BuildArtifactFileName}”“BuildArtifactFileBaseName.bin""{CG_TOOL_ROOT}/bin/armofd” “CGTOOLROOT/bin/armhex""{CCE_INSTALL_ROOT}/utils/tiobj2bin/mkhex4bin”

另外,可能出现的问题是生成的.bin文件过大,那么可以检查cmd文件配置,把代码begin位还有.text程序段等所有的都改到同一扇区就可以了,中间补了0主要是因为cmd文件中程序存放位置配置的问题。跨度太大,全部改到一个或者临近的几个扇区可以解决问题。



请关注公众号【C2000小百科】,更多内容将会在公众号中发布。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: