Reply by November 18, 20082008-11-18
Try using alt_printf (instead of printf) for printing statements to a
terminal screen if you want a smaller footprint for a Nios project.
This is a lighter-weight version of printf that's optimized for Nios
(also has fewer features, but works fine for my UART interfacing).

Also try checking the "reduced device drivers" and "lightweight device
drivers API" in the project settings.  This should help.  My project
was in Nios IDE 6.1, so I can't speak to the newer toolsets, but this
worked for me.






On Nov 14, 2:23=A0am, Bas Laarhoven <s...@xs4all.nl> wrote:
> fl wrote: > > On Nov 13, 2:01 pm, Frank Buss <f...@frank-buss.de> wrote: > >> fl wrote: > >>> Hi, > >>> I am trying to use Nios II with one Stratix II (2S60) DSP board, not > >>> the Nios board. Even to use Nios /f in the simplest hello example, th=
e
> >>> following error message is still there. What is the problem? Thanks > >>> all. BTW, Using Quartus 7.2 subscription. > >>> **** Build of configuration Debug for project hello_world_1 **** > >> Try release mode. You can switch this somewhere in the project setting=
s in
> >> Eclipse ("Properties" right-click menu item on the project). > > >> -- > >> Frank Buss, f...@frank-buss.dehttp://www.frank-buss.de,http://www.it4-=
systems.de
> > Thanks. I change mode from Debug to Release. Although the memory > > requirement is smaller (from 40K to 14K), it still has the same error > > message. > > The program is only a simple Hello_world. It should not be so memory > > hungry. > > Thanks, > > > **** Build of configuration Release for project hello_world_1 **** > > > make -s all includes > > Compiling hello_world.c... > > Linking hello_world_1.elf... > > /cygdrive/c/altera/72/nios2eds/bin/nios2-gnutools/H-i686-pc-cygwin/ > > bin/../lib/gcc/nios2-elf/3.4.1/../../../../nios2-elf/bin/ld: region > > onchip_mem is full (hello_world_1.elf section .text). Region needs to > > be 14136 bytes larger. > > This message indicates that the linker thinks you've got no memory _at > all_ for the text section! So memory is not to small, but probably badly > mapped. I suggest you look at (and compare) the linker configuration and > SOPC/NIOS configuration. > > -- Bas > > > /cygdrive/c/altera/72/nios2eds/bin/nios2-gnutools/H-i686-pc-cygwin/ > > bin/../lib/gcc/nios2-elf/3.4.1/../../../../nios2-elf/bin/ld: region > > onchip_mem is full (hello_world_1.elf section .rwdata). Region needs > > to be 2676 bytes larger. > > /cygdrive/c/altera/72/nios2eds/bin/nios2-gnutools/H-i686-pc-cygwin/ > > bin/../lib/gcc/nios2-elf/3.4.1/../../../../nios2-elf/bin/ld: > > section .rodata [00002020 -> 00002067] overlaps section .exceptions > > [00002020 -> 000021c7] > > /cygdrive/c/altera/72/nios2eds/bin/nios2-gnutools/H-i686-pc-cygwin/ > > bin/../lib/gcc/nios2-elf/3.4.1/../../../../nios2-elf/bin/ld: > > section .rwdata [00002068 -> 00003a73] overlaps section .exceptions > > [00002020 -> 000021c7] > > /cygdrive/c/altera/72/nios2eds/bin/nios2-gnutools/H-i686-pc-cygwin/ > > bin/../lib/gcc/nios2-elf/3.4.1/../../../../nios2-elf/bin/ld: > > section .bss [00002020 -> 00002233] overlaps section .exceptions > > [00002020 -> 000021c7] > > /cygdrive/c/altera/72/nios2eds/bin/nios2-gnutools/H-i686-pc-cygwin/ > > bin/../lib/gcc/nios2-elf/3.4.1/../../../../nios2-elf/lib/mhw-mulx/ > > mcustom-fpu-cfg=3D60-1//libc.a(sbrkr.o)(.text+0x14): In function > > `_sbrk_r': > > /build/nios2eds-gnutools-win32-7.2/bin/nios2-gnutools/src/newlib/ > > newlib/libc/reent/sbrkr.c:59: Unable to reach errno (at 0x00002020) > > from the global pointer (at 0x0000ba1c) because the offset (-39420) is > > out of the allowed range, -32678 to 32767. > > > collect2: ld returned 1 exit status > > make: *** [hello_world_1.elf] Error 1 > > Build completed in 8.297 seconds
Reply by Bas Laarhoven November 14, 20082008-11-14
fl wrote:
> On Nov 13, 2:01 pm, Frank Buss <f...@frank-buss.de> wrote: >> fl wrote: >>> Hi, >>> I am trying to use Nios II with one Stratix II (2S60) DSP board, not >>> the Nios board. Even to use Nios /f in the simplest hello example, the >>> following error message is still there. What is the problem? Thanks >>> all. BTW, Using Quartus 7.2 subscription. >>> **** Build of configuration Debug for project hello_world_1 **** >> Try release mode. You can switch this somewhere in the project settings in >> Eclipse ("Properties" right-click menu item on the project). >> >> -- >> Frank Buss, f...@frank-buss.dehttp://www.frank-buss.de,http://www.it4-systems.de > Thanks. I change mode from Debug to Release. Although the memory > requirement is smaller (from 40K to 14K), it still has the same error > message. > The program is only a simple Hello_world. It should not be so memory > hungry. > Thanks, > > > > > **** Build of configuration Release for project hello_world_1 **** > > make -s all includes > Compiling hello_world.c... > Linking hello_world_1.elf... > /cygdrive/c/altera/72/nios2eds/bin/nios2-gnutools/H-i686-pc-cygwin/ > bin/../lib/gcc/nios2-elf/3.4.1/../../../../nios2-elf/bin/ld: region > onchip_mem is full (hello_world_1.elf section .text). Region needs to > be 14136 bytes larger.
This message indicates that the linker thinks you've got no memory _at all_ for the text section! So memory is not to small, but probably badly mapped. I suggest you look at (and compare) the linker configuration and SOPC/NIOS configuration. -- Bas
> /cygdrive/c/altera/72/nios2eds/bin/nios2-gnutools/H-i686-pc-cygwin/ > bin/../lib/gcc/nios2-elf/3.4.1/../../../../nios2-elf/bin/ld: region > onchip_mem is full (hello_world_1.elf section .rwdata). Region needs > to be 2676 bytes larger. > /cygdrive/c/altera/72/nios2eds/bin/nios2-gnutools/H-i686-pc-cygwin/ > bin/../lib/gcc/nios2-elf/3.4.1/../../../../nios2-elf/bin/ld: > section .rodata [00002020 -> 00002067] overlaps section .exceptions > [00002020 -> 000021c7] > /cygdrive/c/altera/72/nios2eds/bin/nios2-gnutools/H-i686-pc-cygwin/ > bin/../lib/gcc/nios2-elf/3.4.1/../../../../nios2-elf/bin/ld: > section .rwdata [00002068 -> 00003a73] overlaps section .exceptions > [00002020 -> 000021c7] > /cygdrive/c/altera/72/nios2eds/bin/nios2-gnutools/H-i686-pc-cygwin/ > bin/../lib/gcc/nios2-elf/3.4.1/../../../../nios2-elf/bin/ld: > section .bss [00002020 -> 00002233] overlaps section .exceptions > [00002020 -> 000021c7] > /cygdrive/c/altera/72/nios2eds/bin/nios2-gnutools/H-i686-pc-cygwin/ > bin/../lib/gcc/nios2-elf/3.4.1/../../../../nios2-elf/lib/mhw-mulx/ > mcustom-fpu-cfg=60-1//libc.a(sbrkr.o)(.text+0x14): In function > `_sbrk_r': > /build/nios2eds-gnutools-win32-7.2/bin/nios2-gnutools/src/newlib/ > newlib/libc/reent/sbrkr.c:59: Unable to reach errno (at 0x00002020) > from the global pointer (at 0x0000ba1c) because the offset (-39420) is > out of the allowed range, -32678 to 32767. > > collect2: ld returned 1 exit status > make: *** [hello_world_1.elf] Error 1 > Build completed in 8.297 seconds
Reply by Frank Buss November 13, 20082008-11-13
fl wrote:

