Hello,
I was porting from the TI compiler to the IAR compiler for TMS570LS20216.
I had a variable in C and wanted to access it from assembly
TI compiler
UInt32 var_pattern;
__asm("VAR_PATTERN_A: .field var_pattern, 32");
void xyz(void)
{
__asm(" LDR R3,VAR_PATTERN_A");
}
IAR Compiler
When i try i am getting the relocation error.
I found the following section in IAR C/C++ Development Guide but i was not able to get much information on solving it.
Possible solutions
In this case, the distance from the instruction in getchar to __read is too long for the
branch instruction.
Possible solutions include ensuring that the two .text sections are allocated closer to
each other or using some other calling mechanism that can reach the required distance.
It is also possible that the referring function tried to refer to the wrong target and that
this caused the range error.
Different range errors have different solutions. Usually, the solution is a variant of the
ones presented above, in other words modifying either the code or the section
placement.
Can you please let me know how i can do the same using the IAR compiler.
With Best Regards,
Renjith George