Using the GNU Tools, i can output the value of PC (R15) using the following code: //Declaring Variable register unsigned int R15 asm ("pc"); //Outputing the value printf("The Current location of the Program Counter is : 0x%08X\n","PC"); When I change to using Keil Tools however, this no longer works, I get errors with the variable definition. Does anyone know how I can make this work using the Keil compiler Tools?
PC is the variable corresponding to the Program Counter, it holds the current location in memory that the code is executing from. The overall program works fine in GUN, its just when i switch to the Keil compiler, i cant access this register to output it
*GNU, not GUN, sorry
I'm unclear if you are able to compile the program or not, if you are can you show the exact output you are getting from this line under Keil: printf("The Current location of the Program Counter is : 0x%08X\n","PC");