Forum Discussion
Linking error in Nios II .elf file
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. Thanks10 Replies
- Altera_Forum
Honored Contributor
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. - Altera_Forum
Honored Contributor
That worked. I had to create a new project with the small lib template, but this work fine. Thanks for your help!
- Altera_Forum
Honored Contributor
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?
- Altera_Forum
Honored Contributor
Everybody does it :-) Feels like taking a trip on a time machine somewhere to 80s, right? :-D
- Altera_Forum
Honored Contributor
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... - Altera_Forum
Honored Contributor
I've found the small C library, but is it included printf function?
Thanks - Altera_Forum
Honored Contributor
Can't you check?
- Altera_Forum
Honored Contributor
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. - Altera_Forum
Honored Contributor
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 - Altera_Forum
Honored Contributor
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