Hi
I am running MQX on the Vybrid Tower board (target twrvg65gs10_a5) from internal SRAM using IAR as the compiler.
On calling the functions _mem_alloc(size) or _mem_alloc_system(size) NULL is returned and the task error code is set to LWMEM_POOL_INVALID.
I am unsure why this is, as the system pool should surely be valid?
From reading the docs, it appears these are aliased to using lwmem functions instead, so do I need to call _lwmem_set_default_pool() ?
Steps I have taken:
- Tried using _lwmem_set_default_pool() beforehand with the pool_id returned by _mem_get_system_pool_id(), this makes no difference.
- Used _mem_alloc_system instead of _mem_alloc. No difference.
- Tried to disable LWMEM by setting MQX_USE_LWMEM_ALLOCATOR to 0 in user_config.h and recompiling. No difference.
- Traced through _bsp_enable_card() in init_bsp.c to see if SRAM was being used. It appears to be as the following line executes in memory setup (line 130), hence I am farily sure user_config.h is set to use internal SRAM, though I am unsure about this:
- _BSP_sram_pool = _mem_get_system_pool_id()
- Traced through mem_alloc(). _lwmem_alloc_internal throws the error as mem_pool_ptr->VALID != LWMEM_POOL_VALID. But why should the pool be invalid?
- In kernel_data while tracing through _lwmem_alloc_system, kernel_data.LWMEM_POOLS.SIZE shows as 0 in the debugger, is this normal?
Currently MQX_USED_UNCACHED_MEM is set to 1 (default) and MQX_USE_LWMEM_ALLOCATOR is set to 0.
Apologies if this is in the manual somewhere, but I can't quite see it.
Message was edited by: Christopher Hemingway added- Trace through mem_alloc