memory problem on WM6 - Michael Salamone |
06-May-08 09:31:32
|
Because it's unaligned access. You need to have 4-byte aligned addresses
for int operation or ARM CPU coughs.
http://www.arm.com/support/faqdev/1469.html
You can either use aligned address (recommended) or you can use unaligned
access, but that generates additional instructions (which may or may not be
of concern to you depending if overhead is a concern for this bit of code).
Look up UNALIGNED macro.
--
Michael Salamone, eMVP
Entrek Software, Inc.
www.entrek.com |
 |
| |
memory problem on WM6 - ted |
06-May-08 12:17:18
|
Michael Salamone napsal(a):
Thanks a lot!! I have not know that so far. |
 |
| |
memory problem on WM6 - ted |
07-May-08 10:11:19
|
ted napsal(a):
but... __packed is not defined in VC++ |
 |
| |
memory problem on WM6 - Rick C |
08-May-08 10:36:14
|
I haven't done a lot with making sure about alignments, but I suspect your
problem is with this line:
unsigned char *p_mem = (unsigned char *)&mem[9];
10 bytes into an array of char isn't 4-byte alignment. If you can change
p_mem to point to &mem[8] (for example) I think that should get rid of the
problem. |
 |
| |
memory problem on WM6 - Michael Salamone |
08-May-08 10:52:32
|
Not "__packed". "UNALIGNED". That expands to "__unaligned".
So your struct def would be:
typedef struct
{
UNALIGNED unsigned int item1;
UNALIGNED unsigned int item2;
} ITEM;
--
Michael Salamone, eMVP
Entrek Software, Inc.
www.entrek.com |
 |
| |