andymcc0 wrote on Friday, March 20, 2015:
The NXP LPC1788 Ethernet DMA engine requires the descriptors and the data buffers to be in the 32kB of Peripheral SRAM between 0x2000 0000 - 0x2000 7FFF. I found it easiest to do this explicitly, rather than using the linker.
/* AWM - A comment in the original LPCOpen code example from which this was developed, stated:
* "The Ethernet Block can only access Peripheral SRAM and External Memory. In this example,
* Peripheral SRAM is selected for storing descriptors, status arrays and send/receive buffers."
* so I am going to use the statically allocated BufferAllocation_1 method.
* See vNetworkInterfaceAllocateRAMToBuffers() below for more detail */
#define ENET_RX_STAT_BASE (0x20000000UL) /* Base of peripheral RAM */
#define ENET_RX_DESC_BASE (ENET_RX_STAT_BASE + ENET_NUM_RX_DESC * sizeof(ENET_RXSTAT_T))
#define ENET_TX_STAT_BASE (ENET_RX_DESC_BASE + ENET_NUM_RX_DESC * sizeof(ENET_RXDESC_T))
#define ENET_TX_DESC_BASE (ENET_TX_STAT_BASE + ENET_NUM_TX_DESC * sizeof(ENET_TXSTAT_T))
#define ENET_BUFFER_BASE (ENET_TX_DESC_BASE + ENET_NUM_TX_DESC * sizeof(ENET_TXDESC_T))
The comment referred to is in
enet.c in the periph_ethernet example.
Then you use these #defines when setting up the buffers and descriptors. Note this was done for the FreeRTOS+TCP stack, not the lwip, but the principle should remain the same.
I don’t doubt that there are better ways to do this, but it worked for me.