Stack Variables And Parameter Passing - Analog Devices ADSP-BF53x Blackfin Reference

Table of Contents

Advertisement

[--SP] = RETS;
CALL function_b;
CALL function_c;
RETS = [SP++];
(R7:7, P5:5) = [SP++];
RTS;
/* return from subroutine */
function_a.end:
function_b:
/* do something */
RTS;
function_b.end:
function_c:
/* do something else */
RTS;
function_c.end:

Stack Variables and Parameter Passing

Many subroutines require input arguments from the calling function and
need to return their results. Often, this is accomplished by project-wide
conventions, that certain core registers are used for passing arguments,
where others return the result. It is also recommended that assembly pro-
grams meet the conventions used by the C/C++ compiler. See the
VisualDSP++ C/C++ Compiler and Library Manual for details.
Extensive arguments are typically passed over the stack rather than by reg-
isters. The following example passes and returns two 32-bit arguments:
_parent:
...
R0 = 1;
R1 = 3;
[--SP] = R0;
[--SP] = R1;
ADSP-BF53x/BF56x Blackfin Processor Programming Reference
/* save RETS onto stack */
/* call further subroutines */
/* restore RETS
/* optional multiple pop instruction */
/* closing subroutine label */
Program Sequencer
*/
4-15

Advertisement

Table of Contents
loading

This manual is also suitable for:

Adsp-bf56x blackfin

Table of Contents