Other Parts Discussed in Thread: ASH
I am trying to use DSS to test the execution of a program running on a C674x simulator. I have the basics working nicely but I cannot figure out how to read the profile clock to monitor the target execution time.
Given a simple program that runs forever like:
#include <stdio.h>
void main(void) {
printf("Running program.......\n");
fflush(stdout);
unsigned int cycle = 0;
while (1) {
++cycle;
}
}
And a DSS script like:
dssScriptEnv = Packages.com.ti.ccstudio.scripting.environment.ScriptingEnvironment.instance()
debugServer = dssScriptEnv.getServer("DebugServer.1")
debugServer.setConfig("tools/config/loader_config_files/simulate_c6748.ccxml")
debugSession = debugServer.openSession("*", "*")
print("TARGET: " + debugSession.getBoardName())
debugSession.target.connect()
debugSession.memory.loadProgram("temporary_build_files/main.out")
function wait(ms) {
ms += new Date().getTime();
while (new Date() < ms){}
}
debugSession.clock.enable()
debugSession.target.runAsynch()
for (var i = 0; i < 4; ++i) {
var cycles = debugSession.clock.read()
print("cycles = " + cycles)
wait(1000)
}
debugSession.target.halt()
debugSession.target.waitForHalt()
print("Halted")
var cycles = debugSession.clock.read()
print("cycles = " + cycles)
Then the output I get is:
TARGET: C674x CPU Cycle Accurate Simulator, Little Endian_0
cycles = 0
Running program.......
cycles = 3466
cycles = 3466
cycles = 3466
Halted
cycles = 17439500
I was expecting the cycles between "Running program..." and "Halted" to increase.
I'm sure I'm missing something simple here, but can't for the life of me see it.
Any help would be much appreciated,
Bryan