Carlos,
I believe I found the issue, and it is a bug in the MQX bsp.
In _bsp_pre_init() there is a section of code that intends to create a non-cachable SRAM memory pool for use by the Ethernet driver among others. It does this by first _statically_ testing if the KERNEL is placed in internal or external SRAM, making the assumption that this is where the kernel heap is also placed. If internal it allocates from the standard kernel memory pool. If external it creates a new pool in non-cached memory and allocates from it.
However this function fails to handle the case where the kernel memory pool is extended at run-time via _mem_extend() with cached memory. This is why if the memory is extended before initializing Ethernet it fails.
The logic is too convoluted. It tries to make assumptions about where the memory pool is going to be rather than just actually testing where the memory pool is at the time the code is executed.
The logic needs to change to:
- Test where the memory pool actually is (at run time)
- If internal allocate from it
- If external allocate from an internal memory pool.
A better method might be just to allocate the Ethernet buffers unconditionally and statically with the linker section to a non-cached memory region. This would eliminate a lot of convoluted logic and obscure #define's such as BSPCFG_HAS_SRAM_POOL and BSPCFG_ENET_SRAM_BUF.
PMT