Atmel website | ARM Community | AVR freaks | Technical Support
Banner
 FAQ •  Search •  Register •  Login 

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: sprtinf behaviour not as expected
PostPosted: Tue Jun 29, 2010 8:59 am 
Offline

Joined: Tue Apr 22, 2008 4:32 pm
Posts: 3
Location: Germany
Hi together,

My system:
CPU: AT91SAM7SE32 with external flash memory and external SRAM
Compiler: RVDS 2.2 with IDE Metrowerks CodeWarrior 5.1.6.1832

I'm lookin for help after a long search:

I'd like to print float-variables into a char-Buffer (array of char's). But the behaviour is not correct what I do is the following:

char Testbuffer[20]={0};
float minizahl=123.456;
float sinizahl=0.789;

unsigned int asdfasdf= isdigit('1');setlocale(LC_ALL,"C");
//asdfasdf contains 1 (dec)
sprintf(Testbuffer, "%f",minizahl);
//Testbuffer contains "0.000000"
memset(Testbuffer, 0, sizeof(Testbuffer));
//Testbuffer contains only zero (dec)
setlocale(LC_ALL,"C");
sprintf(Testbuffer, "%f",sinizahl);
//Testbuffer contains unexpected data:-268156222443479670000000000000000000000000000000000000000000000000000000 => system crashes!

At startup I'm calling:
__rt_stackheap_init();
__rt_lib_init();

libspace (ZI-Data at the of my Data-Segment) contains zero before "__rt_stackheap_init();" and has data after "__rt_stackheap_init();" after "__rt_lib_init();" the data has changed again. Is that correct? Are there any further library or compiler switches that I have to do?

In the source tree of the project settings I already entered the name "RVCT22LIB" with the Absolute Path to installation directory\ARM\RVCT\Data\2.2\503\lib

Has anybody any ideas?

Greets Volkiman


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: