I have a linker label of a group created with the LOAD_START() operator - LOAD_START(app_vtable_start). It happens to point to the beginning of my Cortex-M3 vector table.
What is the proper way to reference this in C/C++?
I have tried a few ways, but I keep getting too many de-references in the code that uses it, generating a fault. I think I am not getting my de-references correct in C++.
Here is the latest iteration of how I am trying to do it (I have tried many unsuccessful ways):
extern unsigned long const * const ap_vtable_start;
if( (*app_vtable_start == 0xffffffffuL) )
{
// Do something
}
Here is the resulting assembly code:
LDR R0, $C$CON1 - loads R0 with 0x00002000, which is the address of the vector table.
LDR R0, [R0] - loads R0 with 0x20018000 which is the top of the stack.
LDR R1, [R0] - attempts to load R1 from 0x20018000 which is beyond RAM and hence generates a fault.
CMP.W R1, #4294967295 - the compare that would happen if it would get here.
What am I doing wrong?