On this manual page: http://www.keil.com/support/man/docs/rlarm/rlarm_interrupt_ethernet.htm
frame = alloc_mem (RxLen | 0x80000000); /* if 'alloc_mem()' has failed, ignore this packet. */ if (frame != NULL) { dp = (U32 *)&frame->data[0]; sp = (U32 *)Rx_Desc[idx].Packet; for (RxLen = (RxLen + 3) >> 2; RxLen; RxLen--) { *dp++ = *sp++; }
Shouldn't the size of the allocated memory be RxLen + 4 because the type of the data pointed to is
RxLen + 4
typedef struct os_frame U16 length; U16 index; U8 data[1];} OS_FRAME;
typedef struct os_frame
U16 length;
U16 index;
U8 data[1];
} OS_FRAME;
and dp points to the member data, which is 4 bytes after the beginning of the struct?
dp
data