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.

DSS scripting: how to load data into memory

Other Parts Discussed in Thread: CCSTUDIO

Hi,

I'm trying to develop a console script that would load two cores and run them in synchronous mode with a C66xx.

I'm able to do that through the Class simultaneous, but I have some questions.

Now, I want to read/write some data from/to memory through a DSS script. I know that I can do that with memory.load / memory.write or memory.read class, but for do that I have to set a breackpoint.

What I want to know is that there is some manner to write data in memory (for example a binary file with memory.loadRaw() ) without using a breakpoints.

Secondly, I would like to know if there is a manner from the DSS script to interact with the code when it is in execution, without the use of breakpoints.

I try to explain what I want to do: after running the two cores with target.runAsynch() I would like that when something happens in the code in execution on one core, the execution is halted and the DSS script could do something (for example loading some data in memory) and then resume the execution on the core without restarting it. All this without the use of breakpoints. Is it possible to do this? and if it is how can I do that?

 

Thanks.

  • Luca_fx said:
    What I want to know is that there is some manner to write data in memory (for example a binary file with memory.loadRaw() ) without using a breakpoints.

    I think what you are asking is if you can read/write data without halting the target. This is not possible. You need to halt the target to use those APIs

    Luca_fx said:

    Secondly, I would like to know if there is a manner from the DSS script to interact with the code when it is in execution, without the use of breakpoints.

    I try to explain what I want to do: after running the two cores with target.runAsynch() I would like that when something happens in the code in execution on one core, the execution is halted and the DSS script could do something (for example loading some data in memory) and then resume the execution on the core without restarting it. All this without the use of breakpoints. Is it possible to do this? and if it is how can I do that?

    Can you give an example of "something happens"?

    Also note that after you call target.runAsynch(), the rest of your script will execute to completion. Unless you are polling somewhere, you script may terminate before it ever halts.

    Thanks

    ki

  • Thanks for your answer Ki-Soo Lee,

    let's we concentrate only on the first question for the moment.

    I've understand that I need to halt the target before using the APIs.

    So, how can I halt the target without using a breakpoints in the DSS script? Is there any other method that can I use?

     

    Thanks,

    Luca.

  • If you ran the target with an asynchronous run, you can halt it with the target.halt() API.

  • Perhaps I have not explained well. Suppose I run the target without an asynchronous run, so the script can't halt the target. How can I halt the target without setting a breakpoint?

    Is there any command or API that I can call inside the code that is running on the target that could freeze the execution and return control to the script?

    Thanks,

    Luca.

  • Perhaps I have not explained well. Suppose that I run the target without an asynchronous run, so the script can't halt the target.

    How can I halt the target without setting a breakpoint? Is there any command or API that i can call inside the code that is running on the target, in order to freeze the execution and retun the control to the script?

    Tanks,

    Luca

  • Luca_fx said:
    Is there any command or API that I can call inside the code that is running on the target that could freeze the execution and return control to the script?

    If you do a synchronous run, then you cannot make any calls since you are blocked until the call returns (target is halted). The only exception is to set the script timeout to the value that you are willing to wait before it times out and returns control of the script. Then you can call target.halt(). Note that if you use the timeout, the API will throw an exception and you have to catch and handle it otherwise it will terminate your script.

    ki

  • Thanks a lot Ki-Soo Lee.

    Ki-Soo Lee said:

    The only exception is to set the script timeout to the value that you are willing to wait before it times out and returns control of the script.

    How can I set the script timeout?

     

    Thanks.

     

  • setScriptTimeout(timeInMs);

    ex:

    var script = ScriptingEnvironment.instance()

    // Set our timeout to 15 seconds
    script.setScriptTimeout(15000)

  • Ki-Soo Lee said:

    setScriptTimeout(timeInMs);

    ex:

    var script = ScriptingEnvironment.instance()

    // Set our timeout to 15 seconds
    script.setScriptTimeout(15000)

     

    I have set the time out, but I have some problem. When the timeout is reached it does not return control to the script.

    The code I use is something like:

    ...

    script.setScriptTimeout(5000)

    script.traceWrite(" set timeout to 5s ")

    debugServer.simultaneous.run()

    script.traceWrite(" I'm here ") <-- this point is never reached

     

    I obtain this output:

    ...

    SEVERE: Timed out after 5000ms

    SEVERE: Timed out after 5000ms on the target TCI6618 Device Functional Simulator, Little Endian_0/TMS320C66x_1
    SEVERE: Error performing simultaneous run: Timed out after 5000ms on the target TCI6618 Device Functional Simulator, Little Endian_0/TMS320C66x_1
    org.mozilla.javascript.WrappedException: Wrapped com.ti.ccstudio.scripting.environment.ScriptingException: Error performing simultaneous run: Timed ou
    t after 5000ms on the target TCI6618 Device Functional Simulator, Little Endian_0/TMS320C66x_1 (DSS_TestsScript.js#229)
            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.callProp0(OptRuntime.java:117)
            at org.mozilla.javascript.gen.c1._c0(DSS_TestsScript.js:229)
            at org.mozilla.javascript.gen.c1.call(DSS_TestsScript.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(DSS_TestsScript.js)
            at org.mozilla.javascript.gen.c1.exec(DSS_TestsScript.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: Error performing simultaneous run: Timed out after 5000ms on the target TCI6618 D
    evice Functional Simulator, Little Endian_0/TMS320C66x_1
            at com.ti.debug.engine.scripting.Simultaneous.run(Simultaneous.java:244)
            at com.ti.debug.engine.scripting.Simultaneous.run(Simultaneous.java:159)
            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)
            ... 18 more

     

    Thanks.

  • Anyone can help me?

     

    Thanks,

    Luca

  • Luca,

    As I mentioned earlier, you have to catch the exception thrown by the timeout otherwise the script will terminate with the errors you are seeing.

    Thanks

    ki