We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I'm looking for a way to get the current program counter.
I adapted the function __get_PSP() from core_cmFunc.h in the following way:
__STATIC_INLINE uint32_t __get_PC(void) { register uint32_t __regPC __ASM("pc"); return(__regPC); }
this compiles fine but it results in the following code:
;;;278 RES_RestartPC(0x10, __get_PC()); 000022 bf00 NOP 000024 bf00 NOP 000026 4683 MOV r11,r0 000028 4659 MOV r1,r11 00002a 2010 MOVS r0,#0x10 00002c f7fffffe BL RES_RestartPC
Does someboby known a solution to get the current program counter?
Thanks Reto Felix
"Does someboby known a solution to get the current program counter?"
Maybe you should start your post with something very much more relevant: Telling us why you think you have a need to get the current program counter...
If it's hard to get the PC from a high-level language, it's because a normal program doesn't have a need to get the value of the PC.