MATLAB: How to load the Embedded Coder output into Code Composer Studio 4

Embedded Coderembedded coder ti dsp ccs ccs4 code composer studio ccode c makefileEmbedded IDE Link CC

Hello,
I am using the Embedded Coder toolbox to generate code for a Texas Instruments DSP. Embedded Coder produces some C-code which I would like to open (and build) in Code Composer Studio 4. Does somebody know how to load these C-source files into a valid CCs project?
I know Embedded Coder can also directly build the .out HEX file for the DSP. This is not an option for me because I would like to step through the C-code and fully make use of the CCs debug tools (which was possible with CCs3.3 and an older IDE link Matlab Coder Generation toolbox which automatically configured the CCs project).
Thanks in advance. Joost

Best Answer

Sebastian Castro from MathWorks Technical support provided me an answer which resolved the issue:
After some investigation, it appears that the reason for this issue has to do with the "Execute" configuration in XMAKEFILESETUP. In order to make this work, you can clone the appropriate CCSv4 xmakefile configuration as outlined in the steps below:
1.Open up "xmakefilesetup" and select the appropriate CCSv4 configuration -- that is, the one that you have been using.
2. To the right of the configuration drop-down menu, click on the "New..." button and make a name for the cloned configuration. This configuration will be a MATLAB file that will be saved in the "User Configurations" directory as shown in the GUI.
You may be asked to point to your install directory for CCSv4.
3. Select this new configuration. You will see an "Execute" tab. Under "Execute tool" you will see "echo". This is the configuration that is causing the error we have been discussing.
Select the "Browse..." button next to "Execute Tool" and look for the file "$CCSINSTALL\ccsv4\scripting\bin\dss.bat". Here, $CSSINSTALL is the installation directory for your CCSv4 IDE.
4. The "Arguments" box needs to be populated with three arguments in quotation marks separated by spaces. The box should be filled out as follows:
"ARG1" "ARG2" "ARG3"
The three arguments are:
ARG1: $MATLABROOT\toolbox\idelink\extensions\ticcs\ccsdemos\runProgram.js
Here, $MATLABROOT refers to your MATLAB installation directory (for example, C:\Program Files\MATLAB\R2011a). This is a JavaScript file that is shipped with the product.
ARG2: This should be the path to a ".ccxml" configuration file generated from CCSv4.
In order to get this, you can open CCSv4 and go to "File > New > Target Configuration File". You can then specify the name, location and fill in the appropriate hardware information.
ARG3: [|||MW_XMK_GENERATED_TARGET_REF[E]|||]
So, the contents of the "Arguments" text box should at the end look like this, for example:
"C:\Program Files\MATLAB\R2011a\toolbox\idelink\extensions\ticcs\ccsdemos\runProgram.js" "C:\Users\scastro\user\CCSTargetConfigurations\myconfigname.ccxml" "[|||MW_XMK_GENERATED_TARGET_REF[E]|||]"
After taking these steps, you should be able to use this xmakefile configuration to directly do a "Build and Execute" from the Simulink model. While this does take a bit of time to set up, you only have to do it once.