__asm { ldr pc,=addr }
or
__asm { "ldr pc,=addr" }
getting compilation error, pc replaced with r15 but not getting compiled any suggestions/references
I have to update PC in C source code.
I very much doubt that is actually the case. As the saying goes: if you think that is the answer, you must be asking all the wrong questions.
>>Thats why specific in updating either directly in PC or R15
And your experience with BX and BLX is that it doesn't change PC/R15? You could also use a function pointer to jump to arbitrary code or functions.
The documentation I cited specifically states LDR can't use PC as a destination. The M3/M4 behave the same in this regard as do Cortex cores in TI or ST part.
Hi, Thanks for the quick response. While using function pointer I get Hard Fault Exception with FORCED bit enabled.
>>I get Hard Fault Exception
So is it conceivable that you're not jumping to valid code? As I pointed out in other threads the address must be ODD for 16-bit THUMB code, the Cortex-M will not run 32-bit ARM code.