1

Is there any trick to write a function for ARM Cortex M series ICs that returns the PC value before function calling. Without using assembly language.

LPs
  • 15,592
  • 8
  • 28
  • 58
rahul_T_T
  • 133
  • 9

1 Answers1

2

You can use the __current_pc intrinsic, e.g.

int main()
{
    printf("Current PC = %u\n", __current_pc());
    return 0;
}
Paul R
  • 202,568
  • 34
  • 375
  • 539