> Thanks. I change mode from Debug to Release. Although the memory > requirement is smaller (from 40K to 14K), it still has the same error > message.
The error sounds strange, maybe something with 16/32 bit CPU setting? Nios itself is sometimes strange, too. Do you have changed and recompiled the setting for the library project, too?
> The program is only a simple Hello_world. It should not be so memory > hungry.
If there is a printf, much of the library will be linked. If you have some LEDs for a hello world test, it could be much smaller. If it doesn't work, Altera has a very good support. Once I needed help with creating some special programming files and scripts for programming a flash behind a FPGA and they helped to solve the problem. Maybe this is one of the advantages of paying such high prices for the subscription (but there is good support for the web edition, too). -- Frank Buss, fb@frank-buss.de http://www.frank-buss.de, http://www.it4-systems.de
Reply by fl November 13, 20082008-11-13
On Nov 13, 2:01=A0pm, Frank Buss <f...@frank-buss.de> wrote:
> fl wrote: > > Hi, > > I am trying to use Nios II with one Stratix II (2S60) DSP board, not > > the Nios board. Even to use Nios /f in the simplest hello example, the > > following error message is still there. What is the problem? Thanks > > all. BTW, Using Quartus 7.2 subscription. > > > **** Build of configuration Debug for project hello_world_1 **** > > Try release mode. You can switch this somewhere in the project settings i=
n
> Eclipse ("Properties" right-click menu item on the project). > > -- > Frank Buss, f...@frank-buss.dehttp://www.frank-buss.de,http://www.it4-sys=
tems.de Thanks. I change mode from Debug to Release. Although the memory requirement is smaller (from 40K to 14K), it still has the same error message. The program is only a simple Hello_world. It should not be so memory hungry. Thanks, **** Build of configuration Release for project hello_world_1 **** make -s all includes Compiling hello_world.c... Linking hello_world_1.elf... /cygdrive/c/altera/72/nios2eds/bin/nios2-gnutools/H-i686-pc-cygwin/ bin/../lib/gcc/nios2-elf/3.4.1/../../../../nios2-elf/bin/ld: region onchip_mem is full (hello_world_1.elf section .text). Region needs to be 14136 bytes larger. /cygdrive/c/altera/72/nios2eds/bin/nios2-gnutools/H-i686-pc-cygwin/ bin/../lib/gcc/nios2-elf/3.4.1/../../../../nios2-elf/bin/ld: region onchip_mem is full (hello_world_1.elf section .rwdata). Region needs to be 2676 bytes larger. /cygdrive/c/altera/72/nios2eds/bin/nios2-gnutools/H-i686-pc-cygwin/ bin/../lib/gcc/nios2-elf/3.4.1/../../../../nios2-elf/bin/ld: section .rodata [00002020 -> 00002067] overlaps section .exceptions [00002020 -> 000021c7] /cygdrive/c/altera/72/nios2eds/bin/nios2-gnutools/H-i686-pc-cygwin/ bin/../lib/gcc/nios2-elf/3.4.1/../../../../nios2-elf/bin/ld: section .rwdata [00002068 -> 00003a73] overlaps section .exceptions [00002020 -> 000021c7] /cygdrive/c/altera/72/nios2eds/bin/nios2-gnutools/H-i686-pc-cygwin/ bin/../lib/gcc/nios2-elf/3.4.1/../../../../nios2-elf/bin/ld: section .bss [00002020 -> 00002233] overlaps section .exceptions [00002020 -> 000021c7] /cygdrive/c/altera/72/nios2eds/bin/nios2-gnutools/H-i686-pc-cygwin/ bin/../lib/gcc/nios2-elf/3.4.1/../../../../nios2-elf/lib/mhw-mulx/ mcustom-fpu-cfg=3D60-1//libc.a(sbrkr.o)(.text+0x14): In function `_sbrk_r': /build/nios2eds-gnutools-win32-7.2/bin/nios2-gnutools/src/newlib/ newlib/libc/reent/sbrkr.c:59: Unable to reach errno (at 0x00002020) from the global pointer (at 0x0000ba1c) because the offset (-39420) is out of the allowed range, -32678 to 32767. collect2: ld returned 1 exit status make: *** [hello_world_1.elf] Error 1 Build completed in 8.297 seconds
Reply by Frank Buss November 13, 20082008-11-13
fl wrote:

