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.
Hi, Champs,
My customer is using C2000 F2803x and they want to interface an assembly language routine to a C program.
Fortunately there's an application report An Easy Way of Creating a C-callable Assembly Function for the TMS320C28x DSP introduces how to implement it in detail, however there's still question on Register Conventions according to TMS320C28x Optimizing C_C++ Compiler V6.2.3 User Guide (spru514g) 7.2 Register Conventions.
Based on its description, it is the called function’s responsibility to preserve save-on-entry registers, and the calling function’s responsibility to preserve save-on-call registers if you need to preserve that register’s value. (save-on entry and save-on-call registers are listed in Table 7-2. Register Use and Preservation Conventions), then question comes, for the example showed in the application report 2.6 and 2.7, main() and slope() will be defined as calling function and called function, are both of them required to save different types' registers when calling? If so, it's easy to do in slope() since it's original assembly, but how can you do in main() as it's C-based? Using asm(" instruction ") might be something strange, isn't it?
Best Regards,
Ricky Zhang
Ricky Zhang said:but how can you do in main() as it's C-based?
Just let the compiler do it for you. There is certainly no need to add asm statements.
Thanks and regards,
-George
Thank you very much for clarification, Goerge.
How about ST0 and ST1 registers in calling function?
Best Regards,
Ricky Zhang
The status registers are not preserved in the same manner. The matter is considered on the basis of each field within the status register. This is discussed in the section titled Status Registers in the C28x compiler manual. For functions written in hand-coded assembly you have to maintain the values listed in the Presumed Value column. There isn't much to it. In most cases, you can leave them unmodified.
Thanks and regards,
-George