This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

ARM M0 pointer access failed (not related with alignment problem)

HI,

I's that anyone know this problem.
We through a function, search a entry and access the global pointer value to an empty pointer.
But we realize that when the empty pointer go in the call function, the memory was change, it was shift 8 bytes, it's look like compiler problem.

(1). allocate a empty memory "*TablePtr".
(2). before go in the function "test_get_entry_pointer", the memory value 1 "(void*)&TablePtr" is 0x20001EE4.
(3). after go in the function, we realize the memory value 2 (same memory) "**Entry_Ptr" is different, the value was change to 0x20001EEC.
(4). therefore the "GolbelValueTable" pointer value was access in the wrong memory (0x20001EEC).

Thanks.

{
TABLE_ENTRY *TablePtr;

/* execute function which happen pointer access wrong*/
Found = test_get_entry_pointer((void*)&TablePtr /*memory value 1*/, refID);
}

/* function call */
BOOL test_get_entry_pointer(void **Entry_Ptr /*memory value 2*/, UINT8 SearchID)
{ for(i=0; i<TABLE_SIZE; i++){
if(GlobalValueTable[i].ID == SerachID)
{ Entry_Ptr = GolbelValueTable + i;

return TRUE;
} else
{ return FALSE;
} }
}

0