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

Problem building RedBoot

Altera_Forum
Honored Contributor II
952 Views

I just tried making a new eCos RedBoot project (using the redboot template) for my board, without adding any other packages, and it gives me this gem when I try to build the library: 

nios2-elf-gcc -g -nostdlib -Wl,--gc-sections -Wl,-static -mhw-mul -mno-hw-mulx -mno-hw-div -L/cygdrive/c/cygwin/home/desimone/Projects/lmrs/transmitter/wf-gen-ether/software/redboot_install/lib -Ttarget.ld -o /cygdrive/c/cygwin/home/desimone/Projects/lmrs/transmitter/wf-gen-ether/software/redboot_install/bin/redboot.elf /cygdrive/c/cygwin/home/desimone/Projects/lmrs/transmitter/wf-gen-ether/software/redboot_install/lib/version.o make: Leaving directory `/cygdrive/c/cygwin/home/desimone/Projects/lmrs/transmitter/wf-gen-ether/software/redboot_build/redboot/current' /cygdrive/c/cygwin/home/desimone/Projects/lmrs/transmitter/wf-gen-ether/software/redboot_install/lib/libtarget.a(redboot_main.o)(.text.do_idle+0x14): In function `valid_address': make: Leaving directory `/cygdrive/c/cygwin/home/desimone/Projects/lmrs/transmitter/wf-gen-ether/software/redboot_build' /cygdrive/c/altera/kits/nios2/components/ecos/ecos-current/packages/redboot/current/src/main.c:756: Unable to reach __RedBoot_IDLE_TAB_END__ (at 0x08011cac) from the global pointer (at 0x08019cc4) because the offset (-32792) is out of the allowed range, -32678 to 32767. collect2: ld returned 1 exit status make: *** Error 1 make: *** Error 2 

Any ideas?
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
293 Views

To wok around this kind of problem, you can compile your code with the -G0 flag. This disables gp relative addressing and so avoids these kinds of range issues. The down side is that this will cause your code to run slower. 

 

You will find some further discussion of this in the thread "global pointer relative offset" which may help you track down the underlying cause. 

 

I suspect that the problem is that __RedBoot_IDLE_TAB_END__ is being accessed using relative addressing, when it should be accessed using absolute addressing. If you look in the "General Software" section of the Nios forum, you will find a couple of threads: "Disabling GP-addressing in generated source code" and "pointer out of range link error" that discuss how you can disable relative addressing for a specific variable.
0 Kudos
Reply