RTSC(RTSC, pronounced "rit-see")是一个基于C的编程模型,用于开发创建或实施嵌入式平台实时软件组件。XDCtools包含使用RTSC的工具和运行时组件。
网站:http://rtsc.eclipse.org/docs-tip/Main_Page
XDC(eXpress DSP Components)是一个为嵌入式实时系统提供可重用组件(称作:包)的标准。
XDC includes tools and standards forAPI development, static configuration, and packaging.
RTSC用户被分成"consumers" and "producers." Consumers integrate target content packages—DSP algorithms,device drivers, TCP/IP stacks, real-time OSes, and so on—into their ownapplications. Producers create the packages used by consumers.
XDCtools仅有两个核心命令:
Command - xdc |
eXpanDed C package build command |
Command - xs |
XDCscript interpreter |
xdc - which is used to produce packages, and
xs - which is used to run commands delivered in packages.
可以使用如下命令打开CDOC参考帮助文档
xs xdc.tools.cdoc.sg
另外提供一些其他的实用库
Each of the commands shown in the tablebelow is run using the xs utility above.
Command - xdc.tools.cdoc Package documentation tool
Command - xdc.tools.cdoc.sg Interactive package documentation tool(交互式包文档工具)
Command - xdc.tools.check Repository compatibility check tool(库兼容性检测)
Command - xdc.tools.closure Closure tool
Command - xdc.tools.configuro Target content configuration tool(目标配置工具)
Command - xdc.tools.path Package path display tool
Command - xdc.tools.path.sg Interactive Package Path browser tool
Command - xdc.tools.repoman Repository management tool
Command - xdc.tools.repoman.sg Interactive repository management tool
所有使用RTSC包的程序都需要一个configuration文件,这个文件声明被使用的包,并被xdc.tools.configuro读取,来生成静态C数据结构,这是连接成程序所必须的。
Configuration文件采用JavaScript语法,关于更多可参考
http://rtsc.eclipse.org/docs-tip/The_XDCscript_Language
配置脚本(configuration scripts,.cfg的文件)列出程序所需组件,RTSC配置框架使用这些脚本生成构建程序所必须的文件,如下图:
一个“hello world” c程序
hello.c
#include
#include
int main() {
System_printf("Hello World!\n");
return (0);
}
第一个#include是所有使用RTSC的C程序必须的,定义基本类型
第二个#include使C代码可以使用 xdc.runtime.System module提供的System_printf() function。
配置文件如下
hello.cfg
var System =xdc.useModule("xdc.runtime.System");
注意:如果没有使用xdc.runtime.System包里的函数的话,包含此包会引起连接错误。
在编译之前你还要制定目标和平台
A target identifies a specific compiler and anISA and runtime model supported by the compiler. For example, the TI C6000compiler for the C64+ ISA running in big endian mode.
A platform identifies the hardware executionenvironment as seen by your application. For example, a DM6446 EVM with 64 MBof DDR2 external memory.
下图展示了xdc命令的格式
xs xdc.tools.configuro -t ti.targets.C64 -p ti.platforms.evmDM642 –c /home/DVRRDK_03.00.00.00/ti_tools/xdc/xdctools_3_23_03_53/ hello.cfg
上述命令将会产生2个输出文件:hello/compiler.opt、hello/linker.cmd。hello/linker.cmd还有其他文件
this linker command file names all libraries that must be passed to thelinker to link your application
hello/compiler.opt
this text file contains compiler options required to build C source thatreference values defined byhello.cfg
由于编译和链接过程依赖于所使用的工具链,下面介绍如何在C/C++编译和链接的过程中使用comlier.opt和linker.cmd。
gmake all" and to build and run the application type"gmake test". When you run "gmake test", the last linedisplayed is the output of the application:
|
Hello World! |
The following example makefile illustrates how tointegrate RTSC configuration with the TI Code Gen Tools compiler and linker.The makefile runs configuro and uses the compiler.opt and linker.cmd files generated by configuro as part of the compile and link steps.
CGTOOLS = C:/CCStudio_v3.3/C6000/cgtools
CC = $(CGTOOLS)/bin/cl6x
LNK = $(CGTOOLS)/bin/lnk6x
RTS = $(CGTOOLS)/lib/rts6400.lib
CONFIG = hello
XDCTARGET = ti.targets.C64
XDCPLATFORM = ti.platforms.sim6xxx:TMS320C6416
.PRECIOUS: %/compiler.opt %/linker.cmd
%/compiler.opt: %/linker.cmd ;
%/linker.cmd : %.cfg
xs xdc.tools.configuro -c $(CGTOOLS) -t $(XDCTARGET) -p $(XDCPLATFORM) $<
%.obj : %.c $(CONFIG)/compiler.opt
$(CC) -@$(CONFIG)/compiler.opt -c $<
hello.out : hello.obj $(CONFIG)/linker.cmd
$(LNK) -o hello.out -c hello.obj $(CONFIG)/linker.cmd $(RTS)
test: hello.out
@$(CGTOOLS)/bin/load6x $<