This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCSv4. Running java script from Matlab to drive debug server.

Other Parts Discussed in Thread: CCSTUDIO

Hi

Has anyone tried running the debug server from Matlab. I'm stuck on the matlab syntax needed to recognize the scripts in  http://processors.wiki.ti.com/index.php/Scripting_Console

Cheers

  • Hi Eddie,

    As far as I know, there is no support for v4 with Matlab. Are you trying some custom thing?

    ki

  • Hi Ki

    Yes, its custom.

    I don't entirely understand it, but this link talks about calling Java from Matlab.

    http://www.caspur.it/risorse/softappl/doc/matlab_help/techdoc/matlab_external/ch_java.html

    Your examples in C:\Program Files\Texas Instruments\ccsv4\scripting\examples got me wondering if I can run these from Matlab somehow.

    I'm hoping that I can run a matlab script, have it call java which uses the CCSv4 debug server. The functions I want to use are debugServer(), .openSession(), target.connect(), memory.loadProgram(), symbols.getAddress(), memory.loadData().

    Possible?

    Matlab said they are not planning have their Embedded IDE tool support CCSv4 and will support CCSv5: which according to your Wiki, won't be out until Q3, 2011. Thats too late for our product.

    http://processors.wiki.ti.com/index.php/Category:Code_Composer_Studio_v5

     

    Cheers

     

  • That's interesting. It certainly looks possible. DSS is just a bunch of Java APIs.

    You may want to look at the wiki topic for calling DSS from a Java app.

    http://processors.wiki.ti.com/index.php/Java_Scripting_with_DSS

    Good luck!

    ki

  • Thanks for the url link Ki

    I'll post my progress.

    Cheers

  • Hi

    Will Debug Server Scripting (DSS) be available in CCSv5?

    Cheers

  • Eddie said:
    Will Debug Server Scripting (DSS) be available in CCSv5?

    Yes, DSS will definitely be supported in v5.

  • Hello,

    I present the solution I used to run DSS from MATLAB:

    CCS_DIR = 'C:\TI\ccsv4';
    DEBUG_DIR = [CCS_DIR '\DebugServer'];
    TARGETCFG_DIR = 'C:\TI\target_cfg'; %Please be sure the path does not contain the space
    %%
    javaaddpath([DEBUG_DIR  '/packages/ti/dss/java/js.jar']);
    javaaddpath([DEBUG_DIR  '/packages/ti/dss/java/dss.jar']);

    javaaddpath([DEBUG_DIR  '/packages/ti/dss/java/com.ti.debug.engine_1.0.0.jar']);
    javaaddpath([DEBUG_DIR  '/packages/ti/dss/java/com.ti.ccstudio.scripting.environment_3.1.0.jar']);
    javaaddpath([DEBUG_DIR  '/packages/ti/dss/java/com.ti.ccstudio.scripting.rtdx_1.0.0.jar']);

    import com.ti.ccstudio.scripting.environment.*;
    import com.ti.debug.engine.scripting.*;
    import java.lang.System;

    % Sets the system property indicated by the specified key
    System.setProperty('XPCOM.RUNTIME',[DEBUG_DIR  '\win32']);

    % Create scripting environment object - which is the main entry point into
    % any script, set timeout 60s
    script = ScriptingEnvironment.instance();
    script.setScriptTimeout(60000);

    % Create a log file in the current directory to log script execution
    if diagnostic
        script.traceBegin('MemoryTestLog.xml', 'DefaultStylesheet.xsl');
        script.traceSetConsoleLevel(TraceLevel.ALL);
        script.traceSetFileLevel(TraceLevel.ALL);
    end

    % Get the user Debug Server and Session
    try
        uDebugServer = script.getServer('DebugServer.1');
        uDebugServer.setConfig([TARGETCFG_DIR '\sim67xx.ccxml']);

        uDebugSession = uDebugServer.openSession();
    catch ee
        error('Debug Server could not run because configuration has not been set');
    end

    % Get the RTDX Server and Session
    rtdxServer = script.getServer('RTDXServer.1');
    rtdxSession = rtdxServer.openSession(uDebugSession);

    % Connect if necessary
    if ~uDebugSession.target.isConnected();
        uDebugSession.target.connect();
    end
    % Load the program from the out file
    uDebugSession.memory.loadProgram('prog.out');
          
    uDebugSession.target.runAsynch();

     

    Hope it will be usefull for You.

  • Hi Andre

    andreiltd said:
    Hope it will be usefull for Yo

    Are you kidding me! You're post helped me immensely.

    I was able to get it to work with Matlab 2010a and 2008b using spaces in my directories. The following script worked

    *****************************************************************************


    CCS_DIR = 'C:/Program Files/Texas Instruments/ccsv4';
    DEBUG_DIR = [CCS_DIR '/DebugServer'];
    TARGETCFG_DIR = 'C:/Documents and Settings/epatto/user/CCSTargetConfigurations'; %Please be sure the path does not contain the space
    TARGET_EMULATOR = '/EVM6472_XDS510USB.ccxml';

    WORK_DIR = 'D:/vws/ejp_M2_evm6472_pwcw/spDsp/EVM/Test.Filter';

    javaaddpath([ DEBUG_DIR  '/packages/ti/dss/java/js.jar'  ]);
    javaaddpath([ DEBUG_DIR  '/packages/ti/dss/java/dss.jar'  ]);

    javaaddpath([ DEBUG_DIR  '/packages/ti/dss/java/com.ti.debug.engine_1.0.0.jar'  ]);
    javaaddpath([ DEBUG_DIR  '/packages/ti/dss/java/com.ti.ccstudio.scripting.environment_3.1.0.jar' ]);
    javaaddpath([ DEBUG_DIR  '/packages/ti/dss/java/com.ti.ccstudio.scripting.rtdx_1.0.0.jar' ]);

    import com.ti.ccstudio.scripting.environment.*;
    import com.ti.debug.engine.scripting.*;
    import java.lang.System;

    System.setProperty('XPCOM.RUNTIME',[ DEBUG_DIR  '\win32' ]);

    script = ScriptingEnvironment.instance();
    script.setScriptTimeout(60000);

    uDebugServer = script.getServer('DebugServer.1');
    uDebugServer.setConfig([TARGETCFG_DIR TARGET_EMULATOR]);
    uDebugSession = uDebugServer.openSession('Spectrum Digital XDS510USB Emulator_0/C6472_0');

    uDebugSession.target.connect();

    uDebugSession.memory.loadProgram([ WORK_DIR '/Debug/Test.Filter.out']);

     

     

  • Hi

    I thought I'd try to start the CCSv4 IDE from Matlab as they did in TI's example (http://processors.wiki.ti.com/index.php/Debugging_Your_DSS_Script_Using_CCS)

    Wow, did I get errors when I tried the commands below. I know the debug server session is working because I can read and write to my EVM. But apparently I've not configured Matlab correctly.

    Also, I was getting the error

    java.lang.OutOfMemoryError: PermGen space

    which I resolved by increasing the MaxPermSize to 128 M as per

    http://www.mathworks.com/support/solutions/en/data/1-20FV2Z/index.html?product=SL&solution=1-20FV2Z

    ***********The dreaded output errors follow the two commands in green**************************

    >> javaaddpath([ DEBUG_DIR  '/../eclipse/startup.jar'  ]);  % Used for starting IDE.

    >> script.getServer('CCSServer.1').openSession('.*');


    java.lang.NoClassDefFoundError: com/ti/ccstudio/debug/engine/proxies/PxyLicenseManager
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(Unknown Source)
        at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.defineClass(DefaultClassLoader.java:160)
        at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClass(ClasspathManager.java:498)
        at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findClassImpl(ClasspathManager.java:468)
        at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClassImpl(ClasspathManager.java:427)
        at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:410)
        at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:188)
        at org.eclipse.osgi.framework.internal.core.BundleLoader.findLocalClass(BundleLoader.java:339)
        at org.eclipse.osgi.framework.internal.core.SingleSourcePackage.loadClass(SingleSourcePackage.java:37)
        at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:388)
        at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:352)
        at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:83)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClassInternal(Unknown Source)
        at com.ti.ccstudio.debug.server.factory.LicenseEngineFactory.createInstance(LicenseEngineFactory.java:14)
        at com.ti.ccstudio.update.CCEUpdateStartup.heartbeat(CCEUpdateStartup.java:34)
        at com.ti.ccstudio.update.CCEUpdateStartup.earlyStartup(CCEUpdateStartup.java:13)
        at org.eclipse.ui.internal.EarlyStartupRunnable.runEarlyStartup(EarlyStartupRunnable.java:87)
        at org.eclipse.ui.internal.EarlyStartupRunnable.run(EarlyStartupRunnable.java:66)
        at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
        at org.eclipse.ui.internal.Workbench$20.run(Workbench.java:1759)
        at org.eclipse.core.internal.jobs.Worker.run(Worker.java:58)
    Caused by: java.lang.ClassNotFoundException: com.ti.ccstudio.debug.engine.proxies.PxyLicenseManager
        at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:407)
        at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:352)
        at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:83)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClassInternal(Unknown Source)

        ... 23 more  ("Yeah right. Like I need more errors!)

  • Re: Quest to run CCSv4 IDE and Matlab at the same time.

    Well according to the info http://processors.wiki.ti.com/index.php/Debugging_Your_DSS_Script_Using_CCS, the DSS and CCS can share the same debug server instance. So I thought I'd try this:

    1. Start CCSv4 from the START menu
    2. Launch the debug session using my.ccxml file
    3. Then connect to the EVM's DSP (using the CCSv4 connect button
    4. Start Matlab
    5. Run the above script I posted to the point where it opens the uDebugSession (see command below).

    And thats where I run into the problem. Seems you can't access the debug server as I'd hoped. The CCS session I have opened appears to have 100% control of the debug server session.

    Perhaps this can only be done with the simulator?

    Cheers

    >> uDebugSession = uDebugServer.openSession('Spectrum Digital XDS510USB Emulator_0/C6472_0'); % Exclude the text in the quotes to get list of targets"

    SEVERE: ICEPICK_C: Error initializing emulator

    SEVERE: Can not initialize DebugServer. ICEPICK_C: Error initializing emulator

    SEVERE: Could not start server: DebugServer.1: Can not initialize DebugServer. ICEPICK_C: Error initializing emulator

    ??? Java exception occurred:
    com.ti.ccstudio.scripting.environment.ScriptingException: Could not start server: DebugServer.1:
    Can not initialize DebugServer. ICEPICK_C: Error initializing emulator


        at com.ti.debug.engine.scripting.DebugServer$SessionFactory.<init>(DebugServer.java:142)

        at com.ti.debug.engine.scripting.DebugServer.openSession(DebugServer.java:1119)

        at com.ti.debug.engine.scripting.DebugServer.openSession(DebugServer.java:49)

  • Eddie,

    DSS needs to launch CCS (using: script.getServer("CCSServer.1").openSession(".*");) to ensure they are interfacing to the same debug server. You should not be manually starting up CCS. I'm pretty sure the error you are seeing is because you are starting two separate debug sessions, both of which are trying to use the same emulator.

    ki

  • Thanks for explaining that Ki

    I tried starting DSS as described in my Thu, Sep 23 2010 7:21 PM post above and got a ton of errors. Any thoughts on how to fix the errors?

    Eddie said:

    >> javaaddpath([ DEBUG_DIR  '/../eclipse/startup.jar'  ]);  % Used for starting IDE.

    >> script.getServer('CCSServer.1').openSession('.*');


    java.lang.NoClassDefFoundError: com/ti/ccstudio/debug/engine/proxies/PxyLicenseManager
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(Unknown Source)
        at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.defineClass(DefaultClassLoader.java:160)
        at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClass(ClasspathManager.java:498)

  • Is this some Matlab script? Or are you entering commands manually from some Matlab console?

    Could you attach an Eclipse error log?

    http://processors.wiki.ti.com/index.php/Troubleshooting_CCS#Eclipse_Error_Log

    Just launch CCS manually and get the log

    ki

  • 8726.OpenGuiFromMatlab_script.txt
    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    CCS_DIR = 'C:/Program Files/Texas Instruments/ccsv4';
    DEBUG_DIR = [CCS_DIR '/DebugServer'];
    % Specify the driver you use to connect to the chip/EVM
    TARGETCFG_DIR = 'C:/Documents and Settings/epatto/user/CCSTargetConfigurations';
    TARGET_EMULATOR = '/EVM6472_XDS510USB.ccxml';
    % Specify your working directory.
    WORK_DIR = 'D:/vws/ejp_M2_evm6472_pwcw/spDsp/EVM/Test/Test.Doppler/Test.WallFilter';
    % Add java jar libs to Matlab classpath (use javaclasspath to see if this worked)
    javaaddpath([ DEBUG_DIR '/packages/ti/dss/java/js.jar' ]);
    javaaddpath([ DEBUG_DIR '/packages/ti/dss/java/dss.jar' ]);
    javaaddpath([ DEBUG_DIR '/packages/ti/dss/java/com.ti.debug.engine_1.0.0.jar' ]);
    javaaddpath([ DEBUG_DIR '/packages/ti/dss/java/com.ti.ccstudio.scripting.environment_3.1.0.jar' ]);
    javaaddpath([ DEBUG_DIR '/packages/ti/dss/java/com.ti.ccstudio.scripting.rtdx_1.0.0.jar' ]);
    javaaddpath([ DEBUG_DIR '/../eclipse/startup.jar' ]); % Used for starting IDE.
    import com.ti.ccstudio.scripting.environment.*;
    import com.ti.debug.engine.scripting.*;
    import java.lang.System;
    System.setProperty('XPCOM.RUNTIME',[ DEBUG_DIR '\win32' ]);
    % Create scripting environment object - which is the main entry point into
    % any script, set timeout 60s
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    6443.OpenGuiFromMatlab_MatlabErrors.txt
    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    >> script.getServer('CCSServer.1').openSession('.*');
    ---doCreatePage: firstime=true solutionBased=false
    Exception in thread "Scripting Console - Rhino" java.lang.NoClassDefFoundError: com/ti/ccstudio/scripting/environment/ScriptingException
    at com.ti.ccstudio.scripting.gss.ScriptingService.getScriptableObject(ScriptingService.java:95)
    at com.ti.ccstudio.scripting.console.internal.RhinoAdapter.initScriptableObectjs(RhinoAdapter.java:302)
    at com.ti.ccstudio.scripting.console.internal.RhinoAdapter.access$2(RhinoAdapter.java:296)
    at com.ti.ccstudio.scripting.console.internal.RhinoAdapter$2.run(RhinoAdapter.java:115)
    at com.ti.ccstudio.rhino.internal.RhinoThreadExecutor$1.run(RhinoThreadExecutor.java:53)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    at com.ti.ccstudio.rhino.internal.RhinoThreadExecutor$RhinoThread.run(RhinoThreadExecutor.java:73)
    Caused by: java.lang.ClassNotFoundException: com.ti.ccstudio.scripting.environment.ScriptingException
    at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:407)
    at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:352)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:83)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    ... 9 more
    java.lang.NoClassDefFoundError: com/ti/ccstudio/debug/engine/proxies/PxyLicenseManager
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.defineClass(DefaultClassLoader.java:160)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClass(ClasspathManager.java:498)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findClassImpl(ClasspathManager.java:468)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClassImpl(ClasspathManager.java:427)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:410)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:188)
    at org.eclipse.osgi.framework.internal.core.BundleLoader.findLocalClass(BundleLoader.java:339)
    at org.eclipse.osgi.framework.internal.core.SingleSourcePackage.loadClass(SingleSourcePackage.java:37)
    at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:388)
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    5611.OpenGuiFromMatlab_CCSv4Errors.txt
    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    java.lang.NullPointerException
    at com.ti.ccstudio.breakpoint.core.PropertyBreakpoint.updateMarkerMessage(PropertyBreakpoint.java:463)
    at com.ti.ccstudio.breakpoint.core.PropertyBreakpoint.setSourceLocation(PropertyBreakpoint.java:630)
    at com.ti.ccstudio.breakpoint.core.PropertyBreakpoint.updateMarker(PropertyBreakpoint.java:337)
    at com.ti.ccstudio.breakpoint.core.PropertyBreakpoint.setMarker(PropertyBreakpoint.java:179)
    at org.eclipse.debug.internal.core.BreakpointManager.createBreakpoint(BreakpointManager.java:430)
    at org.eclipse.debug.internal.core.BreakpointManager.loadBreakpoints(BreakpointManager.java:167)
    at org.eclipse.debug.internal.core.BreakpointManager.initializeBreakpoints(BreakpointManager.java:327)
    at org.eclipse.debug.internal.core.BreakpointManager.getBreakpoints0(BreakpointManager.java:296)
    at org.eclipse.debug.internal.core.BreakpointManager.getBreakpoints(BreakpointManager.java:305)
    at com.ti.ccstudio.breakpoint.ui.action.base.AbstractEditorActionDelegate.determineTargetBreakpoint(AbstractEditorActionDelegate.java:64)
    at com.ti.ccstudio.breakpoint.ui.action.EditorPropertiesRulerActionDelegate.updateMenuItem(EditorPropertiesRulerActionDelegate.java:31)
    at com.ti.ccstudio.breakpoint.ui.action.base.AbstractEditorActionDelegate.setActiveEditor(AbstractEditorActionDelegate.java:44)
    at org.eclipse.ui.internal.EditorPluginAction.editorChanged(EditorPluginAction.java:75)
    at org.eclipse.ui.internal.EditorPluginAction.<init>(EditorPluginAction.java:34)
    at org.eclipse.ui.internal.ActionDescriptor.createAction(ActionDescriptor.java:256)
    at org.eclipse.ui.internal.ActionDescriptor.<init>(ActionDescriptor.java:170)
    at org.eclipse.ui.internal.ViewerActionBuilder.createActionDescriptor(ViewerActionBuilder.java:53)
    at org.eclipse.ui.internal.PluginActionBuilder.readElement(PluginActionBuilder.java:158)
    at org.eclipse.ui.internal.ViewerActionBuilder.readElement(ViewerActionBuilder.java:88)
    at org.eclipse.ui.internal.registry.RegistryReader.readElements(RegistryReader.java:138)
    at org.eclipse.ui.internal.registry.RegistryReader.readElementChildren(RegistryReader.java:127)
    at org.eclipse.ui.internal.PluginActionBuilder.readElement(PluginActionBuilder.java:141)
    at org.eclipse.ui.internal.ViewerActionBuilder.readElement(ViewerActionBuilder.java:88)
    at org.eclipse.ui.internal.registry.RegistryReader.readElements(RegistryReader.java:138)
    at org.eclipse.ui.internal.registry.RegistryReader.readExtension(RegistryReader.java:149)
    at org.eclipse.ui.internal.registry.RegistryReader.readRegistry(RegistryReader.java:170)
    at org.eclipse.ui.internal.PluginActionBuilder.readContributions(PluginActionBuilder.java:112)
    at org.eclipse.ui.internal.ViewerActionBuilder.readViewerContributions(ViewerActionBuilder.java:106)
    at org.eclipse.ui.internal.PopupMenuExtender.readStaticActionsFor(PopupMenuExtender.java:373)
    at org.eclipse.ui.internal.PopupMenuExtender.<init>(PopupMenuExtender.java:125)
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    5556.OpenGuiFromMatlab_CCSv4ErrorLog.log

    Hi Ki

    I am running a Matlab scfipt. Here are the files I uploaded. Let me know if you also need the Debug Server Logging output. I only did the Eclipse Error Log.

    OpenGuiFromMatlab_script.txt:                      - run this to configure and start the GUI (but it doesn't work unfortunately)

    OpenGuiFromMatlab_MatlabErrors.txt          - errors that were output on Matlab

    OpenGuiFromMatlab_CCSv4Errors.txt         - errors that popped up in my CCSv4 text edit window

    OpenGuiFromMatlab_CCSv4ErrorLog.log  - eclipse error log I exported as per the above wiki page.

    Thanks for your help.

  • Hi Ki

    Is there any other info you need to help solve this problem?

    Cheers