Quality RTOS & Embedded Software

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




Loading

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.

Regards.


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




Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

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

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

OpenRTOS and SafeRTOS