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 java scripting: How to get list of CPU names

Other Parts Discussed in Thread: CCSTUDIO

Hi

Is there a way to get a list or CPUs from this command

debugSession = ds.openSession(".*");

Into this command

debugSession0 = ds.openSession("Spectrum Digital XDS510USB Emulator_0/C6472_0");
debugSession0.target.connect();

For example, if I do the command below, the output is due to a scripting exception caused by there being more than one core.

js:> ds.openSession(".*");
Could not open session. Found 7 devices  matching: .*
Spectrum Digital XDS510USB Emulator_0/C6472_0
Spectrum Digital XDS510USB Emulator_0/C6472_1
Spectrum Digital XDS510USB Emulator_0/C6472_2
Spectrum Digital XDS510USB Emulator_0/C6472_3
Spectrum Digital XDS510USB Emulator_0/C6472_4
Spectrum Digital XDS510USB Emulator_0/C6472_5
Spectrum Digital XDS510USB Emulator_0/ICEPICK_C_0

I'd like to automate the connection (and loading) or all the cores and make it independent of how the core is named by the target configuration file. i.e.

debugSession0 = ds.openSession(core_string_var[0]);
debugSession0.target.connect();

where core_string_var is created by a query of the available cores.

The reason for doing this is that we'd not have to rely on each engineer using the same "Target Configuration" file. Each would be able to name the cores differently.

