Can I get Heap Info in MQX?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Can I get Heap Info in MQX?

跳至解决方案
1,262 次查看
kalaiyarasansel
Contributor II

Hi,

I am using MQX for my project, Where i want to check the heap usage priority.  I know that we have function "_mem_get_highwater"  which will give highest allocated memory but  I need the percentage of memory used in the heap.

I need to start address and size of the heap(default memory pool). 

Please update me if any,

Thanks,

Kalaiyarasan.

标记 (1)
0 项奖励
1 解答
890 次查看
danielchen
NXP TechSupport
NXP TechSupport

Hi KALAIYARASAN

Unfortunately MQX does not implement a tool that calculate the amount of heap available .

The heap is defined inside the kernel memory area.

START_OF_KERNEL_AREA, END_OF_KERNEL_ARREA: an area with restricted access for user-mode tasks. It covers the KERNEL_DATA structure, default memory heap and other privileged MQX RTOS structures and data, including the kernel-owned globals.

These values are defined in the linker files as starting after all the other RAM variables, and going to end_of_kd (which is the address at the end of RAM). So the size and starting address depends on the application. The source files pick this up in

C:\Freescale\Freescale_MQX_4_2\mqx\source\bsp\<board_name>\<board_name>.h with

 

#define BSP_DEFAULT_START_OF_KERNEL_MEMORY                    ((void *)__KERNEL_DATA_START)

#define BSP_DEFAULT_END_OF_KERNEL_MEMORY                      ((void *)__KERNEL_DATA_END)

If you look up the map file that gets generated and search for KERNEL_DATA_START you will find where it starts explicitly.


Have a great day,
Daniel

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

在原帖中查看解决方案

0 项奖励
2 回复数
891 次查看
danielchen
NXP TechSupport
NXP TechSupport

Hi KALAIYARASAN

Unfortunately MQX does not implement a tool that calculate the amount of heap available .

The heap is defined inside the kernel memory area.

START_OF_KERNEL_AREA, END_OF_KERNEL_ARREA: an area with restricted access for user-mode tasks. It covers the KERNEL_DATA structure, default memory heap and other privileged MQX RTOS structures and data, including the kernel-owned globals.

These values are defined in the linker files as starting after all the other RAM variables, and going to end_of_kd (which is the address at the end of RAM). So the size and starting address depends on the application. The source files pick this up in

C:\Freescale\Freescale_MQX_4_2\mqx\source\bsp\<board_name>\<board_name>.h with

 

#define BSP_DEFAULT_START_OF_KERNEL_MEMORY                    ((void *)__KERNEL_DATA_START)

#define BSP_DEFAULT_END_OF_KERNEL_MEMORY                      ((void *)__KERNEL_DATA_END)

If you look up the map file that gets generated and search for KERNEL_DATA_START you will find where it starts explicitly.


Have a great day,
Daniel

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 项奖励
890 次查看
kalaiyarasansel
Contributor II

Hi Daniel,

Thanks for the answer,

0 项奖励