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/CCSTUDIO: Proper setup when using DSS

Part Number: CCSTUDIO

Tool/software: Code Composer Studio

Hello TI!

I have been developing my own .js script to load and run programs on RVP-TDA3 board. The script basically connects to the board and the M4, DSP1, DSP2 cores. After that programs are loaded and traces are extracted upon completion. All is well so war. The problems appear when I try to run the same script again. This does not seem to be possible without a power off and on of the board and the JTAG (XDS200). It is usually not the same problem every time but I have seen two of them quite often. The first one is where the debugger cannot set CIO breakpoints since they already exist. And the second is when the debugger cannot connect to the DSP1 core with the reason that it is hang.

I will attach the startup sequence and the tear down sequence of the script.
Is there something that I'm missing from these processes?

Thanks in advance!

Regards,
Enver

// Init stage.
var env = ScriptingEnvironment.instance();

var server = env.getServer("DebugServer.1");

server.setConfig(configurationPath);
var sessionM4 = server.openSession(".*Cortex_M4_IPU1_C0");
var sessionDSP1 = server.openSession(".*C66xx_DSP1");
var sessionDSP2 = server.openSession(".*C66xx_DSP2");


  sessionM4.target.connect();

  if (!sessionM4.target.isConnected())
  {
    env.traceWrite(" [E] Target disconnected.");
    java.lang.System.exit(1);
  }

  sessionM4.target.halt();
  sessionM4.target.reset();

  // Call GEL function
  sessionM4.expression.evaluate("GEL_Reset()");
  sessionM4.expression.evaluate("GEL_AdvancedReset(\"CPU Reset\")");
  sessionM4.expression.evaluate("GEL_AdvancedReset(\"System Reset\")");
  sessionM4.expression.evaluate("OnTargetConnect_API()");
  sessionM4.expression.evaluate("DSP1SSClkEnable_API();");
  sessionM4.expression.evaluate("DSP2SSClkEnable_API();");
.
.
.
.
  env.traceWrite(" [I] sessionM4.target.halt()");
  sessionM4.target.halt();
  env.traceWrite(" [I] sessionDSP1.target.halt()");
  sessionDSP1.target.halt();
  env.traceWrite(" [I] sessionDSP2.target.halt()");
  sessionDSP2.target.halt();

  env.traceWrite(" [I] sessionDSP1.target.disconnect();");
  sessionDSP1.target.disconnect();
  env.traceWrite(" [I] sessionDSP2.target.disconnect();");
  sessionDSP2.target.disconnect();
  env.traceWrite(" [I] sessionM4.target.disconnect();");
  sessionM4.target.disconnect();

  env.traceWrite(" [I] sessionDSP1.terminate();");
  sessionDSP1.terminate();
  env.traceWrite(" [I] sessionDSP2.terminate();");
  sessionDSP2.terminate();
  env.traceWrite(" [I] sessionM4.terminate();");
  sessionM4.terminate();

  env.traceWrite(" [I] server.stop();");
  server.stop();
  env.traceWrite(" [I] reader.close();");
  reader.close();
  env.traceWrite("java.lang.System.exit(1);");
  // env.traceEnd();
  java.lang.System.exit(1);

  • Hello Enver,

    There is nothing wrong that I can discern from your script. However, these types of inconsistencies you describe are usually very target/board specific. I've had similar experiences where for certain boards I had to do a constant power cycle.

    One thing I do see that is odd is that that you call a series of resets:

    Enver Sultanov said:
      sessionM4.expression.evaluate("GEL_Reset()");
      sessionM4.expression.evaluate("GEL_AdvancedReset(\"CPU Reset\")");
      sessionM4.expression.evaluate("GEL_AdvancedReset(\"System Reset\")");

    You likely just need the System Reset since that will be the most comprehensive one.

    Otherwise your script looks fine. 

    If you do the same steps in the script all manually yourself via IDE, do you have the same issue?

    Thanks

    ki

  • Hi Ki!

    You are right those reset are results of me trying to force the board to a clean state by resetting it. I will try to use only the System Reset.

    I just tried to connect with CCS and got this error:

    Error connecting to the target:
    (Error -1143 @ 0x0)
    Device core was hung. The debugger has forced the device to a ready state and recovered debug control, but your application's state is now corrupt. You should have limited access to memory and registers, but you may need to reset the device to debug further.
    (Emulation package 8.3.0.00003)

    I there a way of rebooting the device with gel files?


    Regards,
    Enver

  • That error is usually caused because the device went into a bad state because of the application or some other external factor:

    https://software-dl.ti.com/ccs/esd/documents/ccs_debugging_jtag_connectivity_issues.html#device-hung

    You can try a System Reset 

  • I did try the script on TDA3-EVM board with XDS560V2 LAN Emulator and get kinda same error:

    SEVERE: C66xx_DSP2: Error connecting to the target: (Error -1143 @ 0x0) Device core was hung. The debugger has forced the device to a ready state and recovered debug control, but your application's state is now corrupt. You should have limited access to memory and registers, but you may need to reset the device to debug further. (Emulation package 8.3.0.00003)

    I guess this means that the issue is not connected to the emulator or the hardware but the way we use the DSS and GEL scripts?

    Regards,
    Enver

  • Enver Sultanov said:
    I guess this means that the issue is not connected to the emulator or the hardware but the way we use the DSS and GEL scripts?

    It could also mean that the running application itself put the target in a state that impacted the debugger communication with the target. These issues can be tricky to debug. Check to see if mimicking the script behavior manually via IDE yields the same result.

    ki 

  • Hi Ki,

    I think I have found my issue. It turned out to be secondary boot loader in the flash that caused issues by setting some CIO breakpoints and what not.
    The loading process is much more reliable now.

    Regards,
    Enver