Calling Assembly from C is well documented in the C6000 Compiler User's Guide. But it is not work with me.
Code from page 166.
file main.c
extern "C" {
extern int asmfunc(int a); /* declare external as function */
int gvar = 4; /* define global variable */
}
void main()
{
int I = 5;
I = asmfunc(I); /* call function normally */
......
Compilation result
"main.c", line 96: error: expected an identifier
"main.c", line 96: error: expected a ";"
"main.c", line 101: warning: parsing restarts here after previous syntax error
2 errors detected in the compilation of "main.c".
line 96 is ---- extern "C" {
file test.asm
.global _asmfunc
.global _gvar
_asmfunc:
LDW *+b14(_gvar),A3
NOP 4
ADD a3,a4,a3
STW a3,*b14(_gvar)
MV a3,a4
B b3
NOP 5
Compilation result
" test.a", line 1: error: expected a declaration
At end of source: warning: parsing restarts here after previous syntax error
1 error detected in the compilation of " test.a".
Additional Info
Code Compser Studio version 3.3.81.6
Code Genaration Tolls version 6.08.
Are there anybody able to resolve this problem?
Thanks in advance!
Andrew