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.

TMS320F28335: Can DSS execute just one c function at a time?

Part Number: TMS320F28335


Has anyone devised a way to just run one c function from a .out file at a time via dss?  obviously .out files can be loaded and run but I wanted to avoid compiling a new .out for each function and parameters if I could avoid.  For larger context I'm trying to write a unit test framework.  My goal is to pass an arbitrary function address with an arbitrary number of parameters written to a buffer from dss into c, execute the function with the correct parameters in the correct types, check test results and loop.

  • Hello,

      My goal is to pass an arbitrary function address with an arbitrary number of parameters written to a buffer from dss into c, execute the function with the correct parameters in the correct types, check test results and loop.

    You can use DSS to write the parameter values to the buffer (writeData API), set the program counter to the start address of the function (writeRegister) and have it execute from there.

    Another option is to pass arguments to main (which can be done with the DSS programLoad API) which will pass in the parameters and the function address for the specific test required.

    ki

  • Thank you Ki the first method sounds like the one I am looking for.  My question is when I use the writeData API it is going to put parameters of different types into a fixed size element right?  So then when I loop through that array I'll have to cast the buffer values to the proper types and put them in the right place when I call the function.  That's the part I'm currently stuck on and a cursory glance through the compiler docs makes it seem like recreating how the compiler arranges the stack is not trivial

  • Sorry I'm still new to this and have a mental sticking point here.  If I advance the program counter to a function uint16_t readPin(uint16_t pin), where must I put the 16 bit pin number before letting the program run?

  • where must I put the 16 bit pin number before letting the program run?

    Function parameters would either be stored on the stack or core registers. It would vary depending on the platform. On 28x it might be AL register to start with. You can refer to the device documentation for more details. 

  • yes but what a pain it will be to implement

  • agreed. It may be cleaner to modify the main test harness so that you can pass arguments to main, with those arguments dictating which function is called with which parameters.

    Perhaps 3rd party code analysis tools like ParaSoft can be used? (disclaimer: I don't have much experience using it myself)

    ki

  • Thanks Ki this is the approach I'm taking.  I have an enum with the function signature and then I switch on that to read in the arguments, cast them properly and then call the function with the correct parameters.  I mostly have it working now and am working on actually getting some test cases running through.  We have looked and are continuing to evaluate tools like ParaSoft which will definitely help.  Though the more I use dss I realize it is extremely powerful and you can essentially control the entire state of the board right from javascript.  So for my uint tests the only c code I have is a wrapper in a loop that.  Then I maintain that c code when we have a new function signature.  Otherwise everything is driven off of js. Thats what I'm trying to accomplish anyway

  • Thanks Ki this is the approach I'm taking.  I have an enum with the function signature and then I switch on that to read in the arguments, cast them properly and then call the function with the correct parameters

    Yes that sounds like the right approach. This is what comes to mind for me also.