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.

debugServer.openSession(".*") in CCS6.1 is unable to select the processor/device, when called from a java script

Other Parts Discussed in Thread: TM4C129XNCZAD, CCSTUDIO

Hi,

I am trying to test the application running on the controller TM4C129XNCZAD.

To validate the js (script) i have declared a TEST_VAR in  the application code and have assigned it with value 10 and in the java script i am trying to read the same using

var address = debugSession.symbol.getAddress("TEST_VAR_X")

var data = debugSession.memory.readData(Memory.Page.PROGRAM, address, 1, 1)

Prior to that i have used,

debugSession = debugServer.openSession(".*")

to begin the debug session, the issue is, when the interpreter reaches this line it is unable to select the CPU and it throws the following error

Please help me resolve this. (attached is the xml log file)

try.xml
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?xml version="1.0" encoding="windows-1252" standalone="no"?>
<?xml-stylesheet type="text/xsl" href="C:/ti/ccsv6/ccs_base/scripting/examples/DebugServerExamples/DefaultStylesheet.xsl"?>
<log>
<record>
<date>2015-09-08T16:26:39</date>
<millis>1441709799144</millis>
<sequence>3</sequence>
<logger>com.ti</logger>
<level>FINER</level>
<class>com.ti.ccstudio.scripting.environment.ScriptingEnvironment</class>
<method>traceSetFileLevel</method>
<thread>23</thread>
<message>RETURN</message>
</record>
<record>
<date>2015-09-08T16:26:39</date>
<millis>1441709799146</millis>
<sequence>4</sequence>
<logger>com.ti</logger>
<level>FINER</level>
<class>com.ti.ccstudio.scripting.environment.ScriptingEnvironment</class>
<method>getServer</method>
<thread>23</thread>
<message>ENTRY sServerName: DebugServer.1</message>
</record>
<record>
<date>2015-09-08T16:26:39</date>
<millis>1441709799146</millis>
<sequence>5</sequence>
<logger>com.ti</logger>
<level>FINER</level>
<class>com.ti.ccstudio.scripting.environment.ScriptingEnvironment</class>
<method>getServer</method>
<thread>23</thread>
<message>Getting definition for: DebugServer.1</message>
</record>
<record>
<date>2015-09-08T16:26:39</date>
<millis>1441709799152</millis>
<sequence>6</sequence>
<logger>com.ti</logger>
<level>FINER</level>
<class>com.ti.ccstudio.scripting.environment.ScriptingEnvironment</class>
<method>getServer</method>
<thread>23</thread>
<message>Constructing server</message>
</record>
<record>
<date>2015-09-08T16:26:39</date>
<millis>1441709799155</millis>
<sequence>7</sequence>
<logger>com.ti</logger>
<level>FINER</level>
<class>com.ti.ccstudio.scripting.environment.ScriptingEnvironment</class>
<method>getServer</method>
<thread>23</thread>
<message>RETURN com.ti.debug.engine.scripting.DebugServer@18f50db</message>
</record>
<record>
<date>2015-09-08T16:26:39</date>
<millis>1441709799156</millis>
<sequence>8</sequence>
<logger>com.ti.debug.engine.scripting.DebugServer</logger>
<level>FINER</level>
<class>com.ti.debug.engine.scripting.DebugServer</class>
<method>setConfig</method>
<thread>23</thread>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
log file)

