Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
12748 Discussions

can't build project - strange memory problem

Altera_Forum
Honored Contributor II
1,242 Views

Hello, 

 

i got a strage error. 

i'm trying to built a simple helloworld program. 

when i compile i got this:  

**** Build of configuration Nios II for project HelloWorld2 **** make all Info: Building ../HelloWorld2_bsp make --no-print-directory -C ../HelloWorld2_bsp Info: Linking HelloWorld2.elf nios2-elf-g++ -T'../HelloWorld2_bsp/linker.x' -msys-crt0='../HelloWorld2_bsp/obj/HAL/src/crt0.o' -msys-lib=hal_bsp -L../HelloWorld2_bsp -Wl,-Map=HelloWorld2.map -O0 -g -Wall -mno-hw-div -mno-hw-mul -mno-hw-mulx -o HelloWorld2.elf obj/hello_world.o -lm /cygdrive/c/altera/91/nios2eds/bin/nios2-gnutools/H-i686-pc-cygwin/bin/../lib/gcc/nios2-elf/3.4.6/../../../../nios2-elf/bin/ld: region onchip_memory_4kB_RAM is full (HelloWorld2.elf section .text). Region needs to be 42508 bytes larger. /cygdrive/c/altera/91/nios2eds/bin/nios2-gnutools/H-i686-pc-cygwin/bin/../lib/gcc/nios2-elf/3.4.6/../../../../nios2-elf/bin/ld: region onchip_memory_4kB_RAM is full (HelloWorld2.elf section .rwdata). Region needs to be 3892 bytes larger. /cygdrive/c/altera/91/nios2eds/bin/nios2-gnutools/H-i686-pc-cygwin/bin/../lib/gcc/nios2-elf/3.4.6/../../../../nios2-elf/bin/ld: section .rodata overlaps section .exceptions /cygdrive/c/altera/91/nios2eds/bin/nios2-gnutools/H-i686-pc-cygwin/bin/../lib/gcc/nios2-elf/3.4.6/../../../../nios2-elf/bin/ld: section .rwdata overlaps section .text /cygdrive/c/altera/91/nios2eds/bin/nios2-gnutools/H-i686-pc-cygwin/bin/../lib/gcc/nios2-elf/3.4.6/../../../../nios2-elf/bin/ld: section .bss overlaps section .exceptions /cygdrive/c/altera/91/nios2eds/bin/nios2-gnutools/H-i686-pc-cygwin/bin/../lib/gcc/nios2-elf/3.4.6/../../../../nios2-elf/lib/mno-hw-mul/libc.a(sbrkr.o)(.text+0x14): In function `_sbrk_r': /build/nios2eds-gnutools-win32-9.1/bin/nios2-gnutools/src/newlib/newlib/libc/reent/sbrkr.c:59: Unable to reach errno (at 0x00001020) from the global pointer (at 0x0000aec8) because the offset (-40616) is out of the allowed range, -32678 to 32767. collect2: ld returned 1 exit status make: *** Error 1this seems like the compiler thinks there is no memory at all. 

In the SOPC-Builder i added 4K of RAM to the CPU and som I/Os as well as a JTAG all on s1. 

In Quartus i can compile it all and it seems to work, but when i use this nios.inf-file to build the helloworld projekt the memory seems to be gone? 

 

any ideas?? 

thanks in advance
0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
518 Views

The C library bits needed for the 'simple' programs are not completely trivial and need about 56k to run. 

It is all down to the use of 'stdio' files to write diagnostics to the JTAG console - as well as printf() these drag in malloc() (etc) and stuff to call fclose() on exit. 

For a small embedded system none of these are necessary - and the final product won't have the JTAG active.
0 Kudos
Altera_Forum
Honored Contributor II
518 Views

Ok, thanks, i enlarged the memory to 64K and now it works.

0 Kudos
Reply