_mem_extend in Vybrid BSP

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

_mem_extend in Vybrid BSP

Jump to solution
851 Views
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.

Tags (4)
0 Kudos
1 Solution
348 Views
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.

View solution in original post

0 Kudos
4 Replies
348 Views
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 Kudos
349 Views
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 Kudos
348 Views
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 Kudos
348 Views
RadekS
NXP Employee
NXP Employee

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

0 Kudos