In startup code the first instruction is:
and at offset address 0x20:
What I don't understand here is, after the first instruction shown
above how come PC holds 0x20 and not 0x18??
Isn't PC supposed to be pointing to the current instruction being
executed? If that's the case after the above step shouldn't PC be
(0x00 + #24)= (0x00 + 0x18) = 0x18 ??
Isn't PC supposed to be pointing to the current instruction
No. PC is always 8 bytes ahead!
the reason for this is the processor's pipeline. check you
PC is always 8 bytes ahead!
You mean PC points to the (next) instruction to be fetched and not
the current instruction being executed. This is what even I have
I tried to make sense of it:
to Execute-----0-----ldr pc, [pc,#24]
So PC here (in the ldr instruction) is 0x0000 0008
(Again, if it were THUMB mode then PC would be 0x0000 0004)
Hence, PC + #24 = PC + 0x18 = 0x08 + 0x18 = 0x20
Thanks for your support :)
View all questions in Keil forum