Hi.
I was modifying the code provided with the TIDM-BUCKBOOST-BIDIR reference design and I came across something I do not understand. My doubt is related to context save for assembly functions called from an ISR. Let us see the following code snippet:
... _DPL_Func: ; full context save - push any unprotected registers onto stack PUSH XAR1 PUSH XAR2 PUSH XAR3 ...
This is a portion of code found in file BuckBoostBiDir-DPL.asm. Basically, my doubt is why is it needed to do those pushes?
I have seen "TMS320C28x CPU and Instruction Set - Reference Guide" and the answer to this question and I understood that when an interrupt is served by a function written in assembly code, automatic context save is done only for some specific registers and that then, it depends on the programmer to save other used registers. On the other side, when interrupts are served by functions written in C, the compiler does all the context save automagically. So, this is a kind of border case because the interrupt is served by a C function but then it calls an assembly function... I would have imagined that no context save was needed for the assembly code but those pushes seem to be exactly that. And it would make sense except for the fact that then, when the control macro CNTL_3P3Z is executed, there are others registers used (specifically, XAR4) that were not pushed. So assuming that those pushes are done as context save, would not it be needed to do the same for the other registers used in the aforementioned macro? I definitely lack knowledge of assembly and I do not completely understand how things go on in a normal call to a function written in assembly (Is this explained somewhere? I mean context save for normal calls to functions written in assembly.) but there is something strange with this example. It does not seem consistent to me. Could this last thing I am mentioning be a "bug"?
Thanks in advance!