I am new to MQX RTOS infact RTOS itself.
Can anyone please tell me if there is any way to find free RAM space in MQX?
Something similar to "free" in linux.
Thanks in advance
If you get an error add these files to the lwmem section of the PSP project
(Use this recommendation at your own risk since I don't know why Freescale hasn't included these in the PSP projects. I have not see any adverse affects myself.)
These files are located in the \mqx\source\lwmem folder. For example the default install on my machine is:
C:\Program Files\Freescale\Freescale MQX 3.8\mqx\source\lwmem
In my application I have a shell command that dumps a bunch of system information. In it I've used the functions like this:
printf("Static RAM Usage: %d Bytes\r\n", (uint32_t)_mqx_get_initialization()->START_OF_KERNEL_MEMORY - 0x1FFF0000);
printf(" Peak RAM Usage: %d Bytes(%d%%)\r\n", (uint32_t)_mem_get_highwater() - 0x1FFF0000, ((uint32_t)_mem_get_highwater() - 0x1FFF0000)/0x51E);
printf("Current RAM Free: %d Bytes(%d%%)\r\n", _mem_get_free(), _mem_get_free()/0x51E);
The magic numbers used above (0x1FFF0000 and 0x51E) are the base memory address (0x1FFF0000) and ram size (0x51E) for the Kinetis K20/K60 chips. Change them to match your system. Mine looks like this when running:
Static RAM Usage: 23712 Bytes
Peak RAM Usage: 98500 Bytes(75%)
Current RAM Free: 35468 Bytes(27%)
There's _tad_stack_usage() function in tad file which you can find in MQX/source/tad. Or another option is TAD (Task Aware Debugging) which shows stack usage in IDE.
For more information about TAD (5th chapter) : http://cache.freescale.com/files/32bit/doc/app_note/AN3905.pdf
There are more documents where TAD is described for different IDE's. These are located in MQX/doc folder.
I totally missed _mem_get_free functions.
Retrieving data ...