Forum Discussion

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

Nios II IDE Linker "Unable to reach ..."

Hi,

I'm using Nios II IDE 8.1. This particular Project is based on the uC-OS simple socket server. I'm not new to using the IDE I've got some pretty cool embedded code running on a Custom CPU board (1Mbyte SSRam) with a Cyclone III.

I added a variable to the main program (iniche_init.c) and then declared it "extern unsigned char mslType" in the enet_server.c file because it's getting updated via enet task. I have other variables declared as "extern" and have had no problem until now.

I did read that I'm out of the 64K and I need to use the -G option (in 6. Developing Programs Using the Hardware Abstraction Layer). But cleaned and tried that and still have the error below. So, reading more I see that I need to change the Board Support Package to match ? I've just used the defaults "altera_components" which I don't want to mess up because I have other projects that are working with that.

i'd sure like to understand this better and know what to do with a little better 'guidance' than going back and forth reading and trying things.

could someone please educate me to save me a little time or "narrow down the reading"

thanks !!

Linking April15_EnetTgtGen_CPU.elf...

obj/enet_server.o(.text+0x664): In function `sss_handle_receive':

../enet_server.c:643: undefined reference to `mslType'

obj/enet_server.o(.text+0x664):../enet_server.c:643: Unable to reach mslType (at 0x00000000) from the global pointer (at 0x0123ff30) because the offset (-19136304) is out of the allowed range, -32678 to 32767.

collect2: ld returned 1 exit status

make: *** [April15_EnetTgtGen_CPU.elf] Error 1

Build completed in 50.937 seconds

--- Quote End ---

4 Replies

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

    Is mslType really located at 0x0 or are you just seeing some sort of uninitialized (NULL) pointer issue?

    Cheers,

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

    you haven't declared the variable anywhere.

    one object file (.c file) needs to drop the 'extern' label.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    O.K. - solved. I had them both "extern" (it's been a long week) but still the issue of changing the BSP is something that interest me to learn about for other project. However, I guess there now Eclipse is the new environment and I need to eventually migrate to that.