I want from my C code to read value of PC, an for that I want write inline __asm function. I wrote this
int Get_Add(void)
{
int Add;
__asm { mov Add, PC}
return Adresa;
}
But I got error message "Glavni.c(22): error: #20: identifier "PC" is undefined"
Could anybody help me, do I need to include some library?
The armcc inline assembler works with variables, rather than registers. So it's treating "PC" as being a variable name, which your example is undeclared.
With armcc, probably the simplest way to get the PC is to use the __current_pc() intrinsic.
ARM Compiler toolchain Compiler Reference: __current_pc intrinsic