Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training




Loading

Monitor Avaliable Ram

Posted by Çağlar Akyüz on September 27, 2006
How can I estimate/monitor the size of free RAM?

I'm using LWiP Webserver Project under GCC for SAM7X. I know the theoric calculation and I think at least there should be 40k avaliable. However, I want to decide avaliable free ram at run time. I'm thinking of calling vPortMalloc and check for return value. Do you I have to arrange heap size or something else for this method to work?

Any other idea is also appreciated.

Regards

RE: Monitor Avaliable Ram

Posted by Nobody/Anonymous on September 28, 2006
The kernel heap is internally only used for allocation of RAM to tasks, queues and semaphores. Applications can of coarse use it for anything else they wish.

If your question is how much of the kernel heap RAM remains, rather then total RAM, then the answer depends on the heap implementation you are using.

I don't think you could use heap_1.c with lwIP as it does not implement free. If you were using heap_1 then you could just look at the xNextFreeByte variable.

heap_2.c implements free but does not merge free blocks. I think you could write a simple function that walks the chain of free blocks an adds up their totals.

heap_3.c just uses standard malloc() and free(). Is there a standard function call to ascertain the free heap in this case?

RE: Monitor Avaliable Ram

Posted by Çağlar Akyüz on September 28, 2006
I'm actually interested in Total RAM. Besides, I have some data between 32k-64k. I have SPI RAM for temporary storage and SPI flash for permament storage. I want to calculate how much internal SRAM I can use before using SPI RAMS.

Is it a good idea to increase heap size and dynamically allocate ram from heap or just should I decrease it as much as possible and use off-heap ram.

Thanks.

RE: Monitor Avaliable Ram

Posted by Nobody/Anonymous on September 28, 2006
I should decrease the heap so it just contains the RAM needed by the kernel. Then you can see what is what from your map file.

RE: Monitor Avaliable Ram

Posted by Nobody/Anonymous on September 28, 2006
utility for heap_2.c
2006-09-06 12:26
int vPortUsedMem(void)
{
xBlockLink *pxBlock = &xStart;
int size = 0;

vTaskSuspendAll();

while ((pxBlock) && (pxBlock != &xEnd))
{
size += pxBlock->xBlockSize;
pxBlock = pxBlock->pxNextFreeBlock;
}

xTaskResumeAll();

return size;
}

best rgs
Janusz


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.


Free TCP/IP and file system demos for the RTOS


Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists