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/TMS320F280049: How to acces variables of a already running device with help of scripting console (dss)?

Part Number: TMS320F280049
Other Parts Discussed in Thread: CCSTUDIO, , LAUNCHXL-F280049C

Tool/software: Code Composer Studio

Hi,

I have a big modular converter with 180 Piccolo F280049. For programming and debugging I have 18 XDS110. Each XDS110 is connected via JTAG chain to 10 microcontrollers. This bundle of controllers is called branch. All the controllers use the same software. So I use a big java script in the Code Composer Debug Server Scripting (Scripting Console) to load the programms.

For debugging and monitoring I want to connect the code composer via scripting console to one of the branches. I want to non-intrusively connect to the target and leave it running. I need to know the current values of some variables.

Here you find a minimal example where I´m just connecting to one of the 10 controllers of one branch:

// 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)

// Configurable Parameters
var deviceCCXMLFile = "C:/SVN/Software/F280049/targetConfigs/TMS320F280049_111.ccxml";
var programToLoad = "C:/SVN/Software/F280049/CPU1_RAM/Basis_F280049.out";

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

// Create a debug server
var debugServer = script.getServer( "DebugServer.1" );

// Set the device ccxml 
debugServer.setConfig( deviceCCXMLFile );

// Open a debug session
debugSession1 = debugServer.openSession( "RK_111_Probe", "C28xx_CPU1_1" );

// Connect to the target
debugSession1.target.connect();

// Load symbols
debugSession1.symbol.load( programToLoad );

// Run the program
debugSession1.target.runAsynch();

But using this script  CCS does not find the symbols. Like shown in the screenshot:

I can accses the registers and have a live view for there values, but I can't acces my variables. The values of the variables are just zero.

When I leave out the command: debugSession1.symbol.load( programToLoad ); I get the same state in the Debug window, but in the Expressions window in the values row its written: identifier not found: ...

How to get a connection to a running controller with proper variable accses??

