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

Issue with sprintf in STR9 IAR project

Posted by soufien on January 24, 2013
I have an issue where sprintf sometimes printing an unexpected string. The call: sprintf(str_my_string, "%#.1f", 0.0); is made from inside a function called from a task. Most of the time, the expected string is printed (0.0) and it only occurs every minute or two. This issue started occurring after adding the FreeRTos to our existing project and has never happened before. What might cause this issue? How should I go about troubleshooting this?
Thanks for you help

RE: Issue with sprintf in STR9 IAR project

Posted by MEdwards on January 24, 2013
http://www.freertos.org/FreeRTOS_Support_Forum_Archive/January_2013/freertos_sprintf_breaking_under_new_FreeRTOS_6647463.html

RE: Issue with sprintf in STR9 IAR project

Posted by soufien on January 25, 2013
I did some more troubleshooting and found that it only occurs when I have a 1ms timer interrupt enabled and that if I let the same code run in a while loop, it happens so often (seems to be more than 2 times a second). Then, I switched from the version that we are using V5.0.2 to the newer version V7.3.0 and it works fine so far.
I am still not sure what caused the issue but I am starting to think that it has to do with saving and restoring the context although the save/restore context assembly macros of the two versions are the same.
I am still concerned that somehow the new version is masking other problems somewhere else.
I will keep working on it.

RE: Issue with sprintf in STR9 IAR project

Posted by soufien on January 25, 2013
Problem solved!!! It was caused by a bug in version V5.0.2 that was not handling memory alignment properly in xCreateTask function. Version V7.3.0 works.
V5.0.2 create task function does this:
pxTopOfStack = pxNewTCB->pxStack + ( usStackDepth - ( unsigned short ) 1 );
It should also do this:
pxTopOfStack = ( portSTACK_TYPE * ) ( ( ( portPOINTER_SIZE_TYPE ) pxTopOfStack ) & ( ( portPOINTER_SIZE_TYPE ) ~portBYTE_ALIGNMENT_MASK ) );


[ 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