|
From: | Noam Weissman |
Subject: | Re: [lwip-users] lwIP with FreeRTOS memory problem |
Date: | Tue, 29 Nov 2016 08:14:34 +0000 |
Hi, As a continuation to my earlier mail. I just remembered something so I added it here. Several years ago when I started working with LwIP I had a similar problems to the one you raised. System was working ok but out of the blue it crashed. I got a project that someone else started and continued from there… From examining the lwipopts and opts files and doing some debugging I found that my options were not properly set. Especially the following: //#define MEMP_NUM_TCP_SEG 20 #define MEMP_NUM_TCP_SEG TCP_SND_QUEUELEN // 20 // This was previosly 20 and cause a MEM_ERR it was changed
// to BE THE SAME SIZE AS
TCP_SND_QUEUELEN Originally MEMP_NUM_TCP_SEG was a fixed number and was defined separately from TCP_SND_QUEUELEN. I found the hard way that I am getting MEM_ERR because of the above. I did not had sufficient MEMP_NUM_TCP_SEG defined. After changing the above to what it is now those issues were solved. Also see the following error (from LwIP init.c): “ #error "lwip_sanity_check: WARNING: MEMP_NUM_TCP_SEG should be at least as big as TCP_SND_QUEUELEN. If you know what you
are doing, define LWIP_DISABLE_TCP_SANITY_CHECKS to 1 to disable this error." The opts.h file defines MEMP_NUM_TCP_SEG as a fixed value and that causes an error that I am probably not the only one That encountered.
Hope that helped. BR, Noam. From: lwip-users [mailto:lwip-users-bounces+address@hidden
On Behalf Of Noam Weissman Hi, I am not sure with my reply as this area is not so documented. What I can see in your lwipopts that you use tons of memory for the LwIP heap but
other defines are way to small
For example: #define MEMP_NUM_PBUF 16 <<< ? #define MEMP_NUM_UDP_PCB 4 #define MEMP_NUM_TCP_PCB 32 #define MEMP_NUM_TCP_PCB_LISTEN 8 I am using a micro (STM32F4 and F2) with limited memory and never had to use more than 20K RAM. LwIP own opts.h file has macro’s in it and there is a reason for that. Some values have relations with other values. I have attached my own lwipopts.h for your reference. Use it and hopefully it will help you. Do understand that I have set up RAW API and Socket API as well. I use mostly RAW API but as I am using PolarSSL I need the Socket API as well. Good luck, Noam. From: lwip-users [mailto:lwip-users-bounces+address@hidden]
On Behalf Of pekez Hello people, When both MEMP_MEM_MALLOC and MEM_LIBC_MALLOC are 0 then everything works completely expected. However, when I set MEMP_MEM_MALLOC to 1 (according to
RAM usage article from lwIP wiki), so that every piece of dynamically allocated memory comes from heap of MEM_SIZE size, application always crashes, no matter how big or small MEM_SIZE is (I have a lot of
RAM, so I tried to put MEM_SIZE to even more then 20 MB!). Application crashes because two of FreeRTOS asserts fail, I get these two prints: "Assert failed in file queue.c, line 1224" and "Assert failed in file port.c, line 424". According to call trace (which
I provided in attachments), it crashes when XEmacPs_IntrHandler (I am using Xilinx layer 2 drivers) tries to allocate memory for pbuf.
Is this problem even related to lwIP or maybe to FreeRTOS or Xilinx drivers, what do you think? I am also providing the entire lwipopts.h, so that you can see whether some other options need to be changed in order to make application work with MEMP_MEM_MALLOC
set to 1. Thanks in advance. |
[Prev in Thread] | Current Thread | [Next in Thread] |