listDevices: Found debuggable device: Texas Instruments XDS2xx USB Onboard Debug Probe_0/CORTEX_M4_0
listDevices: Found non-debuggable device: Texas Instruments XDS2xx USB Onboard Debug Probe_0/CS_DAP_0
listDevices: RETURN
start: RETURN
openSession: Searching for device exactly matching name: .*
openSession: No exact name matches found.  Searching for device matching regular expression: .*
disposeAndUnload: Firing: onServerStopping()
disposeAndUnload: Stopping DebugServer
terminate: ENTRY
terminate: RETURN
terminate: ENTRY
terminate: RETURN
waitUntil: ENTRY com.ti.ccstudio.scripting.environment.ScriptingEnvironment@1c07562 timeout: infinite
waitUntil: RETURN com.ti.ccstudio.scripting.environment.ScriptingEnvironment@1c07562
disposeAndUnload: Firing: onServerStopped()
SEVERE: Could not open session. Found 2 devices matching: .*
Texas Instruments XDS2xx USB Onboard Debug Probe_0/CORTEX_M4_0
Texas Instruments XDS2xx USB Onboard Debug Probe_0/CS_DAP_0
org.mozilla.javascript.WrappedException: Wrapped com.ti.ccstudio.scripting.environment.ScriptingException: Could not ope
n session. Found 2 devices matching: .*
Texas Instruments XDS2xx USB Onboard Debug Probe_0/CORTEX_M4_0
Texas Instruments XDS2xx USB Onboard Debug Probe_0/CS_DAP_0 (try.js#21)
        at org.mozilla.javascript.Context.throwAsScriptRuntimeEx(Context.java:1693)
        at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:160)
        at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:204)
        at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:66)
        at org.mozilla.javascript.gen.c1._c0(try.js:21)
        at org.mozilla.javascript.gen.c1.call(try.js)
        at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:340)
        at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2758)
        at org.mozilla.javascript.gen.c1.call(try.js)
        at org.mozilla.javascript.gen.c1.exec(try.js)
        at org.mozilla.javascript.tools.shell.Main.evaluateScript(Main.java:503)
        at org.mozilla.javascript.tools.shell.Main.processFileSecure(Main.java:425)
        at org.mozilla.javascript.tools.shell.Main.processFile(Main.java:391)
        at org.mozilla.javascript.tools.shell.Main.processSource(Main.java:382)
        at org.mozilla.javascript.tools.shell.Main.processFiles(Main.java:179)
        at org.mozilla.javascript.tools.shell.Main$IProxy.run(Main.java:100)
        at org.mozilla.javascript.Context.call(Context.java:528)
        at org.mozilla.javascript.ContextFactory.call(ContextFactory.java:450)
        at org.mozilla.javascript.tools.shell.Main.exec(Main.java:162)
        at com.ti.ccstudio.apps.internal.scripting.RunScript$1.run(RunScript.java:88)
