Hi, a simple beginner answer.
When I allocate memory like this :
#pragma align 4
I have exception 0x24 : Data access misaligned address violation
Have you an idea why? Thanks
Must I substitute all the "new" by a "heap_malloc" ?
I am not sure if you have resolved this yet. Basically you will get this exception when the data alignment is not correct.
- 32-bit word load/stores are accessed on four-byte boundaries, meaning the two least significant bits of the address are b#00. - 16-bit word load/stores are accessed on two-byte boundaries, meaning the least significant bit of the address must be b#0.
The new() inturn calls the malloc(), and for malloc(), the memory allocated is aligned to an 8-byte boundary. 64-bit (8*8) boundary coverage should include the above cases also (32 bit and 16 bit boundaries). When the first data in the array is aligned to a boundary, it advances to other data items consequently. So if you have aligned to 32-bit/64-bit, and if you access data as 4-byte (integer), then you should not get the alignment exception.
RETX register content will tell the address of the excepting data-memory location.
How are you using anArray? What is the value of anArray after you execute this peice of code?
Retrieving data ...