What exactly the PC relative addressing in Cortexm4?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

What exactly the PC relative addressing in Cortexm4?

610 Views
Eager0007
Contributor I

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.

0 Kudos
Reply
1 Reply

581 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

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

0 Kudos
Reply