User`s guide
C for DSP56800E
User Stack Allocation
123Targeting MC56F83xx/DSP5685x Controllers
asm(nop);\
asm(nop);}
#pragma check_inline_sp_effects on
int func()
{
int a=1, b=1, c;
if (a)
{
EnterCritical();
c = a+b;
}
else {
c = b++;
}
ExitCritical();
return (b+c);
}
This example will generate the following warning because the SP entering the
‘ExitCritical’ macro is different depending on which branch is taken in the if.
Therefore, accesses to variables
a, b, or c may not be correct.
Warning : Inconsistent inline assembly modification of SP in this
function.
M56800E_main.c line 29 ExitCritical();
Listing 6.3 Example 3 – Modification of SP by a Run-time Dependent Amount
#define EnterCritical() { asm(adda R0,SP);\
asm(move,l SR,X:(SP)+); \
asm(bfset #0x0300,SR); \
asm(nop); \
asm(nop);}
#define ExitCritical() { asm(deca.l SP);\
asm(move.l X:(SP)-,SR); \
asm(nop);\