Home arrow Support arrow Forums

Luminary Micro Forums

<< Start < Prev 1 2 Next > End >>

sgmcclellan

Fresh Boarder
Click here to see the profile of this user

2006/12/13 20:23

sprintf causes FaultISR to execute

I recently tried to use sprintf in a project for the LM3S811 Eval Kit and found that the sprintf function causes a FaultISR to execute (always in a continuous loop).

My project is the standard hello project with the sprintf sample code from Keil help included at the beginning of main{}. Here is the sample code that I pasted at the beginning of the main{} function:

char buf [100];
int n;
int a,b;
float pi;

a = 123;
b = 456;
pi = 3.14159;

n = sprintf (buf, "%fn", 1.1);
n += sprintf (buf+n, "%dn", a);
n += sprintf (buf+n, "%d %s %g", b, "---", pi);

The hello project works fine without the sprintf sample code and when I paste the code in everything compiles and loads OK. Debugging will show that the first sprintf statement causes the FaultISR to run and that's it, stuck in the FaultISR forever.

What would cause this condition?

login or register to reply

Viktor

Senior Boarder
Click here to see the profile of this user

2006/12/23 10:05

Re:sprintf causes FaultISR to execute

Which compiler do you use ?

login or register to reply

inakiz

Fresh Boarder
Click here to see the profile of this user

2007/01/20 19:03

Re:sprintf causes FaultISR to execute

I have exactly the same problem, and I even know now that the lock up happens after calling sprintf function 373 times exactly!!!.

I'm using Keil,


IDE-Version:
µVision3 V3.33b
Copyright (c) Keil Elektronik GmbH / Keil Software, Inc. 1995 - 2006

License Information:
Inaki Zuloaga
IZI Technology LLC
LIC=----

Tool Version Numbers:
Toolchain Path: C:KeilARMBIN30
C Compiler: ARMCC.Exe V3.0.0.942
Assembler: ARMASM.Exe V3.0.0.942
Linker/Locator: ARMLINK.Exe V3.0.0.942
Librarian: ARMAR.Exe V3.0.0.942
Hex Converter: FROMELF.Exe V3.0.0.942
CPU DLL: SARMCM3.DLL V3.01
Dialog DLL: DLM.DLL V1.00a
Target DLL: BINlmidk-agdi.dll V???
Dialog DLL: TLM.DLL V1.00

login or register to reply

jberezin

Junior Boarder
Click here to see the profile of this user

2007/01/26 14:26

Re:sprintf causes FaultISR to execute

I am having sprintf problems also. Also, I'm looking for alternative methods of converting numeric data types to ascii and am not having any luck finding any in the provided libraries.

login or register to reply

tinroofrusty

Expert Boarder
Click here to see the profile of this user

2007/01/26 17:10

Re:sprintf causes FaultISR to execute

I had the same problem and gave up trying to sort it out! So, I just lifted some itoa code from the web.



Code:

  to use: void test_itoa(void) { char *sptr; int a=123456;     sptr itoa(a,10);     OSRAMStringDraw(sptr,60,1); } static char *ItoaDigits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; /* * ritoa * recursive itoa */ long int ritoa(long int vallong int topvalchar *sint base)     {     long int n val base;     if (0)         topval ritoa(ntopvals+1base);     else         *(s+1) = '';     *ItoaDigitstopval base ];     return(topval base);     } /* * itoa * - calls ritoa to fill in the string for a given base */ char itoa(long int valint base)     {     static char buff[32]; //max # of digits     char *s,*buf;         buf buff;     buf;     if (val 0)         {         *s++ = '-';         val = -val;         };     ritoa(valvalsbase);         return(buf);     }



Not quite printf/sprintf but at least you can output numbers!

login or register to reply

jberezin

Junior Boarder
Click here to see the profile of this user

2007/01/26 17:19

Re:sprintf causes FaultISR to execute

Thanks much.

login or register to reply
<< Start < Prev 1 2 Next > End >>