RTSC(RTSC, pronounced "rit-see")是一个基于C的编程模型,用于开发创建或实施嵌入式平台实时软件组件。XDCtools包含使用RTSC的工具和运行时组件。网站:http://rtsc.eclipse.org/docs-tip/Main_PageXDC(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.
Command line:
XDCtools仅有两个核心命令:Command
- xdceXpanDed C package build commandCommand
- xsXDCscript interpreterxdc-
which is used to produce packages, andxs-
which is used to run commands delivered in packages.
Use:
可以使用如下命令打开CDOC参考帮助文档xs xdc.tools.cdoc.sg另外提供一些其他的实用库Each of the commands shown in the tablebelow is run using the xs utility above.Command - xdc.tools.cdocPackage documentation toolCommand - xdc.tools.cdoc.sgInteractive package documentation
tool(交互式包文档工具)Command - xdc.tools.checkRepository compatibility check tool(库兼容性检测)Command - xdc.tools.closureClosure toolCommand - xdc.tools.configuroTarget content configuration
tool(目标配置工具)Command - xdc.tools.pathPackage path display toolCommand - xdc.tools.path.sgInteractive Package Path browser
toolCommand - xdc.tools.repomanRepository management toolCommand - xdc.tools.repoman.sgInteractive 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#includeint main() {System_printf("Hello World!
");return
(0);}第一个#include是所有使用RTSC的C程序必须的,定义基本类型第二个#include使C代码可以使用xdc.runtime.Systemmodule提供的System_printf()function。配置文件如下hello.cfg var System =xdc.useModule("xdc.runtime.System");注意:如果没有使用xdc.runtime.System包里的函数的话,包含此包会引起连接错误。在编译之前你还要制定目标和平台
Atargetidentifies
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.
Aplatformidentifies
the hardware executionenvironment as seen by your application. For example, a DM6446 EVM with 64 MBof DDR2 external memory.下图展示了xdc命令的格式
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 runsconfiguroand
uses thecompiler.optandlinker.cmdfiles
generated byconfiguroas
part of the compile and link steps.CGTOOLS = C:/CCStudio_v3.3/C6000/cgtoolsCC = $(CGTOOLS)/bin/cl6xLNK = $(CGTOOLS)/bin/lnk6xRTS = $(CGTOOLS)/lib/rts6400.libCONFIG = helloXDCTARGET = ti.targets.C64XDCPLATFORM = ti.platforms.sim6xxx:TMS320C6416.PRECIOUS: %/compiler.opt %/linker.cmd%/compiler.opt: %/linker.cmd ;%/linker.cmd : %.cfgxs 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 $<