What exactly the PC relative addressing in Cortexm4?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

What exactly the PC relative addressing in Cortexm4?

594 次查看
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 项奖励
回复
1 回复

565 次查看
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 项奖励
回复