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
  • 16,045
  • 8
  • 30
  • 61
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
  • 208,748
  • 37
  • 389
  • 560