Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

When using inline assembly instructions on the TI C compiler, why does the code break at run-time?

0
Posted

When using inline assembly instructions on the TI C compiler, why does the code break at run-time?

0

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.

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123