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++
12600 Discussions

Linking error in Nios II .elf file

Altera_Forum
Honored Contributor II
4,921 Views

Hi, 

 

The following errors occur when i try to build a simple "hello world" application. 

 

c:/altera/11.0/nios2eds/bin/gnu/h-i686-mingw32/bin/../lib/gcc/nios2-elf/4.1.2/../../../../nios2-elf/bin/ld.exe: Hello_world_0.elf section `.text' will not fit in region `onchip_memory2' 

 

c:/altera/11.0/nios2eds/bin/gnu/h-i686-mingw32/bin/../lib/gcc/nios2-elf/4.1.2/../../../../nios2-elf/bin/ld.exe: address 0x46f4c of Hello_world_0.elf section `.rwdata' is not within region `onchip_memory2' 

 

c:/altera/11.0/nios2eds/bin/gnu/h-i686-mingw32/bin/../lib/gcc/nios2-elf/4.1.2/../../../../nios2-elf/bin/ld.exe: address 0x48c74 of Hello_world_0.elf section `.bss' is not within region `onchip_memory2' 

 

c:/altera/11.0/nios2eds/bin/gnu/h-i686-mingw32/bin/../lib/gcc/nios2-elf/4.1.2/../../../../nios2-elf/bin/ld.exe: address 0x48c74 of Hello_world_0.elf section `.onchip_memory2' is not within region `onchip_memory2' 

 

c:/altera/11.0/nios2eds/bin/gnu/h-i686-mingw32/bin/../lib/gcc/nios2-elf/4.1.2/../../../../nios2-elf/bin/ld.exe: address 0x46f4c of Hello_world_0.elf section `.rwdata' is not within region `onchip_memory2' 

 

c:/altera/11.0/nios2eds/bin/gnu/h-i686-mingw32/bin/../lib/gcc/nios2-elf/4.1.2/../../../../nios2-elf/bin/ld.exe: address 0x48c74 of Hello_world_0.elf section `.bss' is not within region `onchip_memory2' 

 

c:/altera/11.0/nios2eds/bin/gnu/h-i686-mingw32/bin/../lib/gcc/nios2-elf/4.1.2/../../../../nios2-elf/bin/ld.exe: address 0x48c74 of Hello_world_0.elf section `.onchip_memory2' is not within region `onchip_memory2' 

 

c:/altera/11.0/nios2eds/bin/gnu/h-i686-mingw32/bin/../lib/gcc/nios2-elf/4.1.2/../../../../nios2-elf/bin/ld.exe: region `onchip_memory2' overflowed by 31860 bytes 

 

Any help would be greatly appreciated.  

 

Thanks
0 Kudos
10 Replies
Altera_Forum
Honored Contributor II
1,376 Views

The 'hello world' example pulls in a lot of libc - IIRC it is about 70k code - probably larger than your internal memory. 

 

You need to select the small libc.
0 Kudos
Altera_Forum
Honored Contributor II
1,376 Views

That worked. I had to create a new project with the small lib template, but this work fine. Thanks for your help!

0 Kudos
Altera_Forum
Honored Contributor II
1,376 Views

This is incredible, I made the shortest program I've ever made and received this error with a 20kbyte memory. I had to switch to Small C Library too (BSP properties). Is there any documentation about the implications of this option?

0 Kudos
Altera_Forum
Honored Contributor II
1,375 Views

Everybody does it :-) Feels like taking a trip on a time machine somewhere to 80s, right? :-D

0 Kudos
Altera_Forum
Honored Contributor II
1,375 Views

Hi All 

I've the same issue.... :-( But I'm not able to create a small C library, could you please explain to me where can i find this option? 

 

Is it also possible to load all into DDR ram? 

I'm at 87.9 mph but I can't go haed...
0 Kudos
Altera_Forum
Honored Contributor II
1,376 Views

I've found the small C library, but is it included printf function? 

Thanks
0 Kudos
Altera_Forum
Honored Contributor II
1,376 Views

Can't you check?

0 Kudos
Altera_Forum
Honored Contributor II
1,376 Views

printf() is excluded from the small C library because it pulls in quite a lot of dependand code (basically all the stdio code and malloc/free). 

It is possible to write a standalone snprintf() that is under 1800 bytes (without long long or FP support) - does need __udivsi3 though. 

 

IIRC the small C library does contains some functions to print strings.
0 Kudos
Altera_Forum
Honored Contributor II
1,376 Views

Really thanks 

 

very good information, but I can't find documentation related to IIRC, could you please help me. I would like to study something useful... 

Thanks
0 Kudos
Altera_Forum
Honored Contributor II
1,376 Views

Hi All 

 

Now I can see on my LCD many strange characters only on the first row. I've performed the basic procedure for clear start from position 0 and print same characters. But the result is completely different from desired, Very strange characters are shown by first row,nothing on the second row. 

Coud someone help me? 

How is it possible? 

where can i study something? 

Thanks
0 Kudos
Reply