> Hi, > I am trying to use Nios II with one Stratix II (2S60) DSP board, not > the Nios board. Even to use Nios /f in the simplest hello example, the > following error message is still there. What is the problem? Thanks > all. BTW, Using Quartus 7.2 subscription. > > > > > > > **** Build of configuration Debug for project hello_world_1 ****
Try release mode. You can switch this somewhere in the project settings in Eclipse ("Properties" right-click menu item on the project). -- Frank Buss, fb@frank-buss.de http://www.frank-buss.de, http://www.it4-systems.de
Reply by fl November 13, 20082008-11-13
On Nov 13, 10:40=A0am, fl <rxjw...@gmail.com> wrote:
> Hi, > I am trying to use Nios II with one Stratix II (2S60) DSP board, not > the Nios board. Even to use Nios /f in the simplest hello example, the > following error message is still there. What is the problem? Thanks > all. BTW, Using Quartus 7.2 subscription. > > **** Build of configuration Debug for project hello_world_1 **** > > make -s all includes > Linking hello_world_1.elf... > /cygdrive/c/altera/72/nios2eds/bin/nios2-gnutools/H-i686-pc-cygwin/ > bin/../lib/gcc/nios2-elf/3.4.1/../../../../nios2-elf/bin/ld: region > onchip_mem is full (hello_world_1.elf section .text). Region needs to > be 41976 bytes larger. > /cygdrive/c/altera/72/nios2eds/bin/nios2-gnutools/H-i686-pc-cygwin/ > bin/../lib/gcc/nios2-elf/3.4.1/../../../../nios2-elf/bin/ld: region > onchip_mem is full (hello_world_1.elf section .rwdata). Region needs > to be 3884 bytes larger. > /cygdrive/c/altera/72/nios2eds/bin/nios2-gnutools/H-i686-pc-cygwin/ > bin/../lib/gcc/nios2-elf/3.4.1/../../../../nios2-elf/bin/ld: > section .rodata [00002020 -> 000024ff] overlaps section .exceptions > [00002020 -> 000021c7] > /cygdrive/c/altera/72/nios2eds/bin/nios2-gnutools/H-i686-pc-cygwin/ > bin/../lib/gcc/nios2-elf/3.4.1/../../../../nios2-elf/bin/ld: > section .rwdata [00002500 -> 00003f2b] overlaps section .text > [000021c8 -> 0000d3f7] > /cygdrive/c/altera/72/nios2eds/bin/nios2-gnutools/H-i686-pc-cygwin/ > bin/../lib/gcc/nios2-elf/3.4.1/../../../../nios2-elf/bin/ld: > section .bss [00002020 -> 00002233] overlaps section .exceptions > [00002020 -> 000021c7] > /cygdrive/c/altera/72/nios2eds/bin/nios2-gnutools/H-i686-pc-cygwin/ > bin/../lib/gcc/nios2-elf/3.4.1/../../../../nios2-elf/lib/mhw-mulx/ > mcustom-fpu-cfg=3D60-1//libc.a(sbrkr.o)(.text+0x14): In function > `_sbrk_r': > /build/nios2eds-gnutools-win32-7.2/bin/nios2-gnutools/src/newlib/ > newlib/libc/reent/sbrkr.c:59: Unable to reach errno (at 0x00002020) > from the global pointer (at 0x0000bec0) because the offset (-40608) is > out of the allowed range, -32678 to 32767. > > collect2: ld returned 1 exit status > make: *** [hello_world_1.elf] Error 1 > Build completed in 6.519 seconds
I have increased instruction and data on chip memory to 64K. It is larger than the claimed 40K. Could you help me? Thanks.
Reply by fl November 13, 20082008-11-13
Hi,
I am trying to use Nios II with one Stratix II (2S60) DSP board, not
the Nios board. Even to use Nios /f in the simplest hello example, the
following error message is still there. What is the problem? Thanks
all. BTW, Using Quartus 7.2 subscription.






