以下是c语言
#include<stdio.h>
void main()
{
short n=7;
short result;
result=factfunc(n);
printf("factorial=%d",result);
}
以下是线性汇编
.def _factfunc
_factfunc: MV A4,A1
SUB A1,1,A1
LOOP: MPY A4,A1,A4
NOP
SUB A1,1,A1
[A1] B LOOP
NOP 5
B B3
NOP 5
.end
James Li2:
可能是COFF和ELF格式不兼容的问题去掉 _factfunc前面的"_"参见 SPRAB90 section 4.1 COFF Underscore Name Mangling
henry liu:
回复 James Li2:
谢谢,编译运行都可以通过了,但是有如下warning,虽然对结果没影响,可是还是想解决,谢了
"../factorial.c", line 13: warning #225-D: function declared implicitly
warning #10210-D: creating ".stack" section with default size of 0x400; use the -stack option to change the default sizewarning #10210-D: creating ".sysmem" section with default size of 0x400; use the -heap option to change the default size
steve_xiaop:
回复 henry liu:
henry liu
谢谢,编译运行都可以通过了,但是有如下warning,虽然对结果没影响,可是还是想解决,谢了
"../factorial.c", line 13: warning #225-D: function declared implicitly
warning #10210-D: creating ".stack" section with default size of 0x400; use the -stack option to change the default sizewarning #10210-D: creating ".sysmem" section with default size of 0x400; use the -heap option to change the default size