When using inline assembly instructions on the TI C compiler, why the code breaks at run-time?
The TI C compiler supports an asm() instruction which allows developers to insert assembly code within C functions. However, the C compiler will only check that the asm() function is a valid assembly function. If the asm() code modifies registers required by the surrounding C code, data corruption will occur and the program will fail at run-time. The work around for this issue is to save all registers modified by inline assembly onto the system stack. This will allow all data to be restored upon return to the actual C code. This applies to all DSP targets.