SPRUI04F july 2015 – april 2023
As of the 5.1.0 version of the compiler tools, if a near or far keyword is not specified for an object, the compiler generates far accesses to aggregate data and near accesses to all other data. This means that structures, unions, C++ classes, and arrays are not accessed through the data-page (DP) pointer.
Non-aggregate data, by default, is placed in the .bss section and is accessed using relative-offset addressing from the data page pointer (DP, which is B14). DP points to the beginning of the .bss section. Accessing data via the data page pointer is generally faster and uses fewer instructions than the mechanism used for far data accesses.
If you want to use near accesses to aggregate data, you must specify the --mem_model:data=near option, or declare your data with the near keyword.
If you have too much static and extern data to fit within a 15-bit scaled offset from the beginning of the .bss section, you cannot use --mem_model:data=near. The linker will issue an error message if there is a DP-relative data access that will not reach.
The --mem_model:data=type option controls how data is accessed:
--mem_model:data=near | Data accesses default to near |
--mem_model:data=far | Data accesses default to far |
--mem_model:data=far_aggregates | Data accesses to aggregate data default to far, data accesses to non-aggregate data default to near. This is the default behavior. |
The --mem_model:data options do not affect the access to objects explicitly declared with the near of far keyword.
By default, all run-time-support data is defined as far.
For more information on near and far accesses to data, see Section 7.5.5.