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.

Disabling interrupt using Debug Server Scripts (DSS)

Other Parts Discussed in Thread: TMS320C28346

Hello fellow coders,

I am trying to automate performance testing of our system. I have TMS320C28346 target and XDS100v2 debugger. I have been using CCS GUI with following testing procedure:

1. Edit function under inspection to disable all interrupts at the beginning and restore them at the end. This step ensures that higher priority interrupts do not interfere with performance metrics.
2. Fire up CCS and place breakpoint at the beginning of the function.
3. Let the CCS break to the breakpoint.
4. Enable and reset profile clock.
5. Let the function finish.
6. Check cpu cycles spent in the function.

It is easy to understand that this approach is very time consuming. I decided to use DSS to automate everything. Now I am able to setup breakpoints at the beginning and the end of a function. However, disabling interrupts without modifying the code is not working.

I have two javascript function for disabling all interrupt and restoring them:

function DisableAllInterrupts(debugSession) {
    var interruptState = debugSession.expression.evaluate("ST1");
    debugSession.expression.evaluate("ST1 = ST1 | 0x0001");
    //debugSession.expression.evaluate("ST1 = ST1 | 0x0003");
    return interruptState;
}

function RestoreAllInterrupts(debugSession, interruptState) {
    debugSession.expression.evaluate("ST1 = " + interruptState);
}

The debugSession is com.ti.debug.engine.scripting.DebugSession. Using the old cumbersome method the results are 27 cpu clocks. Using the DSS script the results are 27, 1838 and 11006 cpu cycles. It seems obvious that my javascript functions are not working although they should work as the C counterparts. High priority interrupt are obviously pre-empting the function execution.

Is it possible to disable interrupt and restore them using DSS? My hypothesis is that the debugger does some king of manipulation on ST1 once debugSession.target.run() is called. I've also found interesting function debugSession.clock.runBenchmark() but there is no sensible documentation for it. All help is appreciated! :)

Best Regards,
Henrik 

  • Henrik,

    Not sure if it helps, but looking at some DSS code that I have (in Java, not Javascript), someone added the option to read/write CPU registers (see below).  Not sure if this will work any different than your evaluate expression method.

    				case READ_REGISTER:
    					long register_data = debugSession.memory.readRegister(params[1]);
    					return formatResponse(true, Long.toString(register_data), "register read...");
    				
    				case WRITE_REGISTER:
    					debugSession.memory.writeRegister((params[1]), Long.parseLong(params[2]));
    					return formatResponse(true, "", "register written...");

    params[1] is the register name (e.g. "ST1") and params[2] is the data to be written.

  • The problem was in other parts of my javascript code but I tested readRegister and writeRegister methods. Both approaches work as expected. Thank you.

    Best Regards,
    Henrik