Altera_Forum
Honored Contributor
14 years agoglobal pointer problem
Hi guys,
I am building a system with a NIOS2 core, a 128k on-chip ram, and a 128 SDRAM on DE2-115. Because I only want to use the SDRAM to be a storage space, I assigned .heap, .rodata, .rwdata, .stack and .text into the on-chip ram, and only assigned .bss to the sdram using the BSP editor. Then when I compiled the code, it complained: "warning: Unable to reach (null) (at 0x08000000) from the global pointer (at 0x07fec48c) because the offset (80756) is out of the allowed range, -32678 to 32767." The address assignments are: sdram: 0x08000000 - 0x0fffffff on-chip mem: 0x07fe0000 - 0x07ff3ff cpu: 0x10040800 - 0x10040fff jtag: 0x10041000 - 0x10041007 I found that if I put everything (.text, .rwdata etc.) into the SDRAM, then the program could compile. But this is against my goal to use SDRAM as a storage space only. I also found in the altera material that -G option may be used to disable the global pointer, but: 1.I don't know if it is the right way to do, or any side effect 2. I don't know how to apply this option, because I am only familiar with SBT infterface, not the command line tool...