Altera_Forum
Honored Contributor
20 years agoCalling Assembly Function from C in NIOSII IDE
Has anyone called assemby functions from C with NIOS II IDE.
I have an Assemby file that looks similar to the following; .global read_com1
read_com1:
movia %g7,com1
movia %g1,com1_cpw
st ,%g7 ;Store start of buffer in com1 cpw
movia %g7,com1
movia %g1,com1_cpr
st ,%g7 ;Store start of buffer in com1 cpr
movia %g7,com1_wrpf;zero com1_wrpf
movia %g0,0x00
st ,%g0
movia %g7,com1_rdfl;zero com1_rdfl
movia %g0,0x00
st ,%g0
jmp %o7 ;Return
nop then I have a C file with a prototype and trying to call this assembly function. as follows //Prototypes
int read_com1(void);
value = read_com1(); The compiler and the Assembler complete with no errors but the linker gives me that following error; undefined reference to `read_com1' I have used this in NIOS V3.0 projects in the past with no trouble. Does anyone have any idea why this is not working in NIOSII IDE. Any thoughts or Ideas would be greatly appreciated!! Brandon