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/MSP430F1612: Logging function calls, getting output via CCS during debugging?

Part Number: MSP430F1612

Tool/software: Code Composer Studio

Windows 10 Pro 64-bit, x64-based processor

Code Composer Studio Version: 8.2.0.00007

  • Hello,
    On MSP430, there is no out of the box solution via CCS that can provide this information run-time.

    There is a static call graph option however that may be useful. It is part of the collection of CG XML script package:
    processors.wiki.ti.com/.../Code_Generation_Tools_XML_Processing_Scripts

    Thanks
    ki
  • Thank you for replying. I will have a look at that. I generated call graphs with Doxygen and Graphwiz, I guess the purpose is similar.

    I have been looking for more information and found the Debug Script Server. I watched this video on Youtube. At about 13.00 minutes there is output that would be very useful. Is this possible for the MSP430?

  • Jerker Dahlblom said:
    I have been looking for more information and found the Debug Script Server. I watched this video on Youtube. At about 13.00 minutes there is output that would be very useful. Is this possible for the MSP430?

    The DSS log is generated by DSS if logging is enabled. This logging can be enabled for any target:

    http://software-dl.ti.com/ccs/esd/documents/users_guide/sdto_dss_handbook.html#logging

    Thanks

    ki

  • I am currently exploring DSS and the Javascript functionality although I find the examples somewhat lacking of what I need. I have gone through the examples provided with the CCS 8 installation and downloaded the lab training module from 2014 listed on your website.

    Are there other examples somewhere? I find surprisingly little googling the subject.

  • Yes that is the bulk of the available DSS material. If you have specific DSS question, I can try to answer them on this forum
  • I am trying to figure out how to see where in the code DSS is. This code won't work and I cannot find any definitive answers from the examples provided with CCS 8. [Is DSS at breakpoint x right now]?

    I also found out that I cannot use code labels for breakpoints e.g. "label1 :" because compiler optimization needs to be set to 1 which removes all labels. But that is irrelevant right now as I can't get basically any understanding of DSS at the moment. For example this Javascript does not work. I get no matches. I added normal breakpoints at these locations via CSS and they work when debugging from CSS.

    script.traceWrite("Setting breakpoint");
    var mybreakpoint1 = debugSession.breakpoint.add("J32.c", 1289);
    var mybreakpoint2 = debugSession.breakpoint.add("J32.c", 1293);
    
    script.traceWrite("Calling target run");
    debugSession.target.run();
    script.traceWrite("After target run");
    var foundBreakpoints = 0;
    while(foundBreakpoints < 2){
    	var pc = debugSession.expression.evaluate("PC")
    	if(pc == mybreakpoint1){
    		script.traceWrite("My breakpoint1 : 0x" + Long.toHexString(mybreakpoint1) + "   | Halted at counter 0x" + Long.toHexString(pc));
    		foundBreakpoints++;
    	} else if(pc == mybreakpoint2){
    	script.traceWrite("My breakpoint2 : 0x" + Long.toHexString(mybreakpoint2) + "   | Halted at counter 0x" + Long.toHexString(pc));
    		foundBreakpoints++;
    	}	
    	if(foundBreakpoints < 2){
    		debugSession.target.run();	
    	}
    }

  • It looks like you have looked at the "breakpoints.js" DSS example, which is what i was going to recommend.

    I would suggest running your script through the Rhino debugger to properly debug the script. You should be able to determine the root cause of the failure that way:
    software-dl.ti.com/.../sdto_dss_handbook.html

    Thanks
    ki
  • Rhino didn't help. Tried running asynch but then again there is no support for sleep() or setting callback functions for async functions which is needed.

    Searching these forums for "debugSession.breakpoint.add" provided surprisingly few threads. Am I to believe that DSS isn't really developed anymore? A big whale stranded on the beach? Ti's video on the subject from 2013 have few views and the overall impression is that DSS is really not used. Compared to video statements that DSS is suitable for overnight testing, batch regression testing?

  • DSS is definitely supported and has widespread usage inside and outside TI. In fact, it is used by the CCS system test team to validate our product builds.

    What is the exact issue you are running into? Is it an issue of when you run the target (non-asynchronously), it never reaches the breakpoint you expect?

    Thanks
    ki

  • Hi,

    I will try different things, see what questions arise and get back to this thread this week. So please don't lock it.

  • I have finally made some progress getting basic breakpoints to work, reading variables.

    I have some questions regarding

    target.runAsynch(), target.halt() and clock.read().

    Could I, using these functions together with the memory information inside the generated *.map file located in debug folder write a script that will output function call graphs? How much does the target run before I can halt it? Is this out of my control? Can I use the clock with this somehow?

  • Jerker Dahlblom said:
    Could I, using these functions together with the memory information inside the generated *.map file located in debug folder write a script that will output function call graphs?

    I suppose this is possible. Though it would be quite an involved process. Good luck!

    Jerker Dahlblom said:
    How much does the target run before I can halt it?

    This is completely variable. From a DSS point of view, you can halt it nearly immediately after running

    Jerker Dahlblom said:
    Can I use the clock with this somehow?

    The profile clock is for counting cycles between execution. For more details on the clock, see:

    http://software-dl.ti.com/ccs/esd/documents/ccs_counting_cycles.html#profile-clock

    Note that enabling the profile clock will use an emulation resource. This is the same resource used by the device when setting hardware breakpoints and watchpoints. There is a very limited number of this resource on MSP so this is something to take into consideration.

    Thanks

    ki 

  • Thanks!

    Last question, can I somehow attach to a running target from a DSS script using the MSP4530F1612 and MSP-FETFlash Emulator Tool?

    The current script I am working on would do best if it didn't have to go through the startup of the target as it takes a long time until interesting data is produced.

    Is this possible at all? Can't find info.

  • Apparently I can run the target asynchronously for a certain time, halt it, add breakpoint and from there run it synchronously. So it seems to work.

    This is the first prototype script where it seems to work.

    script.setScriptTimeout(120000)
    
    var j32Flag = debugSession.symbol.getAddress("ui16_J32Flag");
    var lockresource = debugSession.symbol.getAddress("LockRessource");
    var bpSet = false;
    script.traceWrite("Calling runAsynch");
    debugSession.target.runAsynch();
    
    var counter = 0;
    var j32flagOldValue = -1;
    var lockresourceOldValue = -1;
    script.traceWrite("Starting loop...");
    while(counter < 5000){    
        if(!bpSet){
            wait(25000);
        }
        if(!bpSet){
            debugSession.target.halt();
            //Set a breakpoint in source file based on linenumber 
            var filename = "Code.c";
            var linenumber =  714;
            script.traceWrite("Setting breakpoint for file " + filename + " at line " + linenumber);
            var breakpoint1 = debugSession.breakpoint.add(filename, linenumber);
            bpSet = true;
            debugSession.target.run();
        }
        var pc = debugSession.expression.evaluate("PC")
        script.traceWrite("Program counter is halted @ 0x" + pc.toString(16));
    
        var j32flagValue = debugSession.memory.readData(0, j32Flag, 16, false);
        var lockresourceValue = debugSession.memory.readData(0, lockresource, 16, false);
        /*if(j32flagValue != j32flagOldValue || lockresourceValue != lockresourceOldValue){
            print("---------------------------------------------------");	
        }*/
        if(j32flagValue != j32flagOldValue){
            printVariable("ui16_J32Flag", j32flagValue);
            j32flagOldValue = j32flagValue;
        }
        if(lockresourceValue != lockresourceOldValue){
            printVariable("LockRessource", lockresourceValue);
            lockresourceOldValue = lockresourceValue;
        }
        counter++;
        //Continue running
        debugSession.target.run();
    }