Tool/software:
Hello,
I'm making use of the LwIP socket library incorporated in the SDK(version 9.01.00.41) to send and receive UDP packets over ethernet. My implementation resembles the netwroking/lwip/enet_cpsw_socket example in the SDK. I am seeing a problem where certain buffer sizes for the data being passed into lwip_write are causing failures in my application.
In the function that is sending packets, I declare static buffer of fixed size, populate it with the data I want to send (ensuring any previous data is cleared beforehand), and then pass a pointer to the buffer and the actual size of the data I've copied in to the lwip_write function. This works normally most of the time. However, I have found that for certain buffer sizes this causes an error. The symptoms of the error are that the other core on the chip crashes. I'm only making use of two cores at the moment, and it's the one that is not involved in ethernet that crashes. Also, the UART stops printing log statements. Everything else seems to work normally. I have also noted the following
- We are using the LWIP API correctly - not using raw or sequential API calls in the wrong contexts
- The buffer is declared with the attribute "section". The result is that the buffer is stored in the core's TCM region - so it is non-cacheable, and not close to the shared memory with the other core.
- The buffer sizes that cause the issue follow a specific pattern: The size is offset by 2 bytes from a multiple of 32. So if {buffer_size}%32 is equal to 2 or 30, this failure will occur.
- Adding an "aligned" attribute when declaring the buffer - I confirmed that this does align the buffer, but this does not change the result of the test
- Attempting to read from the EDMA ERRAGG register to see if any errors are reported - I saw no errors
- Attempting to backtrace to find the route cause of failure in the core that fails - but it appears the issue is with a corrupted stack, and I could not route cause a specific instruction
Please let me know if you have any ideas for what the problem could be.
Thank you!