Cheers

 

 

  • Hi Eddie,

    Currently there is no API in v4, there is an enhancement request filed for v5. SDSCM00038368.

    Regards,
    Patrick

  • I'm doing this to load all 6 cores on my C6472 - works on both CCSv4 and v5.  Note that b/c of how I named the executable for cores 1-5, I could put the loading of those cores in a loop:

    var numCores = ds.getSessionCount();
    var core = new Array(numCores);
    var coreNames = ds.getSessionNames();

    /* coreNames is random(!), so sort it alphabetically for some order */
    coreNames.sort();

    /* connect to all cores */
    for (var i = 0; i < numCores; i++) {
    //  print (coreNames[i]);
      core[i] = ds.openSession(coreNames[i]);
      core[i].target.disconnect();
      core[i].target.connect();
      core[i].target.reset();
    }

    /* load all cores */
    var dirbase = "c:/codec_engine_3_20_00_16/examples/ti/sdo/ce/examples/";

    core[0].memory.loadProgram(dirbase +
        "/apps/universal_copy/bin/ti_platforms_evm6472_CORE0/app_remotemc.x64P");
    for (i = 1; i < numCores; i++) {
        core[i].memory.loadProgram(dirbase +
            "/servers/all_codecs/bin/ti_platforms_evm6472/all_CORE" + i + ".x64P");
    }

    Chris

  • Hi Chris,

    I am wondering how you are able to get the session names without first starting up the debug server? I am not able to get any session count or name without first starting the debug server.

    Regards,
    Patrick

  • I'm running this from the Scripting Console after I've launched the appropriate "Target Configuration".  That may imply I've already started the debug server... but perhaps that's ok for Eddie's use case?

    Chris

  • Exactly what I'm doing. Works for me!

    Thanks a bunch Chris

    Not sure if you need it, but you may find this handy so you don't have to specify absolute paths.

    importPackage(Packages.org.eclipse.core.resources);
    env.setCurrentDirectory(ResourcesPlugin.getWorkspace().getRoot().getProject("your_project_name_here").getLocation());

    Cheers

    Eddie

  • Hi all,

    I would like to run the same debug server with the same .ccxml file to open multiple debug sessions for multiple cores with multiple emulators.  The idea is that the number of cores/sessions will be passed as an argument (environment variable , etc) and the name of each session varies due to name of emulator/core. Can I do this with ccsv4? How can I start the debug server in this case?

    Thanks all,

    Khang.

     

     

  • Khang,

    What you are asking is possible. You would start just one debug server and use it to open multiple debug sessions, one for each emulator/core combination.

    See this topic on how to specify the exact emulator and core you wish to create a debug session for using the openSession() API.

    http://processors.wiki.ti.com/index.php/Debug_Server_Scripting#Multiple_Debug_Sessions_for_Multi-core_Debug

    The example in the above link is for one multi-core target but also applies to cases where you have multiple emulators and targets defined in your target configuration file.

    FYI - I noticed you posted somewhat similar questions at the end of four different threads. In the future, please post your question in NEW thread. It will be easier to answer your questions and make sure your question gets more attention.

    Thanks

    ki

     

     

  • Thanks for your reply Ki-Soo and I will pay attention about all my similar questions. In fact, I would like to do a concurrent debug for different target boards connected to a same computer. Now, by writting a .ccxml file that defines my 2 xDS560v2 USB/LAN Emulators, I can open multiple debug sessions but I found that not concurrent but sequential. So my question is that how can I using threads inside the java scripting?  

    Thanks in advance for you help!

     

  • Truong-Khang Le-XID said:
    I can open multiple debug sessions but I found that not concurrent but sequential. So my question is that how can I using threads inside the java scripting?

    Other than the ability to do an asynchronous run, most of the DSS APIs are synchronous in behavior. For your use case, I'd actually have two separate DSS sessions (two different, independent scripts and two ccxml files, one for each emulator target). You can run multiple DSS sessions at the same time as long as both sessions are not trying to use the same emulator/target.

  • Hello Ki-Soo,

    I followed your instruction to create 2 ccxml file for each of my XDS560v2 LAN Emulators (Because their IP address are different). Then I just created one java script vile for both Emulators (intentionally , in each ccxml file, I named both emulators Emulator_0  in place of Spectrum Digital xDS560 LAN Emulator_0 for the purpose of using uniquely one script). I then connected 2 debug sessions with the 2 emulators in parallel. They worked but not very stable and often 1 passed/2 dss execution. There were errors about the java machine like following:

     

     

    ***** DSS Generic Loader *****


    START: 09:14:53 GMT+0200 (CEST)


    Configuring Debug Server for specified target...

    CCS configuration Done with C:\Temp\.operat4\ccs\config_M9\omap4430_ES2_xds560v2_LAN0.ccxml configuration file

    Open Cortex a9 CPU0 session

    #

    # An unexpected error has been detected by HotSpot Virtual Machine:

    #

    #  Internal Error (0xe06d7363), pid=3420, tid=1092

    #

    # Java VM: Java HotSpot(TM) Client VM (1.5.0_14-b03 mixed mode)

    # Problematic frame:

    # C  [kernel32.dll+0x12a5b]

    #

    # An error report file with more information is saved as hs_err_pid3420.log

    #

    # If you would like to submit a bug report, please visit:

    #   http://java.sun.com/webapps/bugreport/crash.jsp

    #

     

     

    OR

     

     

     

    ***** DSS Generic Loader *****


    START: 09:11:53 GMT+0200 (CEST)


    Configuring Debug Server for specified target...

    CCS configuration Done with C:\Temp\.operat4\ccs\config_M9\omap4430_ES2_xds560v2_LAN1.ccxml configuration file

    Open Cortex a9 CPU0 session

    SEVERE: CortexA9_0: Error initializing emulator 


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


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


    org.mozilla.javascript.WrappedException: Wrapped com.ti.ccstudio.scripting.environment.ScriptingException: Could not start server: DebugServer.1: Can not initialize DebugServer. CortexA9_0: Error initializing emulator 

     (c:\operat4\dss\omap4_dss.js#204)

    at org.mozilla.javascript.Context.throwAsScriptRuntimeEx(Context.java:1705)

    at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:157)

    at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:201)

    at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:64)

    at org.mozilla.javascript.gen.c1._c4(c:\operat4\dss\omap4_dss.js:204)

    at org.mozilla.javascript.gen.c1.call(c:\operat4\dss\omap4_dss.js)

    at org.mozilla.javascript.optimizer.OptRuntime.callName0(OptRuntime.java:106)

    at org.mozilla.javascript.gen.c1._c0(c:\operat4\dss\omap4_dss.js:35)

    at org.mozilla.javascript.gen.c1.call(c:\operat4\dss\omap4_dss.js)

    at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:337)

    at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2755)

    at org.mozilla.javascript.gen.c1.call(c:\operat4\dss\omap4_dss.js)

    at org.mozilla.javascript.gen.c1.exec(c:\operat4\dss\omap4_dss.js)

    at org.mozilla.javascript.tools.shell.Main.evaluateScript(Main.java:500)

    at org.mozilla.javascript.tools.shell.Main.processFileSecure(Main.java:422)

    at org.mozilla.javascript.tools.shell.Main.processFile(Main.java:388)

    at org.mozilla.javascript.tools.shell.Main.processSource(Main.java:379)

    at org.mozilla.javascript.tools.shell.Main.processFiles(Main.java:176)

    at org.mozilla.javascript.tools.shell.Main$IProxy.run(Main.java:97)

    at org.mozilla.javascript.Context.call(Context.java:540)

    at org.mozilla.javascript.ContextFactory.call(ContextFactory.java:447)

    at org.mozilla.javascript.tools.shell.Main.exec(Main.java:159)

    at org.mozilla.javascript.tools.shell.Main.main(Main.java:137)

    Caused by: com.ti.ccstudio.scripting.environment.ScriptingException: Could not start server: DebugServer.1: Can not initialize DebugServer. CortexA9_0: Error initializing emulator 


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

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

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

    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

    at java.lang.reflect.Method.invoke(Unknown Source)

    at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:142)

    ... 21 more

     

    Where could this issue come from? Does this relate to the fact that I have just requested for only 1 Server with the following instruction in javascript:

    debugServer = dssScriptEnv.getServer("DebugServer.1"); ?

    Thanks for your helps,

    Khang.

     

    P/S: Note that I ran these two instance of java in background via ssh service (recall that my task is to do an automated regression on many PC).  

     

     

     

     

     

     

    scripting.zip
  • Hello Ki-Soo,

    I think it's not easy to debug this problem. I've had some doubts on the machine capacity because the Java Virtual Machine takes much of the PC resource. Therefore, I have run each emulator separately (to recall, I have two xDS560 LAN Emulators, the older is xDS560 with red label and the newer is xDS560v2). And I found that the problem seems to be come from the older Emulator. I then updated its firmware (sd_xds560v2_firmware_2.2.0.2). At the beginning, it worked well but after a while, an error happened. At this moment, I tried to use CCS to manually communicate with  the Emulator but failed.  Moreover, I could not use xDS560v2Config utility to reboot it. The only solution was power off and on the Emulator.

    Otherwise, all tests passed with the newer one. So I think that the older one does not support well. What do you thinks?

     

  • Truong-Khang Le-XID said:
    Therefore, I have run each emulator separately (to recall, I have two xDS560 LAN Emulators, the older is xDS560 with red label and the newer is xDS560v2).

    I think the one with the red labeling is some pre-release version of the hardware.

    Truong-Khang Le-XID said:
    I then updated its firmware (sd_xds560v2_firmware_2.2.0.2). At the beginning, it worked well but after a while, an error happened. At this moment, I tried to use CCS to manually communicate with  the Emulator but failed.  Moreover, I could not use xDS560v2Config utility to reboot it. The only solution was power off and on the Emulator.

    So a power cycle resolves the issue and your automation runs successfully?

  • Hello Ki-soo

    Now I use the 2 new xDS560v2 LAN Emulators but one of them hangs sometime. When it hangs, I can not use CCS to communicate or use xDS560v2Cnfg utility to reboot it. The only solution is always power off then on. I think the firmware of the LAN emulators is no very stable.

    Khang.

  • Truong-Khang Le-XID said:
    Now I use the 2 new xDS560v2 LAN Emulators but one of them hangs sometime. When it hangs, I can not use CCS to communicate or use xDS560v2Cnfg utility to reboot it. The only solution is always power off then on.

    I have some XDS560v2 LAN emulators from Spectrum Digital. Every so often I do need to power cycle the emulators when I lose emulator communication. I guess this is a bit more common than I thought.