Relocation Overflow Error

From Texas Instruments Embedded Processors Wiki

Jump to: navigation, search
Translate this page to   

Contents

Relocation Overflow Error

Sometimes in the development of a C6x DSP based project errors like seen below may crop up.


error: relocation overflow occurred at address 0x12345678 in section
           '.text' of input file 
           '<path to a .obj file>'.  
The 16-bit relocated address 0xFFFF is too large to encode in the 15-bit field. 
You may need to add a mask to the assembly instruction or use other target specific assembly features if you really only need the lowest 15 bits of this symbol. 
Please see the section on Relocation in the Assembly User's Guide.

Why does this happen?

This means that you have run into the reason that near and far variables exist, but to explain fully we must go into some details on how memory accesses happen in the C6x.

Essentially, on the C64x processor, you have 32-bit instructions. Inside the 32-bit instruction, you can only access memory based on the offset of a CPU register. One of the CPU registers is used as the data pointer register for near memory when writing C code. Whenever you access near memory, the CPU will use 15 bits of the 32-bit instruction as the offset from the data pointer register. For this reason, the .bss near data memory section is limited to 2^15 = 32k bytes of memory that can be accessed in a single CPU cycle, since it is always addressable.

However, to get access to the remainder of the memory map, you have far memory as well. Far memory requires that you use an MVKL and MVKH set of instructions to build the absolute 32-bit address of the memory you wish to access. For this reason, all data memory outside of the near memory section will take 3 CPU cycles to access, because the compiler must build the instructions to access the memory.

So what our compiler will do in default is make all global single element variables near variables, and all aggregate array memory far variables. Typically, this will work just fine but in your case this error is saying that some code in your executable is trying to access a variable in a 'near' fashion that is not near enough (i.e. it cannot fit the offset it would need within the 15 bit offset field).

Solutions

If you would like to improve upon this performance, or if you run out of near memory space, as it appears has happened with this error, there are some options available to you.

References

C6000 Memory Models Article

Relocation Overflow Error thread on E2E Forums

TMS320C6000 Optimizing Compiler Guide SPRU187

TMS320C6000 Assembly Language Tools Guide SPRU186

Leave a Comment
Personal tools
Namespaces
Variants
Actions
Navigation
Print/export
Toolbox