[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-users] MEM_SIZE
From: |
Simon Goldschmidt |
Subject: |
Re: [lwip-users] MEM_SIZE |
Date: |
Thu, 15 Mar 2018 11:23:58 +0100 |
Giuseppe Modugno wrote:
> [..]
> In my case, I have a completely free (not used by the linker) 32kB RAM
> region starting from 0x2007C000. To instruct lwip to use that region for
> heap, I think I have to define:
>
> #define MEM_SIZE (32 * 1024 - 1 * SIZEOF_STRUCT_MEM)
> #define LWIP_RAM_HEAP_POINTER ( (void *)0x2007C000 )
>
> Supposing we don't need other additional space for alignment.
> In this case the total free heap memory available for data is exactly
> MEM_SIZE, that is less than 32kB.
>
> Is it correct?
I think so, yes. However, your definition of MEM_SIZE won't compile outside
of mem.c. Maybe it would be better to rework the code to use MEM_SIZE as
size of the available block, at least if an external block is used...
Simon