Re: [lwip-users] Issue in arch.h for lwIP 2.0.0

2016-11-29 Thread Dirk Ziegelmeier
I added it, thanks for reporting!

​
http://git.savannah.gnu.org/cgit/lwip.git/commit/?id=182d7c138a5b845c74b7d364ee07af6105d8e786

Dirk

On Tue, Nov 29, 2016 at 10:19 PM, Amit Ashara  wrote:

> Hello All,
>
> I am using the ARM Compiler from Code Composer Studio and while updating
> lwIP from 1.4.1 to 2.0.0, I ran into a compilation issue. I get an error
> for size_t being undefined. Tracing the issue I was able to go past the
> issue by adding stdlib to arch.h
>
> #if !LWIP_NO_STDINT_H
> #include 
> #include 
> typedef uint8_t   u8_t;
> typedef int8_ts8_t;
> typedef uint16_t  u16_t;
> typedef int16_t   s16_t;
> typedef uint32_t  u32_t;
> typedef int32_t   s32_t;
> typedef uintptr_t mem_ptr_t;
> #endif
>
> "D:/ti/TivaWare_C_Series-2.1.3.156/third_party/lwip-2.0.0/src/include/lwip/def.h",
> line 124: error #20: identifier "size_t" is undefined
>
> Can any of the lwIP developers confirm if this is expected issue?
>
> As a side note: after making the change lwIP 2.0.0 works great with TM4C
> devices.
>
> Thanks and Regards
> Amit Ashara
>
> ___
> lwip-users mailing list
> lwip-users@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/lwip-users
>
___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

[lwip-users] Issue in arch.h for lwIP 2.0.0

2016-11-29 Thread Amit Ashara
Hello All,

I am using the ARM Compiler from Code Composer Studio and while updating
lwIP from 1.4.1 to 2.0.0, I ran into a compilation issue. I get an error
for size_t being undefined. Tracing the issue I was able to go past the
issue by adding stdlib to arch.h

#if !LWIP_NO_STDINT_H
#include 
#include 
typedef uint8_t   u8_t;
typedef int8_ts8_t;
typedef uint16_t  u16_t;
typedef int16_t   s16_t;
typedef uint32_t  u32_t;
typedef int32_t   s32_t;
typedef uintptr_t mem_ptr_t;
#endif

"D:/ti/TivaWare_C_Series-2.1.3.156/third_party/lwip-2.0.0/src/include/lwip/def.h",
line 124: error #20: identifier "size_t" is undefined

Can any of the lwIP developers confirm if this is expected issue?

As a side note: after making the change lwIP 2.0.0 works great with TM4C
devices.

Thanks and Regards
Amit Ashara
___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

Re: [lwip-users] lwIP with FreeRTOS memory problem

2016-11-29 Thread Noam Weissman
Hi,

Regarding my lwipopts ... we use a telnet server and as a result send small 
chunks of data.

Originally MSS was 1500 bytes and that cause the system to be very slow when 
combined with HTTP etc.

The compromise that I made is to set MSS to its default 536 bytes. This slowed 
down HTTP communication but 
In all it is not so significant. In all I find this a general compromise that 
works fine.


BR,
Noam.

-Original Message-
From: lwip-users [mailto:lwip-users-bounces+noam=silrd@nongnu.org] On 
Behalf Of pekez
Sent: Tuesday, November 29, 2016 1:29 PM
To: Mailing list for lwIP users
Subject: Re: [lwip-users] lwIP with FreeRTOS memory problem

All right people, but since my main goal is to know the exact amount of memory 
the lwIP uses, could I just find that out without setting MEMP_MEM_MALLOC to 1, 
since it seems that it requires some changes in the kernel itself, as Richard 
and Simon explained. I am still not daring to make such changes since I am not 
really experienced, and especially if I can avoid that (at least for now).

