Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
20 years ago

Problem building RedBoot

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?

1 Reply

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    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.