**** Build of configuration Debug for project hello_world_1 ****

make -s all includes
Linking hello_world_1.elf...
/cygdrive/c/altera/72/nios2eds/bin/nios2-gnutools/H-i686-pc-cygwin/
bin/../lib/gcc/nios2-elf/3.4.1/../../../../nios2-elf/bin/ld: region
onchip_mem is full (hello_world_1.elf section .text). Region needs to
be 41976 bytes larger.
/cygdrive/c/altera/72/nios2eds/bin/nios2-gnutools/H-i686-pc-cygwin/
bin/../lib/gcc/nios2-elf/3.4.1/../../../../nios2-elf/bin/ld: region
onchip_mem is full (hello_world_1.elf section .rwdata). Region needs
to be 3884 bytes larger.
/cygdrive/c/altera/72/nios2eds/bin/nios2-gnutools/H-i686-pc-cygwin/
bin/../lib/gcc/nios2-elf/3.4.1/../../../../nios2-elf/bin/ld:
section .rodata [00002020 -> 000024ff] overlaps section .exceptions
[00002020 -> 000021c7]
/cygdrive/c/altera/72/nios2eds/bin/nios2-gnutools/H-i686-pc-cygwin/
bin/../lib/gcc/nios2-elf/3.4.1/../../../../nios2-elf/bin/ld:
section .rwdata [00002500 -> 00003f2b] overlaps section .text
[000021c8 -> 0000d3f7]
/cygdrive/c/altera/72/nios2eds/bin/nios2-gnutools/H-i686-pc-cygwin/
bin/../lib/gcc/nios2-elf/3.4.1/../../../../nios2-elf/bin/ld:
section .bss [00002020 -> 00002233] overlaps section .exceptions
[00002020 -> 000021c7]
/cygdrive/c/altera/72/nios2eds/bin/nios2-gnutools/H-i686-pc-cygwin/
bin/../lib/gcc/nios2-elf/3.4.1/../../../../nios2-elf/lib/mhw-mulx/
mcustom-fpu-cfg=60-1//libc.a(sbrkr.o)(.text+0x14): In function
`_sbrk_r':
/build/nios2eds-gnutools-win32-7.2/bin/nios2-gnutools/src/newlib/
newlib/libc/reent/sbrkr.c:59: Unable to reach errno (at 0x00002020)
from the global pointer (at 0x0000bec0) because the offset (-40608) is
out of the allowed range, -32678 to 32767.

collect2: ld returned 1 exit status
make: *** [hello_world_1.elf] Error 1
Build completed in 6.519 seconds