The run-time model defines some registers as scratch registers and others
as preserved or dedicated. The contents of the scratch registers may be
changed without warning by the called C/C++ function. If the assembly
language program needs the contents of any of those registers, you must
save their contents before the call to the C/C++ function and then restore
those contents after returning from the call.
Do not use the dedicated registers for other than their intended purpose;
the compiler, libraries, debugger, and interrupt routines all depend on
having a stack available as defined by those registers.
Preserved registers can be used; their contents will not be changed by call-
ing a C/C++ function. The function will always save and restore the
contents of preserved registers if they are going to change.
If arguments are on the stack, they are addressed via an offset from the
stack pointer or frame pointer. Explore how arguments are passed between
an assembly language program and a function by writing a dummy func-
tion in C/C++ and compiling it with the
(the
"-save-temps"
volatile global variables in
function passes arguments, and then duplicate that argument setup pro-
cess in the assembly language program.
The stack must be set up correctly before calling a C/C++ callable func-
tion. If you call other functions, maintaining the basic stack model also
facilitates the use of the debugger. The easiest way to do this is to define a
C/C++ main program to initialize the run-time system; maintain the stack
until it is needed by the C/C++ function being called from the assembly
language program; and then continue to maintain that stack until it is
needed to call back into C/C++. However, make sure the dedicated regis-
ters are correct. You do not need to set the
is never used by the recipient.
FP
VisualDSP++ 3.5 C/C++ Compiler and Library Manual
for ADSP-219x DSPs
command-line switch). By examining the contents of
file, you can determine how the C/C++
*.s
save temporary files
prior to the call; the caller's
FP
Compiler
option
1-173
Need help?
Do you have a question about the VISUALDSP++ 3.5 and is the answer not in the manual?