Caused by: com.ti.ccstudio.scripting.environment.ScriptingException: Could not open session. Found 2 devices matching: .
*

  • Hello,

    Instead of using the wild card, try explicitly using the full name of the connection and device like below:

    debugSession = debugServer.openSession("Texas Instruments XDS2xx USB Onboard Debug Probe_0/CORTEX_M4_0")

    Thanks

    ki

  • Thank you Ki; it works!

    Could you please let me know is there any way to read the symbol data.
    I mean there is variable in the application that is running . (UIS_Board.out, declared as TEST_VAR_X)

    i am able to get the address of this variable using
    var address = debugSession.symbol.getAddress("TEST_VAR_X")

    could you please help me know how to get the value of TEST_VAR_X? (best API to read the value of the symbol/variable).

    Right now am trying with
    var data = debugSession.memory.readWord(0, address)

    Thanks.
  • readWord is what I would have recommended also.

    Thanks
    ki
  • Thanks Ki.


    I have 2 more question:

    1) While using memory.writeWord(page,cmdAddr, cmd)in order to write to particular address location, what would happen if the application
    running on the micro controller also writes back to same location. (because of code design)

    Example:
    I use the writeWord API to write a value X at an address Y
    Now if the code (being executed) also writes Z at the same address Y, what would be the final value at address Y?

    2) Can these DSS API's access the memory locations across the board, meaning, contents of RAM, SRAM, FLASH etc?
    or is it limited to RAM addresses?

    Appreciate your help!


    Thanks,
    -Nikhilesh
  • 1) It depends on the timing. If your code writes Z to address Y after the writeWord API is called, then the final value at address Y would be Z

    2) DSS APIs can access any valid memory address specified as writable by the debugger memory map (this assumes that the debugger memory map is configured correctly).

    Thanks

    ki

  • Thank you Ki for this information.

    I have the follow up questions on the same topic:

    In Response to the previous answer of 1) Is there a way to detect that the particular address  Y  was overwritten by code with Z value, after the Writeword API?

    What i mean is, is there a flag or monitoring mechanism (watchpoint) to know that the address Y was updated, based on this assertion i would like to go and write the required value back to Y address. (which is other than Z), am looking at a kind of overriding mechanism.

    In Response to the previous answer of 2) I am unable to figure out the debugger memory map option under CCS6.1. Refer the screenshot attached.

    Appreciate your time and help.

    Thanks,

    -Nikhilesh

  • Nikhilesh Saggere said:

    In Response to the previous answer of 1) Is there a way to detect that the particular address  Y  was overwritten by code with Z value, after the Writeword API?

    What i mean is, is there a flag or monitoring mechanism (watchpoint) to know that the address Y was updated, based on this assertion i would like to go and write the required value back to Y address. (which is other than Z), am looking at a kind of overriding mechanism.

    You can use a conditional data watchpoint to monitor writes to that address and write the required value back when triggered

    For more about watchpoints, see slides 9-10 of the Tiva TM4C1294 workshop

    http://processors.wiki.ti.com/index.php/CCS_Fundamentals_Workshop#TM4C1294

    Nikhilesh Saggere said:
    In Response to the previous answer of 2) I am unable to figure out the debugger memory map option under CCS6.1

    When in a Debug session, Go to 'Tools -> Memory Map' in the CCS Debug perspective

    Thanks

    ki

  • Thank you Ki for this information.
    Could you please point me to the corresponding DSS API to do a conditional watch?

    Or any example with this feature being used?

    I could see "waitForHalt()" under the class Taraget.

    Thanks,
    -Nikhilesh
  • A watchpoint is a type of advanced breakpoint. Hence you can use the Breakpoint Properties APIs to create a breakpoint property object. See the below wiki article for more information: processors.wiki.ti.com/.../Breakpoint

    Thanks
    ki
  • I shall try this...
  • Hi Ki-Soo-Lee

    I am able to set the watchpoint using the following DSS API's

    var Break_Point_properties=debugSession.breakpoint.createProperties(1);
    Break_Point_properties.setString("Hardware Configuration.Type", "Watchpoint");
    Break_Point_properties.setString("Hardware Configuration.Type.Location", "&TEST_VAR_X");
    Break_Point_properties.setString("Hardware Configuration.Type.Memory", "Write");

    script.traceWrite("Printing watch point properties");
    script.traceWrite("--");
    Break_Point_properties.printProperties();
    script.traceWrite("--");
    script.breakpoint.add(Break_Point_properties)

    The problem is how do i determine the particular breakpoint/watchpoint is hit?, because i would like to override the value of TEST_VAR_X only if the variable has been updated by code for other than what i have written using DSS.

    i have used to the following API to see whether the target is halted, it always shows that Target is not halted.
    var status_check = debugSession.target.isHalted();

    Basically, i would like to take override the value of variable TEST_VAR_X; only if it is changed by code, after i write it with writeWord API.
    Otherwise, i would like to continue as is.

    Also not able to find enough documentation for the API's. (any other reference?)

    Thanks,
    -Nikhilesh
  • Nikhilesh Saggere said:
    The problem is how do i determine the particular breakpoint/watchpoint is hit?, because i would like to override the value of TEST_VAR_X only if the variable has been updated by code for other than what i have written using DSS.

    The default behavior of a data watchpoint (on your target) would be to halt when the watchpoint is triggered (data write to the address). So when you run the target synchronously, as long as you don't have other breakpoints set, when the target.run() API returns because the watchpoint is triggered, you can have your DSS script write to TEST_VAR_X.

    Thanks

    ki

  • Thank you Ki, i was using the target.runAsynch() API and i was trying to see if the target was halted and then try to writeback.
    Will let you know if i need any help further.

    -Nikhilesh