So, I have returned MEMP_MEM_MALLOC to 0, and generated with Xilinx SDK a .map 
file (it's in attachments). Can we say that lwIP for sure won't take more 
memory then what we can see in that file, ram_heap plus sum of everything that 
makes memp_memory (which includes entire pbuf_pool
(PBUF_POOL_BUFSIZE*PBUF_POOL_SIZE) as well)? Is there anyway I can verify that 
with mentioned iperf application, for example, to add some enormous array which 
will fill the rest of RAM, and try to write to it, and see whether that will 
make some influence on lwIP?

Noam, I had a look at your lwipopts.h, and I must say that your suggestions 
have helped when it comes to lwIP performance, especially the MEMP_NUM_PBUF 
define.

The Best,
Nenad


___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users


Re: [lwip-users] lwIP with FreeRTOS memory problem

2016-11-29 Thread pekez
All right people, but since my main goal is to know the exact amount of 
memory the lwIP uses, could I just find that out without setting 
MEMP_MEM_MALLOC to 1, since it seems that it requires some changes in 
the kernel itself, as Richard and Simon explained. I am still not daring 
to make such changes since I am not really experienced, and especially 
if I can avoid that (at least for now).


So, I have returned MEMP_MEM_MALLOC to 0, and generated with Xilinx SDK 
a .map file (it's in attachments). Can we say that lwIP for sure won't 
take more memory then what we can see in that file, ram_heap plus sum of 
everything that makes memp_memory (which includes entire pbuf_pool 
(PBUF_POOL_BUFSIZE*PBUF_POOL_SIZE) as well)? Is there anyway I can 
verify that with mentioned iperf application, for example, to add some 
enormous array which will fill the rest of RAM, and try to write to it, 
and see whether that will make some influence on lwIP?


Noam, I had a look at your lwipopts.h, and I must say that your 
suggestions have helped when it comes to lwIP performance, especially 
the MEMP_NUM_PBUF define.


The Best,
Nenad

___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

Re: [lwip-users] lwIP with FreeRTOS memory problem

2016-11-29 Thread Simon Goldschmidt
Noam Weissman wrote:
> As far as I remember communication stopped and maybe it crashed or not this 
> is not the issue.
> The issue is that once I set my defines as suggested this problem was never 
> happened again.

This is totally off topic here. The OP has set MEMP_MEM_MALLOC to 1. In this 
case, all pool
size settings do not matter as everything is allocated from the heap.

> if the system does do not have sufficient buffers but have sufficient PCB's 
> this causes an
> abnormal behavior.

Right. Welcome to the world of resource-constrained systems ;-)


Simon

___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users


Re: [lwip-users] lwIP with FreeRTOS memory problem

2016-11-29 Thread Noam Weissman
Hi Simon,

Maybe I am wrong, it was 4-5 years ago :-).

As far as I remember communication stopped and maybe it crashed or not this is 
not the issue.
The issue is that once I set my defines as suggested this problem was never 
happened again.

>From what I understand every connection has a new PCB and a pBuf that holds 
>the received data.
if the system does do not have sufficient buffers but have sufficient PCB's 
this causes an abnormal 
behavior. I do not remember if that was a problem with version 1.32 or also in 
1.41  as I upgraded at 
some time.

BR,
Noam.

-Original Message-
From: lwip-users [mailto:lwip-users-bounces+noam=silrd@nongnu.org] On 
Behalf Of Simon Goldschmidt
Sent: Tuesday, November 29, 2016 11:26 AM
To: lwip-users@nongnu.org
Subject: Re: [lwip-users] lwIP with FreeRTOS memory problem

Noam Weissman wrote:
> 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 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.


How would your system crash because of insufficient tcp segment pool elements?
You could get communication hiccups, but it shouldn't crash!


Simon

___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users
___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users


Re: [lwip-users] lwIP with FreeRTOS memory problem

2016-11-29 Thread Simon Goldschmidt
Noam Weissman wrote:
> 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 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.


How would your system crash because of insufficient tcp segment pool elements?
You could get communication hiccups, but it shouldn't crash!


Simon

___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

Re: [lwip-users] lwIP with FreeRTOS memory problem

2016-11-29 Thread Noam Weissman
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_SEG20
#define MEMP_NUM_TCP_SEGTCP_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+noam=silrd@nongnu.org] On 
Behalf Of Noam Weissman
Sent: Monday, November 28, 2016 1:14 PM
To: Mailing list for lwIP users
Subject: Re: [lwip-users] lwIP with FreeRTOS memory problem

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+noam=silrd@nongnu.org] On 
Behalf Of pekez
Sent: Monday, November 28, 2016 12:18 PM
To: Mailing list for lwIP users
Subject: [lwip-users] lwIP with FreeRTOS memory problem


Hello people,

I've been trying to figure out how lwIP uses memory and it's really important 
to know exact (or maximum) amount of memory that lwIP uses. I am using lwIP 
v1.4.1 with FreeRTOS v8.2.3 on ZYNQ custom board. Right now, I am working with 
application examples provided by Xilinx 
(XAPP1026).
 On ZYNQ board, I am running iperf server, 
and on PC iperf client.

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.
___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

Re: [lwip-users] lwIP with FreeRTOS memory problem

2016-11-29 Thread Simon Goldschmidt
pekez wrote:
> [..]
> However, when I set MEMP_MEM_MALLOC to 1 [..]
> it crashes when XEmacPs_IntrHandler (I am using Xilinx layer 2 drivers) tries 
> to allocate memory for pbuf.

I'm afraid using MEMP_MEM_MALLOC from interrupt does currently not work: it 
will allocate any memory
from the heap, which is protected via getting a semaphore.

Depending on your port, this might work for a while and only crash if the heap 
is actually protected (used)
from non-interrupt context and the interrupt handler tries to access it (as 2nd 
context). This *might*
explain why it works for a while.

Being like that, you can still use MEMP_MEM_MALLOC when changing your ISR to a 
task-based DSR (like
Richard explained), if that's a solution for you...


Simon

___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users