AnsweredAssumed Answered

Mixed C/Assembly by using the alternate registers as context-switch?

Question asked by heikon on Jul 31, 2015
Latest reply on Aug 21, 2015 by Harshit.Gaharwar

Hi everyone,


i have a question about calling a assembly function from a C function. The ADSP21061 is in use.

I want to use the alternate register instead of saving all registers on to the stack. So the programm sequence would be:


C-File:                               ASM-File:


Call_ASM-Function();          _Call_ASM-Function:


                                             push sts;

                                             bit set mode1 SRD1L|SRD1H|SRRFL|SRRFH;


                                                  /* Beginnung of the Code*/


                                                  /* End of the Code*/

                                             bit clr mode1 SRD1L|SRD1H|SRRFL|SRRFH;


                                             pop sts;



....and now we´re back in C


In the ASM-Function (Call_ASM-Function()) two interrupts will be enabled, one of them asume to save the ASTAT-register.

So the interrupt occurs only when i´m in "assembly-mode", so they should work also on the alternate regsiter (this should be not problem because the register used in ISR are NOT used in ASM-Function).

In the Simulation everything works fine, but not on the hardware. I do not know if the source of error is the interrupt-handling, but i want to make sure that this is not the problem.


The error occurs NOT frequently, so sometimes it works fine sometimes not. Remember that i have no debug-possibility on the hardware.


Kind regards,