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.

[C2000] Register Conventions When Creating a C-callable Assembly Function

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