FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [March 2009 Threads] Keil - floating point supportPosted by Konrad Heksel on March 16, 2009 Hi, I have problem with floating point formatting of sprintf function. Integer formatting works fine. Is there something rtos specific, I should setup? Thanks for any clue. Konrad
RE: Keil - floating point supportPosted by MEdwards on March 16, 2009 Are you saying it only doesn't work when you are using the RTOS? So in a small non RTOS APP the floating point formatting does work?
RE: Keil - floating point supportPosted by Konrad Heksel on March 17, 2009 It looks like... The following line of code works with non-rtos version of application.
sprintf(CommonBuffer,"I =%5.2fA Delta =%4.1f%%\n", (float)current/100, (float)CalcDeviation(current)/10);
In rtos version of appplication formatting itself look ok, but values of formatted variables are not right (usually zeros).
Keil 3.40, FreeRTOS 5.1.2, LPC2388
Regards, Konrad
RE: Keil - floating point supportPosted by Forest YU on March 17, 2009 May be it is because the sprintf() function is reenterable. I just guess.
Regards
RE: Keil - floating point supportPosted by David Gesswein on March 18, 2009 I had a similar problem with floating point on the FreeRTOS Luminary Stellaris demo. The problem is the float is passed in as a 64 bit double and the ARM requires it to be aligned to 64 bits. The demo set the stack up 32 bit aligned. The changes I made to 4.7.2? using GCC were
FreeRTOS/Demo/CORTEX_LM3Sxxxx_Eclipse/RTOSDemo/startup.c added the attribute to stack declaration to force 64 bit alignment static unsigned long __attribute__ ((aligned (8))) pulStack[STACK_SIZE];
FreeRTOS/Source/portable/GCC/ARM_CM3/portmacro.h changed to #define portBYTE_ALIGNMENT 8
(I also had to add floating point printing to the supplied printf)
RE: Keil - floating point supportPosted by Konrad Heksel on March 18, 2009 Hi, This is the point. The problem is with passing 64 bit variable as function parameter in Task. When, during debugging, I changed appropriately SP the sprintf function started working correctly.
I tried to setup my Keil project similarly, but unfortunately without success. I appreciate any hints. Konrad
RE: Keil - floating point supportPosted by Konrad Heksel on March 18, 2009 Hi, I managed it running under heap_2 memory model. The modifications should be exactly like "dig" suggested. For Keil it is:
#define portBYTE_ALIGNMENT 8 in portmacro.h
__align(8) static struct xRTOS_HEAP { unsigned portLONG ulDummy; unsigned portCHAR ucHeap[ configTOTAL_HEAP_SIZE ]; } xHeap; in heap_2.c
I am still confused in heap_3 memory model for which the problem still exists. I checked. Configuration of heap in Startup.s file is 8 bytes aligned. So why it does not work in this case?
konrad
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|