Hi, in function _bsp_enable_card() of the Vybrid M4 BSP (file init_bsp.c), there is a call to _mem_extend() as follows:
/* Extend default memory pool with lower part of tightly coupled memory */ result = _mem_extend(BSP_CORE_M4_TCML_START, BSP_CORE_M4_TCML_SIZE);
This function has no lwmem alternative, hence when MQX_USE_LWMEM_ALLOCATOR is defined 1, any application fails to build with
Error[Li005]: no definition for "_mem_extend" [referenced from init_bsp.o(bsp.a)]
Is this a bug or the MQX_USE_LWMEM_ALLOCATOR must be defined 0? Are there any workarounds?
I need to port the Atheros wifi drivers for Vybrid M4, and there are _lwmem_ functions used directly in it. I would have to rewrite it to use _mem_ functions instead, while the consequences are not very clear to me. So I really prefer patching BSP to allow for lwmem allocator usage.
Solved! Go to Solution.
It is not a bug. It is just part of default solution.
Default system memory pool has 32kB.
Command “result = _mem_extend(BSP_CORE_M4_TCML_START, BSP_CORE_M4_TCML_SIZE);“ allocates additionally 32kB (lower part of tightly coupled memory).
If you don’t need whole 64kB of tightly coupled memory in one system poll, you can comment out this command. The rest of tightly coupled memory (lower part) could be allocated by _lwmem_alloc_from in user task (for example for user data).
Potential change default system memory pool size will need more changes (like linker settings,…) = new BSP.
Ok, I fixed the issue in the application, but the question still remains: does the full memory module of MQX need to be enabled? That is does the following need to be defined?
#define MQX_USE_MEM 1 #define MQX_USE_LWMEM_ALLOCATOR 0
Or is it a bug and there is a patch for the memory extension?
It is not a bug. It is just part of default solution.
Default system memory pool has 32kB.
Command “result = _mem_extend(BSP_CORE_M4_TCML_START, BSP_CORE_M4_TCML_SIZE);“ allocates additionally 32kB (lower part of tightly coupled memory).
If you don’t need whole 64kB of tightly coupled memory in one system poll, you can comment out this command. The rest of tightly coupled memory (lower part) could be allocated by _lwmem_alloc_from in user task (for example for user data).
Potential change default system memory pool size will need more changes (like linker settings,…) = new BSP.
Hi RadekS, thank you for your explanation.
Anyway I still consider it not a very correct implementation, as the official BSP cannot currently be built without the full mem module - just a note for MQX improvements.
Thank you for your note and recommendation. I will report it.