I am trying to read the CP15 coprocessor in the following System on a chip
Cortex A7 - ARMv7-A
Below my snippet
void main (void)
{
unsigned int reg_value = 0;
asm volatile("mrc p15, 0, %0, c0, c0, 0" : "=r"(reg_value) );
printf("reg_value: %d", reg_value);
}
I do not know if this is the correct way to read the coprocessor register, but its compilation completed without errors. The problem occurs during its execution (the code is executed in the root directory):
Illegal instruction
If I use gdb, I get the following result:
0x000086a0 <+16>: str r3, [r11,
=> 0x000086a4 <+20>: mrc 15, 0, r3, cr0, cr0, {0}
0x000086a8 <+24>: str r3, [r11,
Why can't I read the coprocessor registers? What is wrong with my code?
Alvin source
share