I’ve run into a strange problem with FreeRTOS+TCP on a Nucleo STM32H755 board. When I run in the debugger, the network stack crashes at the first received packet. Digging further, it’s the memcpy call near the end of FreeRTOS_MatchingEndpoint(), which copies the six-byte destination MAC address into another variable before calling pxEasyFit(). I haven’t added any fancy fault-handling code, but the basic fault registers are saying it’s an unaligned access fault.
Inspecting the data structures prior to the memcpy call, everything looks good to me, although the destination address is indeed unaligned: It is trying to copy six bytes from 0x2402bfa8 (divisible by 8) to 0x300000ca (divisible by 2).
One thing I don’t understand (of many
) is that the same code runs successfully without crashing when the debugger is not attached. I am running a modified TCP echo server test, and I can ping the board successfully. The echo is not yet working, for reasons which may or may not be related to the above…
Can anyone confirm that the memcpy in question is supposed to be unaligned, and is supposed to work anyway? Or, confirm that it should be aligned and that’s where I should be looking.
I have my network buffers in SRAM1 (128k region starting at 0x30000000) and I believe the MPU is correctly configured. Although for some reason MPU_RBAR reads as 0 in the debugger… it’s unclear to me from the ARMv7-M architecture reference if that is expected behavior or not. (The other MPU registers are reading back as expected.)
FreeRTOS is otherwise working fine, e.g. I have three low-priority tasks blinking separate LEDs. No other interrupt activity on the system yet, and no ST HAL stuff apart from the Ethernet driver in portable/NetworkInterface/STM32/Drivers/H7. I am using BufferAllocation_1.c.