Akshaya Mukund Hosalli

Using TWR-MEM with MQX/TWRK60N512

Discussion created by Akshaya Mukund Hosalli on Sep 18, 2012
Latest reply on Sep 24, 2012 by David E Seymour

I am trying to increase the heap memory available to me in my application, for which purpose I got a TWR-MEM.

 

For places where I want to use a different memory pool (the one from the TWR-MEM) I used the _mem_create_pool() with the External MRAM Base and Size as arguments.

 

_mem_pool_id    _MRAM_pool_id;

void mram_create_pool()

{   

_MRAM_pool_id = _mem_create_pool(BSP_EXTERNAL_MRAM_RAM_BASE, BSP_EXTERNAL_MRAM_RAM_SIZE);   

if(_MRAM_pool_id == NULL)   

{    

  _task_block();   

}

}

 

I then use the function as shown below for mallocs on the External SRAM

 

pointer mram_alloc(int mem_size)

{

return _mem_alloc_from(_MRAM_pool_id, mem_size);

}

 

The code I am using was something I got off the forum. (and thank you to the one who posted this)

The problem I am facing is that everytime I called the mram_alloc I end up with the hard-fault which is triggered by the _lwmem_alloc_internal() funciton in lwm_alli.c.

I feel I am doing something fundamentally wrong here. If anyone has any pointers I would appreciate it.

 

Thanks

 

 

Outcomes