AnsweredAssumed Answered

UserExceptionHandler called when writing to memory block

Question asked by MattZ on Apr 27, 2011
Latest reply on Apr 28, 2011 by MattZ

Hi All,

 

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[1])               = (T_UINT32)0xAAAABBBB;

 

In this example, MyMemBlock was declared as:

T_UINT16 MyMemBlock[50];

 

I would expect that the value 0xBBBB be copied to MyMemBlock[1] and 0xAAAA be copied to MyMemBlock[2].

 

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[1]. However, UserExceptionHandler keeps getting called in the final assembly operation [ P0 ] = R1 ;

 

I've also noticed that *((T_UINT32*)&MyMemBlock[2])      = (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[1] is not on a 32bit boundary inside MyMemBlock but MyMemBlock[2] is. Would this be the problem? Is this documented anywhere?

 

thanks in advance

-Matt

Outcomes