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.

TMS320F28027F: During automation In DSS scripting, Need to read Variable address.

Part Number: TMS320F28027F
Other Parts Discussed in Thread: CCSTUDIO, TMS320F28027, TMDSEMU200-U

In main.c flie program, I Need to read the address of the variables through DSS scripting syntax. Please Suggest the syntax for reading Variable address.

For example, my main.c program is

void main(void)
{
    int a=2;
    int b=5;
    int i;
    i=a+b; 

}

during reading the address of Symbols we can use the syntax as below

// Get the address of that symbol
var address = debugSession.symbol.getAddress("main")
 

*****Similar to that i need for // Get the address of that Variables

Please refer the API documentation for DSS : 

  • Hello Govinda,

    We don't have an immediate designated expert for this sort of topic, so please let me take some time to see if I can locate someone more familiar with DSS.

    Best regards,

    Omer Amir

  • Sure Take your time 

  • during reading the address of Symbols we can use the syntax as below

    // Get the address of that symbol
    var address = debugSession.symbol.getAddress("main")
     

    *****Similar to that i need for // Get the address of that Variables

    You would use the same API to get the address of the variables.

    Please note that variables "a", "b", and "i" are all local variables in your example. Hence the variables need to be in scope when trying to get the address for them.

    Thanks

    ki

  • Hii 

    I had a Query regarding the DSS Script.

    Overview 

    we are trying to automate DSS Script (Read or write Software Variables) from ECU Test Tool 

     ECU Test tool doesn't have direct Compatibility to automate DSS Script, so we are trying to create with LabVIEW or python interface for DSS SCRIPT

    We need Two Queries Support 

    1. DSS Script should run Continuously for reading and writing the software Variable. 

    2 How to pass the data to DSS Script From Python or LabVIEW?

    Thank You 

  • 1. DSS Script should run Continuously for reading and writing the software Variable. 

    Please explain your exact use case. Are you looking to have the script continually read/write variables while the target is running?

    2 How to pass the data to DSS Script From Python or LabVIEW?

    I do not have any experience with LabVIEW so I cannot comment on this. But it is possible to use python with DSS:

    https://software-dl.ti.com/ccs/esd/documents/dss_python_dss_scripting.html

  • Hii ki

    1. Yes, scripting continually to read and write variables while target is running can u explain in detail? 

    2. Thank We look into it. 

  • 1. Yes, scripting continually to read and write variables while target is running can u explain in detail? 

    C2000 supports real-time memory accesses by default. Hence, your DSS script can run the program asynchronously and then continue to make memory.read and memory.write calls to access memory while the target is running.

  • Hii KI thanks for the Confirmation

    We had another Queries in jython 

    1.We are trying to run the Jython Script, We can  able to set the environment variables, setting files location (ccxml,.out file) runs the scripts but while setting the Breakpoints in script, the memory address in the output is not shown positive as we expected.  i have mentioned the breakpoint script below

    # Set a breakpoint

    address = debugSession.symbol.getAddress("ReadNextData")

    bp = debugSession.breakpoint.add(address) 

    could u please clarify this script with solution? 

    thanks 

  • # Set a breakpoint

    address = debugSession.symbol.getAddress("ReadNextData")

    bp = debugSession.breakpoint.add(address) 

    This implementation is fine. Remember that to get the correct address for "ReadNextData", it must be in debug scope when the getAddress API is called.

  • Hi KI thanks for the Update

    But for jython, Address is not considering as a variable to fetch the exact memory address and set breakpoint. so in that case i need to consider address as a variable can u provide jython script to set the variable. 

  • Hi ki we are having more Queries regarding the Jython Script 

    Can we Connect a meeting Call in Teams So that also we can be able to Clarify our doubts Quickly?

  • You can set breakpoints on a source line or address. You can look up the address of symbols. "ReadNextData" is a function (not a variable), hence the example would be getting the address of the function start and setting a breakpoint there.

    Please explain what exactly you are trying to do. Where exactly are you trying to set a breakpoint?

  • HII Kii 

    actually we need  jython script based on breakpoints modified we tried to execute but currently not working ones, can u provide it would be much helpful

    jython breakpoint code 

    from java.lang import *
    from java.util import *
    from com.ti.debug.engine.scripting import *
    from com.ti.ccstudio.scripting.environment import *

    #Create our scripting environment object - which is the main entry point into any script and
    #the factory for creating other Scriptable Servers and Sessions
    script = ScriptingEnvironment.instance()

    #Create a log file in the current directory to log script execution
    script.traceBegin("BreakpointsTestLog_python.xml", "DefaultStylesheet.xsl")

    #Set our TimeOut
    script.setScriptTimeout(15000)

    #Log everything
    script.traceSetConsoleLevel(TraceLevel.ALL)
    script.traceSetFileLevel(TraceLevel.ALL)

    #Get the Debug Server and start a Debug Session
    debugServer = script.getServer("DebugServer.1")
    debugServer.setConfig("C:\\ti\\ccs1240\\ccs\\eclipse\\workspace\\LaunchpadC2000\\targetConfigs\\TMS320F28027.ccxml");
    debugSession = debugServer.openSession("*","*")

    debugSession.target.connect()

    #Load a program
    # ScriptingEnvironment has a concept of a working folder and for all of the APIs which take
    #path names as arguments you can either pass a relative path or an absolute path)
    debugSession.memory.loadProgram("C:\\ti\\ccs1240\\ccs\\eclipse\\workspace\\LaunchpadC2000\\Debug\\LaunchpadC2000.out")

    #Set a breakpoint
    address_main = debugSession.symbol.getAddress("main")
    bp = debugSession.breakpoint.add(address)

    # Inspect the state of the program
    print("a:", debugSession.expression.evaluate("a"))

    #Run if already not automatically halted at main. Should halt at first BP
    if(debugSession.expression.evaluate("PC") != address):
    script.traceWrite("The PC value is equal to the main value.")
    else:
    script.traceWrite("The PC value is not equal to the main value.")

    #Run the target. Should halt at our breakpoint.
    debugSession.target.run()

    # Using an expression - get the current value of the PC
    nPC = debugSession.expression.evaluate("PC")

    #Verify we halted at the correct address.
    if (nPC == address):
    script.traceWrite("SUCCESS: Halted at correct location")
    else:
    script.traceWrite("FAIL: Expected halt at 0x" + Long.toHexString(address) + ", actually halted at 0x" + Long.toHexString(nPC))
    script.traceSetConsoleLevel(TraceLevel.INFO)
    script.traceWrite("TEST FAILED!")
    script.traceEnd()
    System.exit(1);

    #All done
    #debugSession.target.disconnect();
    #debugSession.terminate()
    #debugServer.stop()

    script.traceSetConsoleLevel(TraceLevel.INFO)
    script.traceWrite("TEST SUCCEEDED!")

    debugSession.target.run()

    #Stop logging and exit.
    script.traceEnd()

  • Can you also give me the "LaunchpadC2000.out" executable? I will try to run the script from my end and see if I run into any issues.

  • Uh i cant able to update  the .out file Ki  in this chat box 

     

  • You should be able to simply drag and drop the file to the edit box.

    If the issue is with privacy, you can send it via private E2E message

  • Hi kii 

    we need to implement CCS TOOL WITH ECU Test Tool Tracetronics for automation 

    can u comment and provide best possible ways  Integrated with ECU Test tool

    since CCS Doesn't have Direct Compatibility with ECU Test Tool

  • we need to implement CCS TOOL WITH ECU Test Tool Tracetronics for automation 

    can u comment and provide best possible ways  Integrated with ECU Test tool

    since CCS Doesn't have Direct Compatibility with ECU Test Tool

    I have no experience with the ECU Test Tool, hence I can not provide any insight on this.

  • Hi Thanks For the Response

    we had one doubt. 

    can we able to get TCP PORT NUMBER of CCS Tool Which is installed in local PC!

  • can we able to get TCP PORT NUMBER of CCS Tool Which is installed in local PC!

    What is the purpose of this information?

  • Hii Kii 

    during Debugging & writing the CCS Variable through DSS Script, .out file is not updating. 

    But during the manual debugging and writing using CCS Tool .out File is updating 

    kindly clarify the Doubt ASAP!

    DSS Debugging and writing script attached below.

    // Import the DSS packages into our namespace to save on typing
    importPackage(Packages.com.ti.debug.engine.scripting)
    importPackage(Packages.com.ti.ccstudio.scripting.environment)
    importPackage(Packages.java.lang)

    // Create our scripting environment object - which is the main entry point into any script and
    // the factory for creating other Scriptable servers and Sessions
    var script = ScriptingEnvironment.instance()

    // Create a log file in the current directory to log script execution
    script.traceBegin("BreakpointsTestLog.xml", "DefaultStylesheet.xsl")

    // Set our TimeOut
    script.setScriptTimeout(15000)

    // Log everything
    script.traceSetConsoleLevel(TraceLevel.ALL)
    script.traceSetFileLevel(TraceLevel.ALL)

    // Get the Debug Server and start a Debug Session
    debugServer = script.getServer("DebugServer.1")
    debugServer.setConfig("C:\\ti\\ccs1240\\ccs\\eclipse\\workspace\\LaunchpadC2000\\targetConfigs\\TMS320F28027.ccxml");
    debugSession = debugServer.openSession("*","*")
    debugSession.target.connect();

    // Load a program
    // (ScriptingEnvironment has a concept of a working folder and for all of the APIs which take
    // path names as arguments you can either pass a relative path or an absolute path)
    debugSession.memory.loadProgram("C:\\ti\\ccs1240\\ccs\\eclipse\\workspace\\LaunchpadC2000\\Debug\\LaunchpadC2000.out")


    script.traceSetConsoleLevel(TraceLevel.INFO)
    script.traceWrite("Debug session started!!!!!!")

    var bp1 = debugSession.breakpoint.add('main.c',11);

    debugSession.target.run()

    var address = debugSession.symbol.getAddress("a")
    var address2 = debugSession.symbol.getAddress("b")

    script.traceSetConsoleLevel(TraceLevel.INFO)
    script.traceWrite(address)
    script.traceWrite(address2)
    script.traceWrite("Address Readed!!!!!!")

    //write data
    debugSession.memory.writeData(Memory.Page.PROGRAM, address, [0x02], 16)

    //write data
    debugSession.memory.writeData(Memory.Page.PROGRAM, address2, [0x05], 16)

    script.traceWrite("value written!!!!!!")

    // All done
    debugSession.target.disconnect();
    debugServer.stop()

  • Having the *.out file will help. Can you provide this to me. You can send via private E2E message if you wish. Just zip and then drag to edit box to attach

  • Hii kii i have shared the Java Script in your Private Message kindly check.

    one more support .

    can u provide java script library packages for DSS, we need to automate with the ECU Test Tool, with these java script packages to implement library in ecu test tool can u provide this ASAP! it would be much helpful.

  • Hii kii i have shared the Java Script in your Private Message kindly check.

    I will reply there.

    can u provide java script library packages for DSS

    There are in:

    • <CCS_INSTALL_DIR>/ccs/ccs_base/DebugServer/packages/ti/dss/java/dss.jar
    • <CCS_BASE_DIR>/ccs/ccs_base/DebugServer/packages/ti/dss/java/com.ti.ccstudio.scripting.environment_3.1.0.jar
    • <CCS_BASE_DIR>/ccs/ccs_base/DebugServer/packages/ti/dss/java/com.ti.debug.engine_1.0.0.jar
  • Hi KEE thanks for the update. 

    one more Support from your side 

    Can u Provide Flash Program in labview.vi. 

  • Can u Provide Flash Program in labview.vi. 

    Sorry I don't know anything about LabView.

  • Hii kee Thanks for the update 

    Currently i am having xds 200 JTAG Emulator and the target is TMDSEMU200-U but creating a new project using XDS 200 debug probe Target is not showing nor available in selection. I have attached the image below. Kindly reply ASAP !

      

  • "Target" would refer to the device you are working with, not the debug probe (which is "Connection")

  • Hii Kii 

    during Debugging & writing the CCS Variable through DSS Script, .out file is not updating. 

    But during the manual debugging and writing using CCS Tool .out File is updating 

    kindly clarify the Doubt ASAP!

    DSS Debugging and writing script attached below.

    // Import the DSS packages into our namespace to save on typing
    importPackage(Packages.com.ti.debug.engine.scripting)
    importPackage(Packages.com.ti.ccstudio.scripting.environment)
    importPackage(Packages.java.lang)

    // Create our scripting environment object - which is the main entry point into any script and
    // the factory for creating other Scriptable servers and Sessions
    var script = ScriptingEnvironment.instance()

    // Create a log file in the current directory to log script execution
    script.traceBegin("BreakpointsTestLog.xml", "DefaultStylesheet.xsl")

    // Set our TimeOut
    script.setScriptTimeout(15000)

    // Log everything
    script.traceSetConsoleLevel(TraceLevel.ALL)
    script.traceSetFileLevel(TraceLevel.ALL)

    // Get the Debug Server and start a Debug Session
    debugServer = script.getServer("DebugServer.1")
    debugServer.setConfig("C:\\ti\\ccs1240\\ccs\\eclipse\\workspace\\LaunchpadC2000\\targetConfigs\\TMS320F28027.ccxml");
    debugSession = debugServer.openSession("*","*")
    debugSession.target.connect();

    // Load a program
    // (ScriptingEnvironment has a concept of a working folder and for all of the APIs which take
    // path names as arguments you can either pass a relative path or an absolute path)
    debugSession.memory.loadProgram("C:\\ti\\ccs1240\\ccs\\eclipse\\workspace\\LaunchpadC2000\\Debug\\LaunchpadC2000.out")


    script.traceSetConsoleLevel(TraceLevel.INFO)
    script.traceWrite("Debug session started!!!!!!")

    var bp1 = debugSession.breakpoint.add('main.c',11);

    debugSession.target.run()

    var address = debugSession.symbol.getAddress("a")
    var address2 = debugSession.symbol.getAddress("b")

    script.traceSetConsoleLevel(TraceLevel.INFO)
    script.traceWrite(address)
    script.traceWrite(address2)
    script.traceWrite("Address Readed!!!!!!")

    //write data
    debugSession.memory.writeData(Memory.Page.PROGRAM, address, [0x02], 16)

    //write data
    debugSession.memory.writeData(Memory.Page.PROGRAM, address2, [0x05], 16)

    script.traceWrite("value written!!!!!!")

    // All done
    debugSession.target.disconnect();
    debugServer.stop()

    Thank you for the outfile. I was able to run the script above. It appears to run perfectly. When I run the script ind debug mode, I can see that the variables for "a" and "b" were written to with the correct values of 2 & 5 respectively (double-click on image to full size):

    Are you saying that you don't see this happen when you run you run the script?

  • yes, Kii while running the DSS script .out File is not updating but in manual testing .out file is updating.  

  • Hi Kii Thanks for the Update!

    how can I set the TMDSEMU200-U target CCS Project in code Composer Studio?

  • DSS script .out File is not updating

    What exactly does this mean? When I run your DSS script, it works perfectly from my perspective. I don't understand where there is an issue.

  • how can I set the TMDSEMU200-U target CCS Project in code Composer Studio?

    Under "Connection" as shown below:

  • Hi Kii 

    when in manual Debugging the .out file its updating and we can be able to see the update .out file in Debug Folder of Workspace 

    when in Debug Server Scripting (DSS) we are Executing in Command Prompt Execution is Done Successfully but the .out file is Not Updating in Debug Folder while doing DSS Execution 

    kindly help to Resolve this Issue.

  • but the .out file is Not Updating in Debug Folder while doing DSS Execution 

    Again, I don't understand what this means!

    Why would the .out file update? I would just get loaded by CCS.

    The DSS script is working just file. 

  • when in manual Debugging the .out file its updating and we can be able to see the update .out file in Debug Folder of Workspace 

    Perhaps a video would help explain your expectation. I want to see what you mean by "see the update .out file in the Debug Folder"

  • Hi KEE i have doubt 

    while setting the breakpoint manually in code composer studio , can we able to find out breakpoint time (like how much time it will take to execute in ms )

  • while setting the breakpoint manually in code composer studio , can we able to find out breakpoint time (like how much time it will take to execute in ms )

    Please note that this question is completely unrelated to the original question. 

    We recommend you create a new thread for a new topic.

    I will answer this question here for now but please start a NEW thread next time.

    As for your question on benchmarking, I recommend using the profile clock:

    https://dev.ti.com/tirex/explore/node?node=A__ACh7aaTRwDWC-8ORL0EHMg__ccs_devtools__FUz-xrs__LATEST

    Let's close this thread now and you can create new threads as needed.

    Thanks

    ki