I have been working on LPC54608 controller which is powered by cortexm4.When i went into assembly language code , i noticed frequent usage of PC relative addressing for accessing global variables. I am confused why pc relative addressing when processor is able to handle 32bit data and addresses?
Can some one give me a clarity for this?
Thanks in advance.
Hi @Eager0007
Cortex M4 core can handle 32bit data and addresses.
But assembly code uses PC relative addressing, since PC relative addressing is more flexible, it relies on the current PC pointer address and doesn't need to modify absolut addresses in code.
Besides, PC relative addressing shortens the instructions, reduces the code space and enhances the efficiency.
Hope this helps,
Jun Zhang