Re: [avr-gcc-list] sprintf problem
Hello all,The problem I posted here has been rectified by using a dummy malloc, allocating about 10 bytes. This is for information only. Thank you.RegardsNayani P Bring words and photos together (easily) with PhotoMail - it's free and works with Yahoo! Mail.___ AVR-GCC-list mailing list AVR-GCC-list@nongnu.org http://lists.nongnu.org/mailman/listinfo/avr-gcc-list
Re: [avr-gcc-list] sprintf problem
Joerg Wunsch <[EMAIL PROTECTED]> wrote:<[EMAIL PROTECTED]>Are you running out of memory? Seems like the malloc() of theconversion buffer failed.-- Hello,I have checked .data and .bss sizes both put together ocupy 2200 bytes approximately. I have also checked the Stack Pointer by sending its content to serial port. It appears to be OK (not unduly decreasing/increasing). Any suggestions to locate the bug please??? Thank you.RegardsNayani P Bring words and photos together (easily) with PhotoMail - it's free and works with Yahoo! Mail.___ AVR-GCC-list mailing list AVR-GCC-list@nongnu.org http://lists.nongnu.org/mailman/listinfo/avr-gcc-list
Re: [avr-gcc-list] sprintf problem
Parthasaradhi Nayani <[EMAIL PROTECTED]> wrote: > The float converted string is missing. Are you running out of memory? Seems like the malloc() of the conversion buffer failed. -- cheers, J"org .-.-. --... ...-- -.. . DL8DTL http://www.sax.de/~joerg/NIC: JW11-RIPE Never trust an operating system you don't have sources for. ;-) ___ AVR-GCC-list mailing list AVR-GCC-list@nongnu.org http://lists.nongnu.org/mailman/listinfo/avr-gcc-list
Re: [avr-gcc-list] sprintf problem
Hello all,The problem resurfaced after little more code is added to my program. Optimisation is set to s. Sprintf behaves funny with %f. I am giving below sample code and the outputunsigned char buffer[100];sprintf (buffer,"Hello %f hello\n\r", 34.56);send_2_serial (buffer);the output for the first two times is correctHello 34.56 helloBefore every output some other reasonably large calculations are carried Hello 34.56 helloHello hello The float converted string is missing.Could anybody throw some light on why this is happening? Thanks in advance.RegardsNayani POn 1/18/06, Parthasaradhi Nayani <[EMAIL PROTECTED]> wrote:> Hello all,> In one of my projects (ATMega128 based) I am using floating point numbers> and sprintf to write a formatted record to a buffer. Tthe buffer contents is> then sent to a mini printer. The first two records print properly and> thereafter I am getting garbage from sprintf!! The optimisation was set to> 0. When I change the optimisation to s, then correct data is being printed!!> Moreover there is a difference in the way _delay_loop_2 and _delay_loop_1> delays are generated with different optimisations. I would like to know the> reason why this is happening (specially with sprintf) to avoid any pitfalls> in my coding. Thanks in advance. Yahoo! Photos Ring in the New Year with Photo Calendars. Add photos, events, holidays, whatever.___ AVR-GCC-list mailing list AVR-GCC-list@nongnu.org http://lists.nongnu.org/mailman/listinfo/avr-gcc-list
[avr-gcc-list] sprintf problem
Hello all, In one of my projects (ATMega128 based) I am using floating point numbers and sprintf to write a formatted record to a buffer. Tthe buffer contents is then sent to a mini printer. The first two records print properly and thereafter I am getting garbage from sprintf!! The optimisation was set to 0. When I change the optimisation to s, then correct data is being printed!! Moreover there is a difference in the way _delay_loop_2 and _delay_loop_1 delays are generated with different optimisations. I would like to know the reason why this is happening (specially with sprintf) to avoid any pitfalls in my coding. Thanks in advance.Nayani P Yahoo! Photos Showcase holiday pictures in hardcover Photo Books. You design it and well bind it!___ AVR-GCC-list mailing list AVR-GCC-list@nongnu.org http://lists.nongnu.org/mailman/listinfo/avr-gcc-list