Error When Compiler Optimizations are on

57 views Asked by At

Following is a code I wrote for debugging an arm bare-metal application.

#define OCM2_START  (0xffff0000)
#define AAC_QUE_SIZ  50
#define UINT_OFFSET      (sizeof(unsigned int))
#define INT_OFFSET   (sizeof(int            ))

print("here...... 1\r\n");

volatile long long *pktpts =((volatile long long *)    (OCM2_START + UINT_OFFSET * (AAC_QUE_SIZ + 3) + INT_OFFSET * 4));
volatile unsigned int* t1 = ((volatile unsigned int *) (OCM2_START + UINT_OFFSET * (AAC_QUE_SIZ + 3) + INT_OFFSET * 4));

*t1 = 10;
print("here ----\r\n");
*pktpts = pts;
print("here 555\r\n");

When I compile the code with optimization on and run, when assigning to "pktpts" pointer it throws an exception. But that does not happen when i compiled the code without optimizations.

What I do is store a certain long long value in that memory location and read it using another processor core.

Can anyone tell me why it is happening here? I am using Xilinx SDK 2014.2

Thank you.

0

There are 0 answers