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.

Using scripting console with CCS4

Other Parts Discussed in Thread: CCSTUDIO

Hello I read through the wiki for the scripting console for CCS4 but I still cant seem to figure out exactly what I seem to be doing wrong.

I want to send a image to my DPS from a .bmp file on my computer by using the scripting console to call the loadRaw() method, but I dont think i am doing it correctly.

I have a java script running from outside of CCS4 attempting to open up a session with the scripting console and load a image file to the DPS at a address define by "IMAGE"

 

here is a code snippet

============================================================

importPackage(Packages.com.ti.debug.engine.scripting);
importPackage(Packages.com.ti.ccstudio.scripting.environment);
importPackage(Packages.java.lang);

   var script = ScriptingEnvironment.instance()
    // Get the Debug Server and start a Debug Session
    debugServer = script.getServer("DebugServer.1");
    debugServer.setConfig("tisim_c64xple.ccxml");
    debugSession = debugServer.openSession(".*");
    var addofimage = debugSession.Symbol.getAddress("IMAGE");
    debugSession.memory.loadRaw(0,addofimage,'image location',32,false);

 ============================================================

 

Do i have the right idea? open up session of the scripting console and i should be able to use the loadRaw method?  I had been able to use loadRaw directly from the scripting console inside of CCS4, but i want to be able to make calls from outside of CCS4.

  • I'm not sure what the issue is. You said you tried to call the loadRaw method from the Scripting Console, and that something is wrong. But at the end you say that you are able to use loadRaw directly from the Scripting Console but you want to make calls from outside CCS4.

    So is loadRaw failing when you run your DSS script outside CCS?

  • I apologize for the confution let me try and make it a bit clearer.  I have a GUI that i wrote in java, basically it displays an image in browser. What I want to be able to do is have my GUI load the image into my DPS. So I am attempting to make a function in my java script do just that. So I looked through the examples in the DebugServerExamples folder in CCS4 and looked at the Memory example and saw that it loaded a image and figured i could do something similiar.

    (Packages I'm using)

     importPackage(Packages.com.ti.debug.engine.scripting)
     importPackage(Packages.com.ti.ccstudio.scripting.environment)
     importPackage(Packages.java.lang)
     importPackage(Packages.java.io

    So my function basically looks like

        var script = ScriptingEnvironment.instance();
        // Get the Debug Server and start a Debug Session
        debugServer = script.getServer("DebugServer.1");
        debugServer.setConfig("tisim_c64xple.ccxml");
        debugSession = debugServer.openSession(".*");
        debugSession.memory.loadRaw(0,address,"part.jpg",32,false);

     

     Is there a step I am missing? It doesnt really seem to be doing anything when i run the function.  I did get loadRaw to work if i just type it directly into the scripting console window of CCS4 but that isnt what i really want to do. The end result will be loading in more data then just an image from my GUI. Does the dss.bat file have to be used to run the java script?

  • Your script looks fine. You may want to enable DSS verbose logging to get more diagnostic information. That may shed some light on what is going on.

    You don't have to run your script with 'dss.bat' if you've already done the environment setup that the batch file does.

  • I will give the DSS verbose logging a shot, would it be use full to try and run it through the RHINO_DEBUGGER inside the dss.bat file?  Whenever i try and run it through the RHINO debugger it hangs on debugSession = debugServer.openSession(".*"). Im connected to my DPS, should i be able to open a debug server session as long as im connected?

    I keep looking for some documentation on how to actually setup the enviroment, so i dont have to actually run the script through dss.bat but i only found the wiki from ti and i dont find it terribly helpfull in this situation.

  • If you are hanging when opening a debug session in Rhino, that is probably the issue right there. Check the verbose log, it should help explain why that call is failing.

    What is DPS? I assumed you meant DSP but I think I am mistaken.

    The best documentation for setting up your environment is to read the dss.bat file. It should have comments explaining what is going on in there.

  • No i meant DSP, I just typed it to fast my apologies.

  • Do you already an instance of CCS running when you run your dss javascript?

  • Yes i have CCS running and its halted when i attempt to run my dss javascript.

  • Note that your script is creating a NEW instance of the debugger and NOT connecting to the currently running debugger (CCS). So using the DSS script to load your *.bmp file will load it to the memory of  the newly created debug session and NOT to the one that was already running and probably what your custom Java GUI is connected to. You have two separate instances of the C64x+ simulator running.

  • Ki-Soo Lee said:

    NOT to the one that was already running and probably what your custom Java GUI is connected to.

    Sorry, I meant to say that your GUI is launching a new instance of the debugger (via DSS script) and not loading the bmp to the currently running instance of CCS that you are using for debugging and expecting to see the file loaded to.

  • So if I say, open CCS and run my program to a breakpoint, open up my java gui and load in a file to my DSP. If i then go back to CCS and use the image analyzer to see if the image is stored in memory i wont see it?

  • If I correctly understand what your environment is, I would not expect you would. That's because you created another instance of the simulator with your java GUI and loaded into the memory of that simulator and not the one that is associated with the already running CCS.

  • This was my intended idea

     

    - Open CCS4 Connect to target DSP

    - Run CCS program to initialize and allocate memory for DSP and halt CCS program

    - Open up java Gui

    - Java Gui connects to the DSS (i assumed the DSS was tied to the instance of CCS i have running)

    - I wanted the java gui to, grab the address for the image location on the DSP (debugSession.symbol.getAddress("Memory Location on DSP"))

    - Send the image file on my PC to the Memory Location on the DSP  (debugSession.memory.loadRaw())

    - Use the Image Analyzer in CCS to look at Memory Location and make sure the file was loaded in correctly.

     

    Is it not possible to accomplish it this way?

     

     

  • It is not possible to easily have a DSS script attach to a running CCSv4 (though it was possible with CCScripting and CCSv3.3).

    However you can have your GUI run a DSS script that would then launch an instance of CCSv4 and this instance will be tied to the debug session started with the DSS script. It involves a few extra steps so I'm not sure if it is something you want to deal with.

    Check out this wiki topic for more details:

    http://tiexpressdsp.com/index.php/Debugging_Your_DSS_Script_Using_CCS

    ki

     

  • Hello Ki,

     

    I am trying to load a .js file from CCS scripting console, but the problem is my path has a space ( C:\\Documents and Settings \\...)And the scripting console is not recognizing it.

    Is there a work around for this. because i tried %20 and it doesnt work either.

     

    Thanks,

    Kishore.

  • Hi Kishore,

    Wrap the full path in quotes.

    ex:

    js:> loadJSFile "C:\Documents and Settings\myscript.js"

    Thanks

    ki

     

  • Thanks for the reply Ki,

     

    Well for some reason this method is not working.

    I found out an alternative though . Mapped the folder with space  to a virtual drive (  0: =  C:\Documents and Settings\ ) and then  used load  and it works!.

     

    Thanks!,

    Kishore.

  • Hi Ki,

     

    I am into trouble again! with this issue.

    I get the following error when i run the command

    js:> loadJSFile "O:/cixcvrProductEC/LTE_DEMO/ti/wbi/demo/lte/runTest/autoRun.js"

     

    Could not open O:/cixcvrProductEC/LTE_DEMO/ti/wbi/demo/lte/ccs4/autoRunLog.xml (O:\cixcvrProductEC\LTE_DEMO\ti\wbi\demo\lte\runTest\autoRun.js#609)

     

    However, in an other  project, this method works. I am not sure why this isnt working. Any ideas?

     

     

     

    Thanks,

    Kishore.

  • What is in line 609? Are you creating a DSS log?

  • Hi Ki,

     

    Yes, i am creating a DSS log.

    It is like this debugScriptEnv.traceBegin(lte_dir + "/ccs4/autoRunLog.xml", "DefaultStylesheet.xsl");

     

    I tried commenting this line and tried out,but even then it dint work.

     

    Thanks

  • Hi Ki,

     

    Do you have any suggestions?

     

    thanks

  • Check to make sure you have write permissions to that folder from the PC having the issue.

    Commenting out that one line would not work. You need to make sure the rest of your script does not do any logging otherwise those calls will fail also.

    ki

  • Ki,

     

    There were two issues

    1) I had problem in network access ( my network translation was not working)

    2) Write permissison set.

     

    Now it is working!

     

    Thanks!