Quality RTOS & Embedded Software

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


Reuse of IAR cstack and rstack

Posted by BarberCol on February 13, 2008
Using IAR and a Atmega 645. The IAR needs space for a cstack and rstack for initialization. The return stack should be completely reusable and most of the cstack is free. I do not want to manually force data to these areas because this could lead to maintenance problems later. Is there a way for the compiler linker to automatically reuse this space?

RE: Reuse of IAR cstack and rstack

Posted by sotd on February 13, 2008
No, but there are some hacks you can do.

You can make the idle task stack use the same memory to gain some there.

You can use the linker to allocate the main stack to an area that will get written over once the scheduler starts. If the main stack uses memory that is also used by a task stack then you must ensure that the start of the memory block where the first task context is written is kept clean but only that big.

You can allocate a very small stack, pvPortMalloc() some memory from the heap, point the stack to that so you get a stack big enough to create your tasks, then vPortFree() the memory again when the first task start running. This is probably the easiest.

Im talking GCC here not IAR but should be the same.

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

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

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


FreeRTOS and other embedded software careers at AWS.

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

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

Xilinx Microblaze and Zynq partner