Hi Gents,
iMXRT1062 user. And I'm looking to move LWIP's heap to external ram to save on DTC, as indicated in LWIP's 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 */
LWIP_DECLARE_MEMORY_ALIGNED(ram_heap, MEM_SIZE_ALIGNED + (2U * SIZEOF_STRUCT_MEM));
#define LWIP_RAM_HEAP_POINTER ram_heap
#endif /* LWIP_RAM_HEAP_POINTER */
I want to make sure I do this correctly. My heap is at RAM4 with "End" location. Has anyone been down this road? What exactly do I need to #define ?
Hello,
The modification you showed on the image is to change the Heap of the entire application, if you want to change the LWIP Heap, you will need to define LWIP_RAM_HEAP_POINTER as a void-pointer to location 0x80000000.
Have a great day,
Victor
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------
Yes, its the entire application heap setup of course. I posted it to disclose my setup.
" if you want to change the LWIP Heap, you will need to define LWIP_RAM_HEAP_POINTER as a void-pointer to location 0x80000000."
That is what I'm asking how to properly do.
Hello Mike,
You can achieve this with the following:
void *LWIP_RAM_HEAP_POINTER = (void *) 0x80000000;
Regards,
Victor
Thank you. I notice LWIP_PBUF_MEMPOOL is also using a bunch of DTC. Is it possible to move this to BOARD_SDRAM as well?
/*
* A list of pools of pbuf's used by LWIP.
*
* LWIP_PBUF_MEMPOOL(pool_name, number_elements, pbuf_payload_size, pool_description)
* creates a pool name MEMP_pool_name. description is used in stats.c
* This allocates enough space for the pbuf struct and a payload.
* (Example: pbuf_payload_size=0 allocates only size for the struct)
*/
LWIP_MEMPOOL(PBUF, MEMP_NUM_PBUF, sizeof(struct pbuf), "PBUF_REF/ROM")
LWIP_PBUF_MEMPOOL(PBUF_POOL, PBUF_POOL_SIZE, PBUF_POOL_BUFSIZE, "PBUF_POOL")
Hello Mike,
Yes, it is possible to move this to the external SDRAM.
Regards,
Victor