Altera_Forum
Honored Contributor
20 years agoAn error during compiling
hi,
i'm a freshman in embedded.my target board is cyclone2 ep2c35(with 48k total ram bits on chip,105 M4k memory blocks). the components i added into my design as follows: a processor,on chip memory(16kbytes ram) ,lcd_display,jtag uart,pio my program :# include "alt_types.h"# include <stdio.h># include <unistd.h># include "system.h"# include "sys/alt_irq.h"# include "altera_avalon_pio_regs.h" ... FILE * lcd; lcd = fopen("/dev/lcd_display", "w"); ....... i select "small C library" and "reduced device drivers" options i encounter two questions while compiling 1)i can't use the fopen function,the error msg during compiling: obj/count_binary.o(.text+0x98): In function `main': ../count_binary.c:22: undefined reference to `fopen collect2: ld returned 1 exit status make: *** [count_binary_3.elf] Error 1 Build completed finally i use printf instead.and the program can run on the "nios/s" core; when i run it on my core descibed above, i came across another problem 2) Linking count_binary_3.elf... /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_memory_0 is full (count_binary_3.elf section .text). Region needs to be 42168 bytes larger. /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_memory_0 is full (count_binary_3.elf section .rwdata). Region needs to be 652 bytes larger. /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 .rodata [00000020 -> 00000737] overlaps section .exceptions [00000020 -> 000001c7] /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 .rwdata [00000738 -> 0000228b] overlaps section .text [000001c8 -> 0000c4b7] /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 [00000020 -> 00000257] overlaps section .exceptions [00000020 -> 000001c7] obj/count_binary.o(.text+0xc8): In function `count_lcd': ../count_binary.c:60: Unable to reach (at 0x00000034) from the global pointer (at 0x0000a210) because the offset (-41436) is out of the allowed range, -32678 to 32767. is it necessary to add an extern memory? if yes,how can i do it?because i looked through the nios2 sw&hw dev handbook but can't find the introduction of steps to add a extern ram can anyone help me? thank u for your attention