Can I extend default memory pool with MRAM?

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

Can I extend default memory pool with MRAM?

Jump to solution
1,739 Views
madifazio
Contributor III

Hi

 

(using twrmcf52259 and cw10)

 

I been reading a lot of forum messages, freescale documentation and source code trying to understand this.

 

Our application is low on memory, so we bought a TWR_MEM module to increase system RAM.

 

Until now 2 aproaches was used

 

1) we use _mem_extend() function. We have a modal dialog that show something like "An address outside of the KERNEL DATA area was detected: 0x100002e3, this may mean kernel data corruption". This ocurs because when sram is full, consecutive calls to _mem_alloc() returns memory from MRAM that is outside of KERNEL DATA range defined in the linker command file.

 

2) modify the linker command file, redefining the ram sector to be located in the MRAM address space at 0x10000000 and 0x80000 size. In this case our web server is no longer available( posibly due a poor performance of MRAM).

 

Could anyone help us? Is posible extend the default memory pool with MRAM?

thanks in advance.

 

 

 

0 Kudos
1 Solution
740 Views
DavidS
NXP Employee
NXP Employee

Hi Guys,

I'm trying to shack the FSL tree to get a reply.  Hopefully soon as this is a good question and one that I feel would be a good entry to our FAQ.

Regards,

David

View solution in original post

0 Kudos
7 Replies
740 Views
admin
Specialist II

I'm looking for an answer to this as well. My question is pretty much the same, except I'm using 1MB of SRAM. But it's still tied off the FlexBus in exactly the same way.

 

_mem_extend() seems to run correctly, but my application kind of stops working properly after that. The task-aware-debugger doesn't seem to properly report on the default memory pool anymore, I get the error about being outside kernel data, and my application stops working at about the time I expect memory is starting to get allocated in the external RAM.

0 Kudos
741 Views
DavidS
NXP Employee
NXP Employee

Hi Guys,

I'm trying to shack the FSL tree to get a reply.  Hopefully soon as this is a good question and one that I feel would be a good entry to our FAQ.

Regards,

David

0 Kudos
740 Views
admin
Specialist II

Any news on this?

0 Kudos
740 Views
madifazio
Contributor III

Not yet, 

 

In order to use _mem_extend, i was using #define MQX_USE_MEM 1 in user_config.h. I actually comment this line to use lwmem and my program work better. Web server running, ftp server running, my own server using sockets running.

All low priority tasks run from MRAM, I encapsulate mallocs to allocate from MRAM

 

Perhaps in MQX 3.7 we have a method to extend default memory pool with MRAM. and documented functions like _task_create_at

 

regards

0 Kudos
740 Views
ErikSeavey
Contributor I

I have a similar problem.  If I use _mem_extend() before creating tasks or my kernel log then when stopping the debugger or saving performance data in Codewarrior I get the kernel data corruption errors and the addresses given are those in my extended memory address range.  HOWEVER, it appears that my code is running fine on the board.  It is as if the debugger Task Aware Debugging is not aware of the extended memory, though the MQX tools seem to know of it; I can select the MQX->Memory Extension Blocks menu item and it correctly shows the new block address and size.

 

Any thoughts anyone?

 

 

Erik

 

0 Kudos
740 Views
Akshaya_Mukund
Contributor I

Was anyone able to make any progress on this. I am facing a problem of insufficient heap memory and I was hoping to resovle my issues via addition of  the TWR-MEM card.

 

Any pointers would be welcome or if anyone could share what changes would be required to MQX it would be great.

 

Regards

0 Kudos
740 Views
madifazio
Contributor III

Hi David

Thanks for your help. 

For now we create a new pool of memory in MRAM to decompress SRAM sending to the new pool those tasks that not require a good performance.

I will wait the reply to the original question.

Thanks again.

 

0 Kudos