How to edit the linker file to give the project more memory?

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

How to edit the linker file to give the project more memory?

Jump to solution
928 Views
danielchai
Senior Contributor I

Hi All,

 

Now when I run my project, it has out of memory problem.

It seems it can not link the project because it is large. How could I edit my linker file in order to link the large project?

 

Thank you.

Original Attachment has been moved to: intflash.lcf.zip

0 Kudos
1 Solution
450 Views
danielchai
Senior Contributor I

Hi Derek,

For statically linked variables in this case, does it mean the global variables or static variables?

Thank you.

Daniel

View solution in original post

0 Kudos
5 Replies
450 Views
soledad
NXP Employee
NXP Employee

Hi Daniel

If you want to modify the linker command file you need to modify the file located at the next path
c:\Freescale\Freescale_MQX_4_0\mqx\source\bsp\<platform>\cw\*.lcf.

However I suggest you to use the TAD in order to verify the memory usage.

This plug-in gives you the possibility to check the memory block summary. Also you can optimize the stack usage of each task by configuring a stack size for each task in such a way that for example 95 % of a task’s stack would be used under full application load (worst case stack usage by your application).

Regards

Sol

0 Kudos
450 Views
danielchai
Senior Contributor I

Hi Sol,

Thank you for your reply.

I use the TAD checked MQX Stack Usage and MQX Task Summary.

For the stack usage, it seems every task is fine but in the MQX Task Summary, it shows the TCP/IP task is out of memory.

MQX Stack Usage

U2.png

MQX Task Summary

U1.png

I tired to check the memory blocks but the Memory Block option is grayed out.

U3.png

I use the MQX Lightweight Memory Block checked it, it shows 99%. And the total is 56K. But I don't know how could it use out of memory and how could I increase the memory.

U4.png

Thank you.

Daniel

0 Kudos
450 Views
dereksnell
NXP Employee
NXP Employee

Hi Daniel,

The Lightweight memory blocks TAD view you show above shows that the memory pool, or heap, is less than half the available size in the K60F you are using.  That device has 128KB of internal SRAM starting at address 0x1FFF_0000.  But your TAD view shows the memory pool starting at 0x2000_1F30, which means the first 71KB of RAM is not being allocated to the memory pool. To compare, I loaded the web_hvac example for the cw10 project in MQX v4.0.2.2, and below is the TAD view I get.  Notice the starting address is much lower, and the memory pool has 107KB available.

web_hvac TAD.jpg

Looking at your linker command file, it appears to be set correctly.  I would guess your application has a large amount of statically linked variables, which is using up over half of your RAM.  You can review the .MAP file generated by the linker for your application to see the RAM used by the linker, and what is using it.

Thanks

451 Views
danielchai
Senior Contributor I

Hi Derek,

For statically linked variables in this case, does it mean the global variables or static variables?

Thank you.

Daniel

0 Kudos
450 Views
danielchai
Senior Contributor I

Hi Derek,

I checked the map file. The data part actually takes about 70K.

I would guess your application has a large amount of statically linked variables, which is using up over half of your RAM.

For this part, what do you mean the statically linked variables? How can I fix it?

Thank you.

Daniel

0 Kudos