Part Number: TMS320F28335
Tool/software: Code Composer Studio
Hi,
It is possible to load the value of the program counter (PC) using some instruction in C language?
Thanks!
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Part Number: TMS320F28335
Tool/software: Code Composer Studio
Hi,
It is possible to load the value of the program counter (PC) using some instruction in C language?
Thanks!
Jorge,
This can be done using assembly function. I'm looking into this and will get back to you.
Here's an example to refer until I get back to you:
https://e2e.ti.com/support/microcontrollers/c2000/f/171/t/693819?CCS-TMS320F280049-How-to-read-RPC-
Regards,
Ozino
Jorge,
Here is how you get the PC value:
1. You can write an assembly file like the one attached. getRPC.asm
2. Extern and call the function in your C code similar to this:
extern uint32_t getRPC(void);
volatile uint32_t lVar;
main(){
...
lVar = getRPC();
...
}
What these steps do is to return the physical address of the first assembly instruction after the PC returns from the function. You can verify the returned balue against the informaiton provided in the disassembly window.
Let me know if you have anymore questions.
Regards,
Ozino