Visible to Intel only — GUID: qnj1642670556641
Ixiasoft
Visible to Intel only — GUID: qnj1642670556641
Ixiasoft
6.13.4. Global Pointer Register
The global pointer register can access a single contiguous region of 64 KB. To avoid overflowing this region, the compiler only uses the global pointer with small global data structures. A data structure is considered “small” if its size is less than or equal to a specified threshold. By default, this threshold is 8 bytes.
The small data structures are allocated to the small global data sections, .sdata, .sdata2, .sbss, and .sbss2. The small global data sections are subsections of the .rwdata and .bss sections.
If the total size of the small global data structures is more than 8 KB, these data structures overflow the global pointer region. The linker produces an error message saying "Unable to reach <variable name> ... from the global pointer ... because the offset ... is out of the allowed range, -4096 to 4095."
The best solution is to use fewer global variables of size 8 bytes or less. Another solution is to place only the frequently used global variables inside the .sdata + .sbss.
When the size of the global variable is greater than 8 bytes, by default, it gets placed outside of the .sdata + .sbss, and takes longer to access it. You can improve space-time performance by placing only the frequently used global variables inside the .sdata + .sbss leaving space available to add global variables greater than 8 bytes; and by annotating the code to place these global variables inside the .sdata + .sbss.
Annotating the code is show in Advanced Placement Options.
For information about manipulating project settings, refer to HAL BSP Settings.