I came across a problem when trying to assign a 32 bit value to two sequential 16 bit memory blocks. I'm using a BF537 and used the code:
*((T_UINT32*)&MyMemBlock) = (T_UINT32)0xAAAABBBB;
In this example, MyMemBlock was declared as:
I would expect that the value 0xBBBB be copied to MyMemBlock and 0xAAAA be copied to MyMemBlock.
The disassebmly viewer shows the following:
P0.L = 0x1cde ;
P0.H = 0xff90 ;
R1 = -17477 ( X ) ;
R1.H = -21846 ;
[ P0 ] = R1 ;
I think this make sense. 0xff9001cde is the correct address for MyMemBlock. However, UserExceptionHandler keeps getting called in the final assembly operation [ P0 ] = R1 ;
I've also noticed that *((T_UINT32*)&MyMemBlock) = (T_UINT32)0xAAAABBBB; works. <--note the 2 index in MeMemBlock.
Does anyone have any ideas how I can debug this? One thought I had is that MyMemBlock is not on a 32bit boundary inside MyMemBlock but MyMemBlock is. Would this be the problem? Is this documented anywhere?
thanks in advance