lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] memory management


From: Sergio R. Caprile
Subject: Re: [lwip-users] memory management
Date: Fri, 21 Aug 2015 09:54:15 -0300
User-agent: Mozilla/5.0 (Windows NT 5.1; rv:38.0) Gecko/20100101 Thunderbird/38.2.0

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.

-- 




reply via email to

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