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.

A collection of problems in automated testing for ccs scripts.

Other Parts Discussed in Thread: AWR1843

Hello Ki,

I use AWR1843, XSD110 debugger and ccs software to build a debugging environment, and use python to write scripts to call the methods in the DSS interface to achieve automated testing.I have the following confusions:

1. Can the API connect to the already opened ccs window and call the css window through other API connections?  We want to encapsulate the functionality of target board connection loading, execution, adding/removing breakpoints, reading clock values, etc. They are written into separate scripts, and after the target board connection loader runs, it can continue to execute the next script to achieve a coherent function. For example, the target board is connected and loaded ---> increase the breakpoint, read the value of the timer (at this time, the target board has been suspended when encountering a breakpoint) ---> continue to run the target board, reach the breakpoint again, and read the clock value , These processes are implemented by scripts individually (after the first script is connected and loaded, subsequent scripts do not need to be loaded repeatedly), and executing different scripts can control the same debug window. If so, please give an example for reference, Thanks!

2.The .xml log generated after the script is executed is blank when opened with a browser. After changing the suffix to .html, the content is not presented in table form.

  • Hello,

    1. Can the API connect to the already opened ccs window and call the css window through other API connections? 

    Short answer: No.

    You can have your script launch a CCS instance and interface with it. But you cannot have your script inteface with an existing CCS instance.

    There is a workaround you can explore. It involves additional complexity but it may suit your needs:

    https://software-dl.ti.com/ccs/esd/documents/dss_test-server.html

    2.The .xml log generated after the script is executed is blank when opened with a browser. After changing the suffix to .html, the content is not presented in table form.

    Make sure:

    1) That there is a closing </log> tag at the end of the file

    2) The DefaultStylesheet.xsl is properly referenced by the log.

    Thanks

    ki

  • Hello Ki, thank you very much for your help, we have successfully built the server and client according to the example you gave, and realized the communication between the two. But we found that this method seems to treat the two cores as two clients and interact with the server respectively, the commands and operations to be executed by each client can still only be written in one script and executed at one time. I still can't write the command operations to be executed by a client separately in different scripts. What i want to achieve is that after the two clients are connected to the server through the port number, the connection load command is executed by perl_clientOne script  and then the connection between the server and the target board is maintained. Then use one of the clients to continue to interact with the server through the port number, and execute the perl_clientOne_SetBreakPoint script to realize the breakpoint function. Can you understand  what i mean? We now execute the perl_clientOne_SetBreakPoint script after the server is connected to the target board, and there is no response from the client and the server. Did we write the wrong perl script, or did CSS simply not support our way of script testing? The following is the script we wrote, please take a look at it, thank you!

    Regarding the log problem, we did as you said, but the problem still hasn't been solved.

    perl_clientOne.txt
    BEGIN {
    	# Add the @INC path the directory where the DSSClient module is found.
    	push (@INC, "dss");
    }
    use strict;
    use warnings;
    use DSSClient;
    
    if (scalar(@ARGV) != 2) {
        die "Usage: perl perl_client <local host> <port number>\n";
    }
    
    my $host = $ARGV[0];
    my $port = $ARGV[1];
    
    my $client = new DSSClient($host, $port);
    my $cmd = undef;
    my $result = undef;
    
    # Connect to the CCS json server.
    $client->open();
    
    #Send commands to DSS Test Server
    #----------------
    # This command does not exist and should FAIL.
    $cmd = {
    	"name" => "buggyrun",
    };
    execute_command($cmd);
    
    # Connect to the target.
    $cmd = {
    	"name" => "connect",
    };
    execute_command($cmd);
    
    # Demonstrate the use of custom commands (report current timeout value)
    $cmd = {
    	"name" => "custom_cmd",
    };
    execute_command($cmd);
    
    # Demonstrate the use of custom commands (report current timeout value)
    $cmd = {
    	"name" => "custom_cmd",
    };
    execute_command($cmd);
    
    # Disconnect from the target.
    $cmd = {
    	"name" => "disconnect",
    };
    execute_command($cmd);
    
    # Connect to the target.
    $cmd = {
    	"name" => "connect",
    };
    execute_command($cmd);
    
    # Connect to the target.
    $cmd = {
    	"name" => "connect",
    };
    execute_command($cmd);
    
    # Load program.
    $cmd = {
    	"name" => "loadProgram",
    	"program" => "C:/Tool/JPython/bin/target-config/xwr18xx_mrr_ti_design_mss.xer4f",
    };
    execute_command($cmd);
    
    # Load program.
    $cmd = {
    	"name" => "loadBinaryProgram",
    	"program" => "C:/Tool/JPython/bin/target-config/ROC_LCP_FLASH_debug.bin",
    	"address" => "0x510e0000",
    };
    execute_command($cmd);
    
    # We are done now.
    $client->close();
    
    # Duplicate close call will fail
    $client->close();
    
    #------------------
    
    # execute command
    sub execute_command
    {
        $result = $client->execute($_[0]);
        
        if (defined $result) {
            print "$_[0]{name}: ". $result->{"status"} . "\n";  
            # If there is a message, print it
            if (exists $result->{"message"} ) {           
            	print "  message: " . $result->{"message"} . "\n";
            }
            # If a value was returned, print it
            if (exists $result->{"value"} ) {           
            	print "  value: " . $result->{"value"} . "\n";
            }
        } else {
            print "$_[0]{name} execution failed\n";
        }
    }
    
    perl_clientOne_SetBreakPoint.txt
    BEGIN {
    	# Add the @INC path the directory where the DSSClient module is found.
    	push (@INC, "dss");
    }
    use strict;
    use warnings;
    use DSSClient;
    
    if (scalar(@ARGV) != 2) {
        die "Usage: perl perl_client <local host> <port number>\n";
    }
    
    my $host = $ARGV[0];
    my $port = $ARGV[1];
    #my $portTwo = $ARGV[2];
    
    my $client = new DSSClient($host, $port);
    my $cmd = undef;
    my $result = undef;
    
    # Connect to the CCS json server.
    $client->open();
    
    #Send commands to DSS Test Server
    #----------------
    #Set breakpoint 
    $cmd = {
    	"name" => "setBreakpointByLineNo",
    	"fileName" => "SCHM.c",
    	"lineNo" => "306",
    };
    execute_command($cmd);
    
    # We are done now.
    $client->close();
    
    # Duplicate close call will fail
    $client->close();
    
    #------------------
    
    # execute command
    sub execute_command
    {
        $result = $client->execute($_[0]);
        
        if (defined $result) {
            print "$_[0]{name}: ". $result->{"status"} . "\n";  
            # If there is a message, print it
            if (exists $result->{"message"} ) {           
            	print "  message: " . $result->{"message"} . "\n";
            }
            # If a value was returned, print it
            if (exists $result->{"value"} ) {           
            	print "  value: " . $result->{"value"} . "\n";
            }
        } else {
            print "$_[0]{name} execution failed\n";
        }
    }
    

  • We also found that if we want the client to automatically hand over control after executing the command, we should call the runAsynch() API, but this API cannot make our target board run successfully. If the run() API is called, the target board can run successfully, but the control will not be returned to us. How should we solve this problem?

  • We also found that if we want the client to automatically hand over control after executing the command, we should call the runAsynch() API, but this API cannot make our target board run successfully. If the run() API is called, the target board can run successfully, but the control will not be returned to us. How should we solve this problem?

    I'm not sure what the issue could be. Please explain how the board is not running succerssfully when runAsynch is called. The target execution should be the same between run and runAsynch.

  • Regarding the log problem, we did as you said, but the problem still hasn't been solved.

    Please attach the log file so that I can analyze.

    As for the main issue, I will take a closer look at the issue shortly and will let you know my thoughts.

    Thanks

    ki

  • That mean, if the two cores call the runAsynch() API respectively, the indicator light of the target board will not flash. If the run() API is called, the target board can run and the indicator light will flash. We also think that the functions performed by the runAsynch() API and the run() API should be the same. Both APIs can make the target board flash,the only difference is that the runAsynch() API will return control, but the actual situation does not seem to be the case.

  • I would like to ask if the scripts I uploaded above and the execution results are correct? The function is not implemented, is there something wrong with the script?

  • test_server.xml

    Thanks.

    The file is missing </log> at the end. I added it. But I still had issues like you said.

    It looks like an issue with modern browsers blocking access to the XSTL stylesheet. See below:

    https://stackoverflow.com/questions/65542487/xslt-stylesheet-isnt-applied-to-xml-in-firefox-how-to-fix-it

    When I use the FireFox workaround in the thread above, it works:

  • That mean, if the two cores call the runAsynch() API respectively, the indicator light of the target board will not flash. If the run() API is called, the target board can run and the indicator light will flash. We also think that the functions performed by the runAsynch() API and the run() API should be the same. Both APIs can make the target board flash,the only difference is that the runAsynch() API will return control, but the actual situation does not seem to be the case.

    I see you started a new thread:

    https://e2e.ti.com/support/tools/code-composer-studio-group/ccs/f/code-composer-studio-forum/1135911/ccs-awr1843

    I'll discuss further on that thread