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.

Unit testing for DSP TMS320F2806



Hi guys,

I am looking for a possible way to implement unit testing for functions within the code composer environment. 

To give an idea of my application, I am using the F280x Digital Motor Control Library.

One of the functions I want to test will be the clarke transform:

void clarke_calc (CLARKE *v)

I want to test all possible inputs to make certain I get correct results. 

How can I get started on doing some automated testing? Thanks for any help I can get. 

  • Hi Adam,
    Code Composer Studio (CCS) comes with a tool called Debug Server Scripting (DSS). DSS is designed to allow users to completely automate the debugger from a script (preferably JavaScript, though other languages can be used). In your particular case, you can create a C test harness that calls clarke_calc in all the permutations needed and use DSS to automate starting the debugger for your target, the loading/running of this test harness executable, and do any post processing on the results.

    For more information on DSS, See: processors.wiki.ti.com/.../Debug_Server_Scripting

    Thanks
    ki
  • Hi Ki,

    Thanks for the reply. I checked out the link you listed for more information and watched the video you made.
    When you say I can create a C harness to call clarke_cal and all its permutations; would the test code be written along with my source code in code composer and DSS would be the process to automate and format it into a log report (xml)?
    I just want to make sure I understand this process correctly.

    Also, for the most part, I can iterate different inputs using a for loop, but how can I print the results each time through? Any sort of example you can provide to get me started that can relate to the math function I am using? Thanks.
  • Adam Batakji said:
    When you say I can create a C harness to call clarke_cal and all its permutations; would the test code be written along with my source code in code composer and DSS would be the process to automate and format it into a log report (xml)?

    Yes, exactly. You would write your test code that calls the function you want to test and build it all as a single executable. You can then use DSS to automate the running of this executable

    Adam Batakji said:
    Also, for the most part, I can iterate different inputs using a for loop, but how can I print the results each time through?

    There are several options. One is you can use good ol' printf (which would get captured in the DSS logs). But of course that has a lot of overhead. Another is after each iteration, you can get the results via some memory access call (read a memory location to get the result) and then use javascript print (if you are using javascript) to print the results to the console or DSS traceWrite to print the results to the console and DSS logs.

    Adam Batakji said:
    Any sort of example you can provide to get me started that can relate to the math function I am using?

    One suggestion I got from a colleague was the below:

    He could iterate over the function with different inputs and check the results against a look-up table.  He can produce the correct results from anther perhaps more accurate calculation in Matlab or a wider bit-width calculation on another machine.


    Hope this helps

    ki