Home arrow Support arrow Forums

Luminary Micro Forums

tma

Senior Boarder

2006/12/05 12:01

RV3_sprintf(str,"%f",x) _ftoa Crashes

Greetings Folks:

For those of you that might have been following the previous itoa conversion topic I decided to post this as a new topic as sprintf seems to work fine for me with 'long' integers

I am now trying to learn how to do float to string conversions with my LM3S811EV and the Keil RV3 C compiler. My test code block is as follows:

if (!g_Urt0TxBzy_ui8)
{
char l_Str[]="123456789012345678901234567890";
float x=123.456;
sprintf(l_Str,"%f",x);
strcat(l_Str, "nr");//add end of line
Uart0Send(l_Str);
}

I find that when I try to execute the above 'sprinf' statement my ev crashes and ends up at the MPU fault ISR vector. Although I have printed out the Cortex M3 Technical Manual I have not yet learned how to determine the exact cause of the crash.

I wonder if anyone else in this forum has been able to get the RV3 sprintf statement to work on an LM3S811?

Thanks in advance for any suggestions!

login or register to reply

Viktor

Senior Boarder

2006/12/13 03:21

Re:RV3_sprintf(str,"%f",x) _ftoa Crashes

try this:
http://www.keil.com/support/sfdl.asp?k=rpodqwpf11ro3e295g20g11brd&f=mdk303g.exe

login or register to reply

tma

Senior Boarder

2006/12/13 14:10

Re:RV3_sprintf(str,"%f",x) _ftoa Crashes

Greetings Victor:

Many thanks for the link! Unfortunately my access to the MDK303g.exe download seems to be blocked. Possibly one needs advanced Keil user status to access it. I wonder if the new version generates revised coded for the Luminary family?

I have written a rather simple, limited range function to do what I need. It first converts the float to integer then the integer to ASCII with two decimal point resolution. If anyone is interested I will post it here.

However it would be nice to be able to obtain a new version of the Keil ARM compiler if available to trial version users.

login or register to reply

Viktor

Senior Boarder

2006/12/13 15:47

Re:RV3_sprintf(str,"%f",x) _ftoa Crashes

There is no special access to download the file. I had problems with floating point arithmetic operations with version 3.03a. With the latest 3.03g got no problem. Your issue may be in floating point operations too.

Even in versio 3.03a the problem occurs only in simulation. When debugging in a real device it's all fine.

Post edited by: viktor, at: 2006/12/14 08:57

login or register to reply