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


IAR EWARM version 5 stack alignment

Posted by Ricky on September 29, 2009
I've been having an issue with IAR's EWARM version 5 where functions that take 8 byte arguments (double, long long) would have the argument misaligned on the stack. This was most noticeable in the printf and sprintf functions where a buffer overflow would occur as the misaligned double would try to format a number of over 200 digits.

After numerous tech support emails to IAR and an accidental discovery in one of their manuals, I discovered that the version 5 compiler requires the stack pointer to be 8 byte aligned when a function call is made.

Now as far as I know, FreeRTOS may already align the task stacks to 8 bytes. But I made modifications to the TCB where the registers would be stored there instead of on the task stack when a task switch was made. Apparently these modifications caused the stack to misalign and wreak havoc when I tried to upgrade to version 5.

I've noticed occasional emails to this forum describing a similar problem, so this post may be a solution.

RE: IAR EWARM version 5 stack alignment

Posted by Richard on September 29, 2009
I think this is a duplicate post? In any case I replied to the other copy.


[ 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