Quality RTOS & Embedded Software

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


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 ]    [ 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.

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

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.


Careers

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

Renesas

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