请教对SRAM的读写操作问题(附程序) #include <stdio.h> #include "system.h" #include "alt_types.h" int main() { alt_u32 i; int j; int *p1; int a[2048]; int b[2048]; for(i=0;i<2048;i++) { a=i+1; } for(i=0;i<0x800;i++) { IOWR_8DIRECT(0x00400000, 0, a); } printf("Hello from NIOS II!\n"); p1=(int*)0x00401000; for(j=0;j<0x800;j++) { IORD_8DIRECT(0x00401000, 0); b[j]=(*p1)&0xff; printf("%d\n",b[j]); } printf("Hello from Host!\n"); return 0; } 报错为: **** Build of configuration Debug for project hello_world_0 **** make -s all Compiling hello_world.c... ../hello_world.c: In function `main': ../hello_world.c:22: warning: implicit declaration of function `IOWR_8DIRECT' ../hello_world.c:31: warning: implicit declaration of function `IORD_8DIRECT' ../hello_world.c:40:2: warning: no newline at end of file Linking hello_world_0.elf... obj/hello_world.o(.text+0x7c): In function `main': ../hello_world.c:22: undefined reference to `IOWR_8DIRECT' obj/hello_world.o(.text+0xc4):../hello_world.c:31: undefined reference to `IORD_8DIRECT' collect2: ld returned 1 exit status make: *** [hello_world_0.elf] Error 1 Build completed in 11.344 seconds
[此贴子已经被作者于2007-8-29 19:19:25编辑过] |