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.

CCS/TMS320F28030: DSS: How to handle an infinite while loop in program

Part Number: TMS320F28030
Other Parts Discussed in Thread: CCSTUDIO

Tool/software: Code Composer Studio

Hi,

my customer is using DSS for debugging on TMS320F2803x and CCS Ver 7.2.0.

Processing of farmware written to the microcomputer whose value is to be changed / extracted is infinite loop, and there are no breakpoints in the loop, and processing on JavaScript stops when accessing the microcomputer.

In the following description, the operation is retained by "debugSession.target.run ();", where a is output but b is not output.

 debugSession.memory.loadProgram()

 print(["a"])

 debugSession.target.run();

 print(["b"]);

Is there any way to get out of debugSession.target.run () while keeping access in such a state?

Best Regards,

M.Ohhashi

  • Ohhashi-san,

    target.run() is an synchronous call, which will only return when the target is halted (or if the script timeout occurs).

    There is a target.runAsynch() call that will return immediately after running the target. This is likely what is needed.

    Thank you

    ki

  • Ki-san,

    Thank you for your reply.

    The suggestion is helpful for us.

    I appreciate it.

    Best Regards,

    M.Ohhashi

  • Hi Ki-san,

    They tried to use target.runAsynch() but they got below error.

    Can you tell me what the following requirements are output and workaround?

    "uncaught JavaScript runtime exception: ReferenceError: "ScriptingEnvironment" is not defined."

    Best Regards,

    M.Ohhashi

  • Ohhashi-san,

    Masashi Ohhashi said:
    "uncaught JavaScript runtime exception: ReferenceError: "ScriptingEnvironment" is not defined."

    How is target.runAsynch() being called? It should be using the same debug session instance as target.run();

    Using a similar example as the one you used:

     debugSession.memory.loadProgram()

     print(["a"])

     debugSession.target.runAsynch();

     print(["b"]);

  • Hi ki-san,

    Thank you for your reply.

    > How is target.runAsynch() being called? It should be using the same debug session instance as target.run();

    Yes. They used the debugSession.target.runAsynch(); in the same session. Attached file is their code.

    /cfs-file/__key/communityserver-discussions-components-files/81/2148.code.txt

    I would appreciate it if you would check the code.

    Best Regards,

    M.Ohhashi

  • Ohhashhi-san,

    Thank you for the code example. 

    Normally, the error mentioned would occur if the scripting environment packages are not being imported. But I see that the code does import it (line 4):

    importPackage(Packages.com.ti.ccstudio.scripting.environment);

    So I do not know why the customer sees the error. I ran their script and (with a few changes to match my environment) it worked fine.

    Can the customer run it on their environment again and the provide the generated log.xml file?

    Thank you

    ki

  • Ki-san,

    Thank you for checking the code.

    They didn't get the log.xml when they used debugSession.target.runAsynch(). It didn't seem to generate the files.

    But they tried to use debugSession.target.run() and got the log.xml. (They didn't use infinite loop on C2000 in this case.)

    Best Regards,

    M.Ohhashi

  • Ohhashi-san,

    Masashi Ohhashi said:

    They didn't get the log.xml when they used debugSession.target.runAsynch(). It didn't seem to generate the files.

    Ah, yes. The script can not even run because of the runtime exception with the scripting environment.

    Can the customer try this instead - have them take the working script (the one with debugSession.target.run() ) and then have them modify it by adding the the below line

    debugSession.target.runAsynch();

    Have them add it after the target.run call so that the run and runAsynch commands are run back to back.

    So it would look like:

    debugSession.target.run();

    debugSession.target.runAsynch();

    Then run the script again. See if the same exception occurs again.

    Thank you

    ki

  • Ohhashi-san,

    While we investigate the issue with target.runAsynch(), the customer can try a different workaround.

    Set a script timeout:

    script.setScriptTimeout(10000); 

    The above will trigger a timeout exception after 10 seconds for any DSS API call that does not return by then.

    Then make sure to handle the exception with a try-catch for the target.run() call. You can handle the exception any way you wish (gracefully quit the script or continue execution of the rest of the script)

    Thank you

    ki

  • Ki-san,

    Thank you for your suggestion.

    They can run the code.

    We really appreciate it.

    Best Regards,

    M.Ohhashi

  • Ohhashi-san.

    Good to hear.

    What did they do to get things to work? Is it using the script timeout?

    Did they also try calling runAsynch after run? I am still confused why that call was not working for the customer

    Thank you

    ki

  • Hi Ki-san,

    It seems Rhino related files were corrupted. So they re-installed the files and they could run the script.

    We really appreciate it.

    Best Regards,

    M.Ohhashi