During the setup of a CAN transmission, a Pointer is being corrupted (it goes from a valid 0x00000bd0 to a 0x84520000 that is out of the bounds of my RAM). The pointer is also unrelated to the CAN activity. The reason for the corruption is, that a union64 is written over the address of the pointer. This union64 belongs to the CANIF object (from ASF), in sourcecode the corruption happens here:
void CAN_SendMsg_KMS(uint64_t msg)
{
CANIF_mob_get_ptr_data(ACTIVECHANNEL,0)->data = (Union64)msg;
AVR32_CANIF.channel[ACTIVECHANNEL].mober = 1<<0;
}
My question is, why is the memory for "data" allocated at the same address as my pointer? Or is this a wrong conclusion?
In the following screenshots, the first is immediately before the function is executed, the last is immediately after execution. The Content of "msg" is 0x8452000000000000. The content of the pointer A that is corrupted should be 0x00000bd0, as it is before the corruption happens. The 32Bit integer after the pointer A is pointer B, pointer B is pointing at pointer A, its uncorrupted content is therefore 0x00000004 (as seen in the screenshot).
I don't know if this is a useful information: According to the Datasheet the CANIF registers are at Memory address 0xFFFD1C00.
update: This is the assembly level code that corrupts the pointer:
//CANIF_mob_get_ptr_data(ACTIVECHANNEL,0)->data = (Union64)msg;
80006AC8 mov R8, -189440
80006ACC ld.w R9, R8[8]
80006ACE st.d R9[8], R5