大家好,最近在做一个基于avalon总线的并行接口,想用最简单的方法:4x4键盘输入,7段数码管输出 的方法来验证扩展好的接口。 虽然程序很简单,但在Nios II IDE中编译时老出错,错误信息如下: ***blank_project_0.elf] Error 1
/cygdrive/c/altera/kits/nios2/bin/nios2-gnutools/H-i686-pc-cygwin/bin/../lib/gcc/nios2-elf/3.4.1/../../../../nios2-elf/bin/ld address 0x2304 of blank_project_0.elf section .onchip_ROM is not within region onchip_ROM blank_project_0 line 0 /cygdrive/c/altera/kits/nios2/bin/nios2-gnutools/H-i686-pc-cygwin/bin/../lib/gcc/nios2-elf/3.4.1/../../../../nios2-elf/bin/ld region onchip_RAM is full (blank_project_0.elf section .rwdata). Region needs to be 1016 bytes larger. blank_project_0 line 0 /cygdrive/c/altera/kits/nios2/bin/nios2-gnutools/H-i686-pc-cygwin/bin/../lib/gcc/nios2-elf/3.4.1/../../../../nios2-elf/bin/ld region onchip_ROM is full (blank_project_0.elf section .text). Region needs to be 2860 bytes larger. blank_project_0 line 0 /cygdrive/c/altera/kits/nios2/bin/nios2-gnutools/H-i686-pc-cygwin/bin/../lib/gcc/nios2-elf/3.4.1/../../../../nios2-elf/bin/ld section .bss [00001020 -> 00001133] overlaps section .text [00000820 -> 00001b2b] blank_project_0 line 0 /cygdrive/c/altera/kits/nios2/bin/nios2-gnutools/H-i686-pc-cygwin/bin/../lib/gcc/nios2-elf/3.4.1/../../../../nios2-elf/lib/mno-hw-mul/libc.a * section .bss [00001020 -> 00001133] overlaps section .text [00000820 -> 00001b2b] In function `_sbrk_r': blank_project_0 line 0 Unable to reach errno (at 0x00001024) from the global pointer (at 0x000097d0) because the offset (-34732) is out of the allowed range, -32678 to 32767.[/build/nios2/bin/nios2-gnutools/src/newlib/newlib/libc/reent/sbrkr.c] blank_project_0 line 59 no newline at end of file third.c blank_project_0 line 49
代码很简单,主要思想就是用逐行扫描法来确定所按的键,然后输出,其中delay()是防止键抖动的函数。 #include "system.h" #include <io.h>
void delay(void); int main (void) { int i, j, col, row; while(1) { IOWR_8DIRECT(0x00001400, 0x00, 0xf); delay(); if(IORD_8DIRECT(0x00001400, 0x00) != 0xf) { row=1; for(i=0;i<4;i++) { IOWR_8DIRECT(0x00001400, 0x00, row); delay(); col=IORD_8DIRECT(0x00001400, 0x00); if(col != 0xf) { col=~col; for(j=0;j<4;j++) { col>>=1; if(col == 0) { break; } } break; } row<<=1; } } if(i<4) { IOWR_8DIRECT(0x00001400, 0x01, i*4+j); } while(IORD_8DIRECT(0x00001400, 0x00) != 0xf); } return 0; } void delay(void) { int p=1; while(p++<3000); } 在下新学SOPC,请各位大虾指教,谢谢~
[此贴子已经被作者于2007-3-31 10:21:01编辑过] |