Intel: Unable to reach ... from the global pointer ... because the offset ... is out of the allowed range, -32678 to 32767

Cyclone Nios II

Category: Nios® II
Tool: Nios® II SBT
Device: Cyclone® 10 LP

This error occurs when building a Nios® II project.

The Global Pointer Register (GP = r26) is a general-purpose register that speeds up access to global variables by pointing to the start address of the .sdata, .sdata2, .sbss, .sbss2 areas during initialization. .
Global variables of 8 bytes or less are stored in the area described in the red frame in the image below for speeding up, and if the capacity exceeds 64KB, this error will occur.

To avoid the error, do one of the following:

● Reduce global variables of 8 bytes or less.
Only registers of 8 bytes or less are stored in .sdata, .sdata2, .sbss, .sbss2, so
The error will be resolved by reducing the number of variables.

or

● Set .BSP Editor > Main tab > Settings > hal > make > cflags_mgpopt > Value = none.
This setting removes the 64KB limit because no allocations are made to GP access targets.

Experienced FAE
Free consultation is available.

From specific product specifications to parts selection, the Company FAE will answer your technical concerns free of charge. Please feel free to contact us.