There is a function in the include/asm/delay.h:
static inline void __delay (unsigned long loops)
{
if (anomaly_05000312) {
/* Interrupted loads to loop registers-> bad * * *
unsigned long tmp;
__asm__ __volatile__ (
"[--SP] = LC0;"
"[--SP] = LT0;"
"[--SP] = LB0;"
"Lsetup (1f,1f) LC0 =% 1;"
"1:NOP;"
/* We Take advantage of the fact that LC0 are 0 at
* The end of the loop. Otherwise we ' d need some
* Nops on the CLI here.
*/
"CLI% 0;"
"LB0 = [sp++];"
"LT0 = [sp++];"
"LC0 = [sp++];"
"STI% 0;"
: "=d" (TMP)
: "A" (loops)
);
} else
__asm__ __volatile__ (
"Lsetup (1f, 1f) LC0 =% 0;"
"1:NOP;"
:
: "A" (loops)
: "LT0", "LB0", "LC0"
);
}
This function is used to do a specified number of empty instruction loops. But it has a problem compiling under VDSP:
[Error ea5004] "C:/temp/acc0d389ddc000/acc0d389ddc001.s": 207 Syntax Error in:
[--SP] = LC0; [--SP] = LT0; [--SP] = LB0; Lsetup (1f,1f) LC0 = P1;1:nop; CLI R0; LB0 = [sp++]; LT0 = [sp++]; LC0 = [sp++]; STI R0;
Syntax error is at or near text ' F '.
Attempting error recovery by ignoring text until the '; '
[Error ea5007] "C:/TEMP/ACC0D389DDC000/ACC0D389DDC001.S": 207 The label "1:" is illegal because it begins with a digit. If It is the GNU assembly source, rewrite to a local temporary name of your choosing. If The GNU assembly code is generated from a macro, the visualdsp++ preprocessing label auto-generation feature ("?") can Being used to generate a is a unique local label.
[Error ea5004] "C:/temp/acc0d389ddc000/acc0d389ddc001.s": 334 Syntax Error in:
[--SP] = LC0; [--SP] = LT0; [--SP] = LB0; Lsetup (1f,1f) LC0 = P1;1:nop; CLI R0; LB0 = [sp++]; LT0 = [sp++]; LC0 = [sp++]; STI R0;
Syntax error is at or near text ' F '.
Attempting error recovery by ignoring text until the '; '
[Error ea5007] "C:/TEMP/ACC0D389DDC000/ACC0D389DDC001.S": 334 The Label "1:" is illegal because it begins with a digit. If It is the GNU assembly source, rewrite to a local temporary name of your choosing. If The GNU assembly code is generated from a macro, the visualdsp++ preprocessing label auto-generation feature ("?") can Being used to generate a is a unique local label.
Previous Errors Prevent Assembly
The main reason is that the assembly in VDSP does not support jumps such as 1f, so this function should read:
static/*inline*/void __delay (unsigned long loops)
{
if (anomaly_05000312) {
/* Interrupted loads to loop registers-> bad * * *
unsigned long tmp;
__asm__ __volatile__ (
"[--SP] = LC0;"
"[--SP] = LT0;"
"[--SP] = LB0;"
"Lsetup (__delay_anomaly_1,__delay_anomaly_1) LC0 =% 1;"
"__DELAY_ANOMALY_1:NOP;"
/* We Take advantage of the fact that LC0 are 0 at
* The end of the loop. Otherwise we ' d need some
* Nops on the CLI here.
*/
"CLI% 0;"
"LB0 = [sp++];"
"LT0 = [sp++];"
"LC0 = [sp++];"
"STI% 0;"
: "=d" (TMP)
: "A" (loops)
);
} else
__asm__ __volatile__ (
"Lsetup (__delay_1, __delay_1) LC0 =% 0;"
"__DELAY_1:NOP;"
:
: "A" (loops)
: "LT0", "LB0", "LC0"
);
}
Inline is removed because when the __delay function is invoked in more than one place in a C file, it produces a duplicate label error.