_mem_extend in Vybrid BSP

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

_mem_extend in Vybrid BSP

ソリューションへジャンプ
917件の閲覧回数
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 解決策
414件の閲覧回数
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 返答(返信)
414件の閲覧回数
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 件の賞賛
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 件の賞賛
414件の閲覧回数
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 件の賞賛
414件の閲覧回数
RadekS
NXP Employee
NXP Employee

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

0 件の賞賛