SPRU514Z July 2001 – October 2023 SM320F28335-EP
When accessing a global variable by name, the compiler uses direct addressing. The C28x supports direct addressing through the data page pointer register, DP. The DP register points to the beginning of a page, which is 64 words long.
To avoid loading the DP for every direct access, the compiler "blocks" some data and sections. Blocking ensures an object is either entirely contained within a single page or is aligned to a 64-word page boundary. Such data page blocking allows the compiler to use the direct addressing mode more often. As a result, it minimizes the need for DP load instructions when accessing global variables known to be stored on a single data page.
For the COFF ABI, all non-const data is blocked.
For EABI, the default blocking rules are:
However, data page blocking can result in alignment holes in memory due to aligning data to page boundaries. So, there is a tradeoff between your application's need for code size and speed optimization and its need for data size optimization. You can use the blocked and noblocked data attributes to control blocking on specific variables. See Section 6.15.4 for details.
Another technique for managing how global variables are organized in memory include grouping global variables that should be stored together in a structure. The DATA_SECTION (Section 6.9.6) and SET_DATA_SECTION (Section 6.9.23) pragmas can also be used to manage data pages.
For examples of C28x data page blocking, see the Data blocking in the C2000 MCU compiler explained topic on the E2E Community.