前提假设CCS5安装路径如下:
CCS Installation: D:\\TI\\ccsv5 CCSV5安装路径
Code geeneration Tools: D:\\TI\\ccsv5\ools\\compiler\\c2000 ,编译器的路径 如果其它路径,则需要在下边的应用中相应的路径中更改路径。
【1】 Matlab VS CCSV5
【1】 在matlab 中键入xmakefilesetup ,并设置如下图
图1 gmake设置
【2】 首先将display operational configuration only的勾选去掉,然后在configuration的
下拉中选择ticcs_c2000_ccsv5,如果没有,则点击右上角的New,然后分别在Make Utiliy、Complier、Linker、Archiver、Prebuild、Postbuild、Execute填入一下内容
Make Utiliy:
Make Utility : D:\\PROGRA~1\\MATLAB\\\\R2013a\\bin\\win32\\gmake (这个路径是Matlab的编译路径) Arguments : -f \"[|||MW_XMK_GENERATED_FILE_NAME[R]|||]\" [|||MW_XMK_ACTIVE_BUILD_ACTION_REF|||] Complier :
Complier: D:/ti/ccsv5/tools/compiler/c2000_6.2.0/bin/cl2000 Arguments :-I\"D:/ti/ccsv5/tools/compiler/c2000_6.2.0/include\" -fr\"[|||MW_XMK_DERIVED_PATH_REF|||]\" Linker
Linker: D:/ti/ccsv5/tools/compiler/c2000_6.2.0/bin/cl2000
Arguments : -o [|||MW_XMK_GENERATED_TARGET_REF|||] Archiver
Archievr: D:/ti/ccsv5/tools/compiler/c2000_6.2.0/bin/ar2000 Arguments: -r [|||MW_XMK_GENERATED_TARGET_REF|||]
Prebuild :
不填,空着 Postbuild
不填,空着
Execute 执行编译
Execute Tool: D:\i\\ccsv5\\ccs_base\\scripting\\bin\\dss.bat
Arguments :\"D:\\PROGRA~1\\MATLAB\\R2013a\oolbox\\idelink\\extensions\iccs\\ccsdemos\\runProgram.js\" \"D:\i\\XDS100v2.ccxml\" \"[|||MW_XMK_GENERATED_TARGET_REF[E]|||]\" 接着点击保存即可。,这时将会在C:\\Documents and Settings\\Administrator\\我的文档\\MATLAB\\ 路径下产生这样一个文件名字 ticcs_c2000_ccsv5_clone.m
此文件的内容如下:(如果不想按上边一步一步配置xmakefiletool,可以将ticcs_c2000_ccsv5_clone.m这个文件拷贝到,(C:\\Documents and Settings\\Administrator\\我的文档\\MATLAB\\ )路径下,然后根据自己一些软件的安装位置,修改其中的路径,下面我用绿色标出有可能需要更改的地方。
% NOTE: DO NOT REMOVE THIS LINE XMAKEFILE_TOOL_CHAIN_CONFIGURATION function toolChainConfiguration = ticcs_c2000_ccsv5_clone() %TICCS_C2000_CCSV5_CLONE Defines a tool chain configuration. %
% Copyright 2015 The MathWorks, Inc. % % General
toolChainConfiguration.Configuration = 'ticcs_c2000_ccsv5_clone'; toolChainConfiguration.Version = '2.0';
toolChainConfiguration.Description = 'TI CCS v5 C2000 Tool Chain Configuration';
toolChainConfiguration.Operational = true;
toolChainConfiguration.InstallPath = 'D:\i\\ccsv5\\'; % ccsv5安装路径 toolChainConfiguration.CustomValidator = ''; toolChainConfiguration.Decorator =
'linkfoundation.xmakefile.decorator.c2000CCEv5Decorator'; % Make
toolChainConfiguration.MakePath =
'D:\\PROGRA~1\\MATLAB\\\\R2013a\\bin\\win32\\gmake'; %matlab 的gmake安装路径 toolChainConfiguration.MakeFlags = '-f \"[|||MW_XMK_GENERATED_FILE_NAME[R]|||]\" [|||MW_XMK_ACTIVE_BUILD_ACTION_REF|||]'; toolChainConfiguration.MakeInclude = ''; % Compiler
toolChainConfiguration.CompilerPath =
'D:/ti/ccsv5/tools/compiler/c2000_6.2.0/bin/cl2000'; ccsv5编译器安装路径
toolChainConfiguration.CompilerFlags =
'-I\"D:/ti/ccsv5/tools/compiler/c2000_6.2.0/include\" -fr\"[|||MW_XMK_DERIVED_PATH_REF|||]\"';
toolChainConfiguration.SourceExtensions = '.c,.asm,.abs,.sa'; toolChainConfiguration.HeaderExtensions = '.h'; toolChainConfiguration.ObjectExtension = '.obj'; % Linker
toolChainConfiguration.LinkerPath =
'D:/ti/ccsv5/tools/compiler/c2000_6.2.0/bin/cl2000'; toolChainConfiguration.LinkerFlags = '-o [|||MW_XMK_GENERATED_TARGET_REF|||]';
toolChainConfiguration.LibraryExtensions = '.lib,.cmd'; toolChainConfiguration.TargetExtension = '.out'; toolChainConfiguration.TargetNamePrefix = ''; toolChainConfiguration.TargetNamePostfix = ''; % Archiver
toolChainConfiguration.ArchiverPath =
'D:/ti/ccsv5/tools/compiler/c2000_6.2.0/bin/ar2000'; toolChainConfiguration.ArchiverFlags = '-r [|||MW_XMK_GENERATED_TARGET_REF|||]';
toolChainConfiguration.ArchiveExtension = '.lib'; toolChainConfiguration.ArchiveNamePrefix = ''; toolChainConfiguration.ArchiveNamePostfix= ''; % Pre-build
toolChainConfiguration.PrebuildEnable = false; toolChainConfiguration.PrebuildToolPath = ''; toolChainConfiguration.PrebuildFlags = ''; % Post-build
toolChainConfiguration.PostbuildEnable = false; toolChainConfiguration.PostbuildToolPath = ''; toolChainConfiguration.PostbuildFlags = ''; % Execute
toolChainConfiguration.ExecuteDefault = false; toolChainConfiguration.ExecuteToolPath = 'D:\i\\ccsv5\\ccs_base\\scripting\\bin\\dss.bat'; toolChainConfiguration.ExecuteFlags =
'\"D:\\PROGRA~1\\MATLAB\\R2013a\oolbox\\idelink\\extensions\iccs\\ccsdemos\\runProgram.js\" \"D:\i\\XDS100v2.ccxml\"
\"[|||MW_XMK_GENERATED_TARGET_REF[E]|||]\"'; %matlab ,XDS100V2等文件的放置路径。
% Directories
toolChainConfiguration.DerivedPath = ''; toolChainConfiguration.OutputPath = ''; % Custom
toolChainConfiguration.Custom1 = ''; toolChainConfiguration.Custom2 = ''; toolChainConfiguration.Custom3 = ''; toolChainConfiguration.Custom4 = ''; toolChainConfiguration.Custom5 = ''; end
【3】 然后打开模型,并进行设置,如果是2013A已经去掉 target preferences模块,在
configuration中的 code generation 中选择idelink_ert_tlc,这时下边会出现code
图2 TLC文件选择
Target ,点击它,在target hardware resources中\"IDE/Tool Chain\" ,选择\"Texas
Instruments Code Composer Studio v5 (makefile generation only)\".
注意:首先备份配置,因为这会覆盖已有的配置。然后设置board为C2000,processor为 F28335
图3 configuration parameters/Code generation设置
【4】 检查是否配置成功,在workspace键入checkEnvSetup('ccsv5','F28335 eZdsp',
'setup'),这时如果没有配置成功,系统会自动弹出如下图对话框,提示选
择安装路径等,此过程和xmakefilesetup的设置相似,只不过此处是设置系统环境变量,这样才能让软件通过系统变量找到相关软件的路径,如果配置成功显示如下图,
checkEnvSetup('ccsv5','f28335', 'check),检查配置
checkEnvSetup('ccsv5','f28335', 'setup'),设置环境变量
图4 环境变量检查以及设置
checkEnvSetup('ccsv5','F28335 eZdsp', 'setup')
1. Checking CCSv5 (Code Composer Studio) version Required version: 5.0 or later
Required for : Code Generation Your Version : 5.5.0
### Setting environment variable \"TI_DIR\" to \"D:\i\\ccsv5\"
2. Checking CGT (Texas Instruments C2000 Code Generation Tools) version Required version: 5.2.1 to 6.0.2 Required for : Code generation Your Version : 6.2.0
### Setting environment variable \"C2000_CGT_INSTALLDIR\" to \"D:\i\\ccsv5\ools\\compiler\\c2000_6.2.0\"
The version found for \"CGT\" differs from the one used for our software validation. Use it at your own risk.
3. Checking DSP/BIOS (Real Time Operating System) version Required version: 5.33.05 to 5.41.11.38
Required for : Code generation Your Version : 5.42.01.09
### Setting environment variable \"CCSV5_DSPBIOS_INSTALLDIR\" to \"D:\i\\bios_5_42_01_09\"
The version found for \"DSP/BIOS\" differs from the one used for our software validation. Use it at your own risk.
4. Checking XDC Tools (eXpress DSP Components) version Required version: 3.16.02.32 or later Required for : Code generation Your Version : 3.24.05.48
5. Checking Flash Tools (TMS320C28335 Flash APIs) version Required version: 2.10
Required for : Flash Programming Your Version : 2.10
### Setting environment variable \"FLASH_28335_API_INSTALLDIR\" to \"D:\i\idcs\\c28\\Flash28_API\\Flash28335_API_V210\"
【5】 此时在键入或者键入ccsboardinfo,进行配置查看
过程调试总结:
(1) 此配置确实比较麻烦,不同的版本情况不一样,2010a更复杂一些,不过用ccs3.3没有问题。一定要设置好ticcs_c2000_ccsv5_clone文件的路径否则不能打开(而且一定要放在gmakefile指定的User template路径下面 ,当然可以更改这个路径,只要放在与路径相符的下面即可)。
(2) Matlab2013A已经包含有xmakefile文件。 D:\\Program
Files\\MATLAB\\R2013a\oolbox\\idelink\\extensions\iccs\\registry\\xmakefilecfg\\c2000_cce_v5.m,但是这里需要根据自己软件安装位置进行配置,可以通过修改cceV5.m文件修改,也可以通过xmakefilesetup工具修改,建议使用后者。
(3) 问题3:按照网上方法配置后,可以编译out文件,但是无法实现自动下载,原因有可能是路径问题,比如\"D:\\PROGRA~1\\MATLAB\\R2013a\oolbox\\idelink\\extensions\iccs\\ccsdemos\\runProgram.js\" \"D:\i\\XDS100v2.ccxml\" \"[|||MW_XMK_GENERATED_TARGET_REF[E]|||]\",这里本来是指定运行程序和调用仿真器配置文件下载的,对于D:\\Program Files\\MATLAB\\R2013a,由于路径存在空格,此处是无法识别,需要改成简写格式D:\\PROGRA~1,或者重新装matlab这个不现实,对于仿真器配置文件ccxml比较小,可以将其放在其它无空格的路径下,然后将xmakefile 工具execute 的arguments路径进行修改。对于有空格的路径可以改写为前(6个字母)+(~1)
图4 编译成功,但是无法自动下载。
图5 自动连接下载的路径配置,arguments的路径要求无空格。
到此实现了将matlab程序自动编译并下载到处理器中,无需打开CCS。
Hello,I have successfully import the files( .c and .h generated by simulink/ccs4/5 ) into a project (build a new project by yourself ),at the same time ,we need copy some other .c and .h files that in the matlab toolbox,
Last the new project generated .out file ,and can download to the DSP. This is some pictures during building the project:
In the document folder(generated by simulink and CCS),exist some .c .h and .asm, just like the picture of the third answer. 需要新建一个CCS工程,将点c和点asm放入SRC中,将.h放入INCLUDE,同时,需要将必要的matlab中的c和h文件放入src和include文件中,
In the document folder(generated by simulink and CCS),exist some .c .h and .asm, just like the picture of the third answer. U need build a new ccs project , then take the .c .asm into the SRC, take the .h into the INCLUDE, at the same time ,U need take the necessary .c and .h that exist in the matlab files just like the piceure of the 4th and 5th answer into the SRC and INCLUDE . the SRC and INCLUDE are built by yourself in the CCS project,then what U need do is just detection of error when compile the project。 懂了么?
【2】 Matlab与CCSV5的交互命令
clc 清屏
clear('all') 或者 clear all clear('mypjt')
ccsboardinfo
[boardNum,procNum]=boardprocsel mypjt=ticcs 或者
mypjt=ticcs('boardnum',1,'procnum',0) 表示选择的软件仿真,如果把1改成0则是硬件仿真,从下图中可以看出
projfile=fullfile(matlabroot,'myprojects','Lab0301-LED','LED.pjt'); projpath=fileparts(projfile); open(mypjt,projfile)
visible(mypjt,1) 或者mypjt.visible(1) build(mypjt,'all') cd(mypjt,projpath) cd(mypjt, 'Debug') load(mypjt,'LED.out')
run(mypjt,'run') 运行ccsIDE中的程序
halt(mypjt) 停止运行ccsIDE中的程序 cd(mypjt,projpath) 返回到工程文件 close(mypjt,'LED.pjt') 关闭工程文件
insert(mypjt,'LED.c',20,'break') 在工程文件第20行插入断点
mypjt.new('mypjt','project') 新建一个名字为mypjt的ccs工程文件
TI ControlSuite
【3】 DSP驱动集成
有些时候,评估板的驱动,并不能满足自己开发的板子,这时需要使用legacy code tool或者custom code来集成自己开发的驱动。D:\\matlab\\R2009b\oolbox\arget\\extensions\\processor\ic6000\\blks\\lct\\specs\\c6455dsk_dip_le
d_LCT.m
【4】 DSP PIL Matlab
Matlab 2013或者2014可以在线获取target support package
因篇幅问题不能全部显示,请点此查看更多更全内容