_mem_extend in Vybrid BSP

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

_mem_extend in Vybrid BSP

跳至解决方案
918 次查看
kubiznak_petr
Contributor V

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.

标记 (4)
0 项奖励
1 解答
415 次查看
RadekS
NXP Employee
NXP Employee

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.

在原帖中查看解决方案

0 项奖励
4 回复数
415 次查看
kubiznak_petr
Contributor V

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?

0 项奖励
416 次查看
RadekS
NXP Employee
NXP Employee

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.

0 项奖励
415 次查看
kubiznak_petr
Contributor V

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.

0 项奖励
415 次查看
RadekS
NXP Employee
NXP Employee

Thank you for your note and recommendation. I will report it.

0 项奖励