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


Minimal useful heap size w/LPC2103

Posted by specialk on October 6, 2009
I've been trying to squeeze FreeRTOS onto an LPC2103 (8KB SRam and 32KB Flash) and am able to get it working with the following config setting:

configTOTAL_HEAP_SIZE = 4 * 1024

Which I think should be enough for the kind of basic tasks I'm doing (reading an LM75, etc.), but I don't have enough experience with FreeRTOS to say for sure. I also adjusted the size of the heap/stack for the LPC2103 to try to claw back a bit of memory. I was wondering if anyone would be able to guess (from their experience) if the following settings are likely to cause a problem with FreeRTOS or if I should be adjusting them up or down:

- Heap Size: 1024 Bytes
- Abort Mode Stack: 4 Bytes
- FIQ Stack: 32 Bytes
- IRQ Stack: 256 Bytes
- Supervisor Stack: 256 Bytes
- Undefined Stack: 4 Bytes
- User/System Stack: 0 Bytes
- .

Since FreeRTOS runs in supervisor mode I'm assuming I don't really need the User/System stack space, but I'm not completely sure.

In any case, with the settings above FreeRTOS at least runs and uses:

- **19,732 Bytes Flash** (12.7KB Free)
- **5,868 SRAM** (2.2 KB Free)

If anyone can suggest something to improve on this or let me know if I'm doing something dangerous, I'd certainly be glad to hear it now rather than 3 months down the road. :-)

RE: Minimal useful heap size w/LPC2103

Posted by Richard on October 6, 2009
FreeRTOS V6.0.0 is now in SVN (although not yet released), if you look at heap_1.c and heap_2.c you will see a new function that allows you to query the amount of heap space remaining. Using that and uxTaskGetStackHighWaterMark() you can tune your memory usage.

Also worth setting confgCHECK_FOR_STACK_OVERFLOW to 2 to provide some run time stack checking too.

Not exactly what you were asking, but hopefully helpful none the less.


[ 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