_mem_get_free
_mem_get_free_from
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.)
lwm_gfre.c
lwm_gfri.c
lwm_gfrf.c
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%)