Hi,
I'm working with a TMS570LS3137 with the TI ARM Compiler v5.1.1.
When turning on the optimization flags "-o=4" and "-mf=5" at the same time,
the compiler generates assembly instructions that use Immediate Addressing relative to
a base register to access system registers.
For example when I try to write a value to systemREG1->PLLCTL1, the compiler generates:
0000536c: E307C700 MOVW R12, #30464
00005370: E342C005 MOVT R12, #8197
00005374: E584CF8B STR R12, [R4, #3979]
The value of R12 is irrelevant in this case.
The address of PLLCTL1 is 0xFFFF'FF70,
so the value in R4, which is used as the base register should be 0xFFFF'EFE5 (0xFFFF'EFE5+3979 = 0xFFFF'FF70) to get the correct result.
However, R4 is not loaded with that value automatically, but is left unchanged at the value it was initialized with in the startup code (in this case 0).
My question is:
Why is the compiler not generating an instruction to set up the base register correctly?
Is there a special mechanism needed to load R4 with the correct value?
Any help would be greatly appreciated.
Thanks very much,
Johannes
↧
Forum Post: ARM Compiler and Immediate Adressing Mode instructions: incorrect base register value
↧