I am using the latest lwip from git. Port from amazon-freertos
.
FreeRTOS version 10.3.1. I attach the lwipopts.h configuration.
I create 4 interfaces, but now I use only 1. Receiving packets for each interface in a separate FreeRTOS task. Using sockets lwip create port 80 and do standard listen / accept for connections. After some time, I get an error accessing memory in the tcp_output function, I can only get the address of the instruction and the ASM code of the function. To make the error appear faster for testing, I run a request for the test.png file in the while loop.
I receive packets by allocating a buffer in PBUF_POOL:
struct pbuf * pBuf = pbuf_alloc (PBUF_RAW, t_sizeInBytes, PBUF_POOL);
if (pBuf! = NULL) {
for (q = pBuf; q! = NULL; q = q-> next) {
memcpy (q-> payload, pack, q-> len);
pack = pack + q-> len;
}
}
return pBuf;
Request processing pseudocode(all in 1 task):
sock = accept;
read (sock);
write (sock);
shutdown (sock, RDRW);
close (sock);
If I run wget of the file from the device in a while loop:
while:; do (wget -c
192.168.1.1/test.png && rm test.png); done
In a couple of minutes I get an assert message or a crash:
Assertion "tcp_receive: valid queue length" failed at line 1134 in src / lwip / src / core / tcp_in.
Crash is obtained in the tcp_output function after calling lwip_htonl.
Any idea why this might be?
Best regards,
Rustam Mustafin