By the way: The adress 0x3FC7A5, where CCS stops, is in the BootRom of my controller.

  • Hello,

    Ludwig Schlegel said:
    . I want to non-intrusively connect to the target and leave it running.

    Did you see my last post in your other thread?

    https://e2e.ti.com/support/microcontrollers/c2000/f/171/p/908884/3373022#3373022

    Ludwig Schlegel said:
    But using this script  CCS does not find the symbols. Like shown in the screenshot:

    The issue is that there are no debug symbols associated with the address where the target is halted. 

    Try addressing #1 and have your DSS script connect non-intrusively. If that is correct, then you can remove line 30 in your script (the runAsynch() call). Then enable real-time mode (or have your script do it) and then see if the values of your variables look correct.

    Thanks

    ki

  • Hi,

    Ki said:

    Did you see my last post in your other thread?

    Yes, I saw. I replied there.

    Ki said:

    The issue is that there are no debug symbols associated with the address where the target is halted.

    The interesting thing is, the target is not halted. The target is running. Just the debug session or debug server are not working properly.

    Ki said:

    Try addressing #1 and have your DSS script connect non-intrusively. If that is correct, then you can remove line 30 in your script (the runAsynch() call). Then enable real-time mode (or have your script do it) and then see if the values of your variables look correct.

    I don´t understand this. What do you mean with "#1"? Why I should use real-time mode?? I don´t want to "halt and examine the program". Anyway I tried this. The only option concerning this I found in dss is "PoliteRealtimeMode". But when I try to enable this I get the following error:

    "JavaException: com.ti.ccstudio.scripting.environment.ScriptingException: Option is disabled or readonly; unable to set value."

    Can you maybe modify my above posted script in the way you suggested?

  • Ludwig Schlegel said:
    The interesting thing is, the target is not halted. The target is running. Just the debug session or debug server are not working properly.

    The target is not running based on the screenshot you provided:

    It clearly says "Suspended" and the "Resume" button is available.

    Ludwig Schlegel said:
    I don´t understand this. What do you mean with "#1"?

    What you did in your other post is what I was suggesting 

    debugSession.options.setBoolean("HaltOnConnect",false)

    Ludwig Schlegel said:
    Why I should use real-time mode?? I don´t want to "halt and examine the program". Anyway I tried this

    Real-time mode will allow you to access target memory and registers while the target is running. Without this functionality, you would need to halt the target to read memory (and hence to read variables). 

    Ludwig Schlegel said:
    Can you maybe modify my above posted script in the way you suggested?

    I put together a little example script for you. It will be for a different target however since I do not have access to a F280049.

    Thanks

    ki



  • Hi,

    you told you wanted to write a little example script!? Can you post it?

    Ludwig

  • Please see the simple example attached (renamed as txt)

    /cfs-file/__key/communityserver-discussions-components-files/171/test1.txt

    It is a very simply script. It starts a debug session for my F28377S target. It uses a CCXML file with no GEL file associated with it. It then disables the "Halt On Connect" option and then connects to the target non-intrusively and loads the symbols for the program currently running on the target.

    Note that I didn't need to enable real-time mode since it it looks like it is already enabled by default.

    I have made a video of the script running from inside the CCS Scripting Console. Note that when I manually halt the target afterwards, the debugger is able to find the source file for the location it is halted at.

    /cfs-file/__key/communityserver-discussions-components-files/171/non_2D00_intrusive_2D00_connect.zip

    Hope this helps

    ki

  • Hi,

    I now tried to use your code. But it isn´t working for me. My code:

    // 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)
    
    // Configurable Parameters
    var deviceCCXMLFile = "C:/SVN/Software/F280049/targetConfigs/TMS320F280049_111.ccxml";
    var programToLoad = "C:/SVN/Software/F280049/CPU1_RAM/Basis_F280049.out";
    
    // Create our scripting environment object - which is the main entry point into any script and
    // the factory for creating other Scriptable ervers and Sessions
    var script = ScriptingEnvironment.instance();
    
    // Create a debug server
    var debugServer = script.getServer( "DebugServer.1" );
    
    // Set the device ccxml 
    debugServer.setConfig( deviceCCXMLFile );
    
    // Open a debug session
    debugSession1 = debugServer.openSession( "RK_111_Probe", "C28xx_CPU1_1" );
    
    debugSession1.options.setBoolean("HaltOnConnect",false);
    
    // Connect to the target
    debugSession1.target.connect();
    
    // Load symbols
    debugSession1.symbol.load( programToLoad );

    As you recommended I deleted the gel file from the target configuration. So in your case everything is working, but for me it is not.

    After I run the script the device is halted, like you can see in the screenshot:

    When I press the resume button (F8) then the program runs continues to run. Like you can see here:

    But I have no clue, why it isn´t working like shown in your video.

    What debug probe, version of ccs, operation system are you using? Where your program is running (flash or ram)?

    I have a XDS110, CCS 9.2 and Windows 10. My program runs from ram.

    Is it possible that there is a bug in my microcontroller (TMS320F280049)?

  • I installed CCS 10.1, but there I have the same result.

  • Ludwig Schlegel said:
    I have a XDS110, CCS 9.2 and Windows 10. My program runs from ram.

    I was using a different CCS version (10). I just tried again with CCS 9.2 on Windows 10. It is working fine. However, I am using a different target and connection type (F28377S with XDS100v2). I don't have your target. However I will order one to check to see if I can get it working on an F280049 via XDS110.

    What happens when, instead of using a script, you try everything manually? Does it work as expected, or do you get the same behavior?

  • I tried CCS 10.1, but there I have the same behavior. 

    And I already tried to connect manually. But there I have the same strange behavior.

    If you could check it with the same components would be really great!!

  • Ludwig Schlegel said:
    If you could check it with the same components would be really great!!

    I have ordered an F280049 board. Once I get it and try it out, I will let you know.

    Thanks

    ki

  • I just received my LAUNCHXL-F280049C and tried out my example with that board. It also worked fine (both manually and also via script). It must be something specific to your environment.

    In your last screenshot, it looks like it halted in i2c setup and if you resume, then it runs normally. So the issue is that it is still halting on connect. Can you confirm that in your manual step that the option to connect on halt is definitely disabled before you connect to the target? If so, I am at a loss on the issue. Please generate a debug server log while reproducing the issue. Then zip the log and attach the zip to this thread.

    Thanks

    ki

  • Hi everyone,
    I found a working solution to this issue. That's what I did

    1. I programmed all MC using a target config with the correct .gel file and started the program.

    // 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)
    
    // Configurable Parameters
    var deviceCCXMLFile = "<target config WITH .gel files";
    var programToLoad = "<myProject>.out";
    
    // Create our scripting environment object - which is the main entry point into any script and
    // the factory for creating other Scriptable ervers and Sessions
    var script = ScriptingEnvironment.instance();
    
    // Create a debug server
    var debugServer = script.getServer( "DebugServer.1" );
    
    // Set the device ccxml 
    debugServer.setConfig( deviceCCXMLFile );
    
    try {
    // Open a debug session
    debugSession1 = debugServer.openSession( "RK_121_Probe", "C28xx_CPU1_1" );
    print("Session 121 - 1 opened.");
    
    // Connect to the target
    debugSession1.target.connect();
    print("Target 121 - 1 connected.");
    
    // Load the program
    debugSession1.memory.loadProgram( programToLoad );
    print("Memory 121 - 1 loaded.");
    
    // Run the program
    debugSession1.target.runAsynch();
    print("Target 121 - 1 running.");
    
    } catch (exception) {
      print(exception);
    }

    2. I closed the debug session

    The program continues running. I can see this from a different control software.

    3. I deleted all the .gel file references from the target configuration and removed the halt on connect option.

    The first I did in the target configuration editor -> Advanced -> Cpu Properties -> initialisation script.

    The latter in view -> target configurations -> properies -> Program/Memory Load -> connection options -> Halt the target on a connect (checkmark removed for all listed CPUs).

    4. I used the code Ludwig suggested to connect and load the symbols.

    // 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)
    
    // Configurable Parameters
    var deviceCCXMLFile = "<target config WITHOUT .gel files";
    var programToLoad = "<my program>.out";
    
    // Create our scripting environment object - which is the main entry point into any script and
    // the factory for creating other Scriptable ervers and Sessions
    var script = ScriptingEnvironment.instance();
    
    // Create a debug server
    var debugServer = script.getServer( "DebugServer.1" );
    
    // Set the device ccxml 
    debugServer.setConfig( deviceCCXMLFile );
    
    try {
    // Open a debug session
    debugSession1 = debugServer.openSession( "RK_121_Probe", "C28xx_CPU1_1" );
    print("Session 121 - 1 opened.");
    
    // Connect to the target
    debugSession1.target.connect();
    print("Target 121 - 1 connected.");
    
    // Load symbols only
    debugSession1.symbol.load( programToLoad );
    print("Symbols 121 - 1 loaded.");
    
    // Run the program not needed!
    /* debugSession1.target.runAsynch();
    print("Target 121 - 1 running.");
    */
    
    } catch (exception) {
      print(exception.javaException.getMessage());
    }

    NOTE

    I need to select and unselect the CPU to see the Expressions after loading the symbols.

  • In general the post of my college Robin is the solution of our problem.

    But we manually have to remove all the checkmarks "Halt the target on a connect" in the target configuration files, as Robin wrote:

    Robin Liebfried said:
    The latter in view -> target configurations -> properies -> Program/Memory Load -> connection options -> Halt the target on a connect (checkmark removed for all listed CPUs).

    If we remove this checkmarks in the workspace automaticaly a launch-file (*.lauch) is created. But we woud have to do this for all 180 micocontrollers. How to automate this??

    We tried to disable "Halt On Connect" via java script:

    debugSession1.options.setBoolean("HaltOnConnect", false);

    But this isn't working!!!

  • Meanwhile we solved the problem.

    If we place "setBoolean("HaltOnConnect", false);" directly after "openSession" or directly before or after "connect" it isn't working.

    First of all we have to open all sessions, than set "HaltOnConnect" for all controllers to false and than connect for all controllers.

    You find a working version attached. Just rename Connect_111.txt to Connect_111.js.

    // Konfiguration erstellt mit "F280049_loadProgram_gen.py" am: 24.07.2020 (13:11:50)
    // To run this script open the "Scripting Console" under the "View" tab in CCS
    // use the "loadJSFile <path to file>" command to load and run this script
    // For more documentation on scipting have a look at:
    // file:///C:/ti/ccs920/ccs/ccs_base/scripting/docs/GettingStarted.htm oder
    // http://software-dl.ti.com/ccs/esd/documents/users_guide/sdto_dss_handbook.html 
    
    // 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)
    
    // Configurable Parameters
    var deviceCCXMLFile = "C:/SVN/Software/F280049/targetConfigs/TMS320F280049_111_noGel.ccxml";
    var programToLoad = "C:/SVN/Software/F280049/CPU1_RAM/Basis_F280049.out";
    
    // Create our scripting environment object - which is the main entry point into any script and
    // the factory for creating other Scriptable ervers and Sessions
    var script = ScriptingEnvironment.instance();
    
    // Create a debug server
    var debugServer = script.getServer( "DebugServer.1" );
    
    // Set the device ccxml 
    debugServer.setConfig( deviceCCXMLFile );
    
    try {
    // Open a debug session
    debugSession1 = debugServer.openSession( "RK_111_Probe", "C28xx_CPU1_1" );
    print("Session 111 - 1 opened.");
    debugSession2 = debugServer.openSession( "RK_111_Probe", "C28xx_CPU1_2" );
    print("Session 111 - 2 opened.");
    debugSession3 = debugServer.openSession( "RK_111_Probe", "C28xx_CPU1_3" );
    print("Session 111 - 3 opened.");
    debugSession4 = debugServer.openSession( "RK_111_Probe", "C28xx_CPU1_4" );
    print("Session 111 - 4 opened.");
    debugSession5 = debugServer.openSession( "RK_111_Probe", "C28xx_CPU1_5" );
    print("Session 111 - 5 opened.");
    debugSession6 = debugServer.openSession( "RK_111_Probe", "C28xx_CPU1_6" );
    print("Session 111 - 6 opened.");
    debugSession7 = debugServer.openSession( "RK_111_Probe", "C28xx_CPU1_7" );
    print("Session 111 - 7 opened.");
    debugSession8 = debugServer.openSession( "RK_111_Probe", "C28xx_CPU1_8" );
    print("Session 111 - 8 opened.");
    debugSession9 = debugServer.openSession( "RK_111_Probe", "C28xx_CPU1_9" );
    print("Session 111 - 9 opened.");
    debugSession10 = debugServer.openSession( "RK_111_Probe", "C28xx_CPU1_10" );
    print("Session 111 - 10 opened.");
    
    // Options for this debug session
    debugSession1.options.setBoolean("HaltOnConnect", false);
    debugSession2.options.setBoolean("HaltOnConnect", false);
    debugSession3.options.setBoolean("HaltOnConnect", false);
    debugSession4.options.setBoolean("HaltOnConnect", false);
    debugSession5.options.setBoolean("HaltOnConnect", false);
    debugSession6.options.setBoolean("HaltOnConnect", false);
    debugSession7.options.setBoolean("HaltOnConnect", false);
    debugSession8.options.setBoolean("HaltOnConnect", false);
    debugSession9.options.setBoolean("HaltOnConnect", false);
    debugSession10.options.setBoolean("HaltOnConnect", false);
    
    // Connect to the target
    debugSession1.target.connect();
    print("Target 111 - 1 connected.");
    debugSession2.target.connect();
    print("Target 111 - 2 connected.");
    debugSession3.target.connect();
    print("Target 111 - 3 connected.");
    debugSession4.target.connect();
    print("Target 111 - 4 connected.");
    debugSession5.target.connect();
    print("Target 111 - 5 connected.");
    debugSession6.target.connect();
    print("Target 111 - 6 connected.");
    debugSession7.target.connect();
    print("Target 111 - 7 connected.");
    debugSession8.target.connect();
    print("Target 111 - 8 connected.");
    debugSession9.target.connect();
    print("Target 111 - 9 connected.");
    debugSession10.target.connect();
    print("Target 111 - 10 connected.");
    
    // Load symbols only
    debugSession1.symbol.load( programToLoad );
    print("Symbols 111 - 1 loaded.");
    debugSession2.symbol.load( programToLoad );
    print("Symbols 111 - 2 loaded.");
    debugSession3.symbol.load( programToLoad );
    print("Symbols 111 - 3 loaded.");
    debugSession4.symbol.load( programToLoad );
    print("Symbols 111 - 4 loaded.");
    debugSession5.symbol.load( programToLoad );
    print("Symbols 111 - 5 loaded.");
    debugSession6.symbol.load( programToLoad );
    print("Symbols 111 - 6 loaded.");
    debugSession7.symbol.load( programToLoad );
    print("Symbols 111 - 7 loaded.");
    debugSession8.symbol.load( programToLoad );
    print("Symbols 111 - 8 loaded.");
    debugSession9.symbol.load( programToLoad );
    print("Symbols 111 - 9 loaded.");
    debugSession10.symbol.load( programToLoad );
    print("Symbols 111 - 10 loaded.");
    } catch (exception) {
      print(exception);
    }
    
    
    // debugServer.stop();