Can I get Heap Info in MQX?

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

Can I get Heap Info in MQX?

Jump to solution
1,264 Views
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.

Tags (1)
0 Kudos
1 Solution
892 Views
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!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
2 Replies
893 Views
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 Kudos
892 Views
kalaiyarasansel
Contributor II

Hi Daniel,

Thanks for the answer,

0 Kudos