|ARM Technical Support Knowledge Articles|
Applies to: General Topics
Information in this article applies to:
I have not found a way to set the program counter (PC) to a selected source line in a C (or assembly) file. Is there a way to do this?
In C or assembly, there is no way to directly manipulate the program counter since it is not defined in the SFR space. However, you can use the jump instructions in assembly to change the program to any part of your code memory.
In the debugger, you may set the program counter by assign a new value to $. For example:
$ = 0x1234
sets the program counter to 1234h in the simulator.
To set the program counter to the address of a line of C code, you may use the name of the file and the line number. For example:
$ = main34
sets the program counter to the address of line 34 in the main.c file. Of course, line 34 must have executable code on it.
Article last edited on: 2002-03-20 00:00:00
Did you find this article helpful? Yes No
How can we improve this article?