This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F28386D: Direct addressing

Part Number: TMS320F28386D


Tool/software:

hello guys how are you? after I have migrated a code from COFF to EABI. Parts of the code in .asm do not work for me because the addressing is incorrect. For example for the variable PwmBKB defined as

PwmBKB .usect ".VIpg1",2,1,1. In the case that I want to point to PwmBKB+1, the compiler does not give me errors but the ACC value does not write it to PwmBKB+1 and it does write it to PwmBKB+0

MOVL ACC,XAR6
MOVH @PwmBKB+1,ACC
MOV @PwmBKB+0,ACC

any suggestion?

Thanks. 

  • Hi Marcos, can you check out these resources and see if you are able to resolve the issue?  Otherwise you can reply back and I'll see if I can find a subject matter expert to assist.

    C2000 Migration from COFF to EABI

    In particular C28x Embedded Application Binary Interface Application Report (SPRAC71) has some tips on addressing.

  • Hi Joe, i've risolve this problem using  __attribute__((blocked)) when i defined  the array. I have read TMS320C28x Optimizing C/C++ Compiler v22.6.0.LTS

    3.11 Data Page (DP) Pointer Load Optimization

    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:

                 • Arrays and their sections are not blocked.

                 • Structs with external linkage (extern in C) are blocked.

                 • Structs with internal linkage (static in C) are not blocked, but their sections are blocked.

    thanks for your collaboration

  • Excellent!  Thank you for sharing your solution!