This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Is it mistake to force PC to specific address?

I want to make mechanism to force my processor (LPC2378) to do one program if some flag is set and to do another if that flag isn't set.
But that two programs may have functions with same name and I want to insure that right one will be executed.

Parents
  • The particular error you were getting I think is because you needed an "=" (LDR pc, =0x6000).  Also it would complain about the PC being the destination (in Thumb)  for earlier versions of the architecture.

    That said, I'd go with Scott's suggestion - use a function pointer.

    One thing to be wary of, if you perform an absolute branch the bottom bit of the address will be used to determine whether the branch target is ARM or Thumb (*).  So an absolute branch to 0x6000 arrives in ARM state, while an absolute branch to 0x6001 arrives in Thumb state. 

    (* I'm assuming ARMv7)

Reply
  • The particular error you were getting I think is because you needed an "=" (LDR pc, =0x6000).  Also it would complain about the PC being the destination (in Thumb)  for earlier versions of the architecture.

    That said, I'd go with Scott's suggestion - use a function pointer.

    One thing to be wary of, if you perform an absolute branch the bottom bit of the address will be used to determine whether the branch target is ARM or Thumb (*).  So an absolute branch to 0x6000 arrives in ARM state, while an absolute branch to 0x6001 arrives in Thumb state. 

    (* I'm assuming ARMv7)

Children
No data