Closed leobbditestcom closed 2 years ago
There is a requirement for incoming packet. The IP header must be aligned to 4 bytes boundary. Could you double check the packet received by driver?
Thank you for your correction! I adjusted the driver packet start address to a longword boundary + 2, and the NetX Duo code works fine with no modifications.
In nx_tcp_socket_packet_process.c, line 117, a cast pointer is used to access longword data. GCC for ARM Cortex M7 assumes that the recast pointer is longword-aligned and generates a four-register
ldm
instruction to start the assignment statement. The pointer, in this case, however, is not longword-aligned, and theldm
instruction traps with an unaligned data fault. The assignment, as written, is not generally safe, given the alignment assumptions. This problem went away when the code was changed to use memcpy(), which does not make alignment assumptions about its arguments: