lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] memory management


From: Krzysztof Wesołowski
Subject: Re: [lwip-users] memory management
Date: Fri, 21 Aug 2015 15:50:02 +0200

It's much safer to integrate this with linker script (for example with attributes on gcc).  Casting number to pointer does not guarantee that other variable will no be placed in the same area (by linker or other Dev using such tricks). Happy debugging when it happens :)

On 21 Aug 2015 14:54, "Sergio R. Caprile" <address@hidden> wrote:
There is a comment in mem.c:

/** If you want to relocate the heap to external memory, simply define
 * LWIP_RAM_HEAP_POINTER as a void-pointer to that location.
 * If so, make sure the memory at that location is big enough (see below on
 * how that space is calculated). */
#ifndef LWIP_RAM_HEAP_POINTER
/** the heap. we need one struct mem at the end and some room for
alignment */
u8_t ram_heap[MEM_SIZE_ALIGNED + (2*SIZEOF_STRUCT_MEM) + MEM_ALIGNMENT];
#define LWIP_RAM_HEAP_POINTER ram_heap
#endif /* LWIP_RAM_HEAP_POINTER */


ehmm... it is just an array of bytes... how would you instruct your
compiler to put YOUR array of bytes in whatever it is "external memory"
for your particular application ? Then do it that way.

For example, if you are running on an ARM Cortex-M3 with an external
memory space going from 0x6000000 to 0x7000000 and you happen to have
put your RAM chip decoded from 0x64000000 upwards and you happen to want
to have your heap there, then you will read your compiler manual and
figure out how to tell it to use 0x64000000 as a void-pointer, and then
you will write the macro LWIP_RAM_HEAP_POINTER accordingly:

#define LWIP_RAM_HEAP_POINTER   ((void *) 0x64000000)

works (at least) on Keil and IAR and seems to be CMSIS compliant.

--


_______________________________________________
lwip-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/lwip-users

reply via email to

[Prev in Thread] Current Thread [Next in Thread]