* [ECOS] [Fwd: [ECOS] printf and floating point emulation]
@ 2008-04-09 16:58 Eduardo Sabaj
2008-04-09 18:24 ` Andrew Lunn
0 siblings, 1 reply; 6+ messages in thread
From: Eduardo Sabaj @ 2008-04-09 16:58 UTC (permalink / raw)
To: ecos-discuss
I found that the problem is the function vfnprint () located in
vfnprintf.cxx. It calls cvt() and this function calls modf(). This last
function seems to be the problem. This is the code extracted from cvt() :
...
for (p = endp - 1; integer; ++expcnt) {
tmp = modf(integer / 10, &integer);
*p-- = to_char((int)((tmp + .01) * 10));
}
...
This loop never ends!
Am I omiting any patch? Please I need help. If you have any suggestion
write me as soon as you can.
Regards,
Eduardo
-------- Mensaje original --------
Asunto: [ECOS] printf and floating point emulation
Fecha: Tue, 08 Apr 2008 16:55:09 -0300
De: Eduardo Sabaj <esabaj@hasar.com>
Para: ecos-discuss@ecos.sourceware.org
I have a program that hangs when trying to format and print something
like this:
void
func (float f)
{
printf ("%.2f\n", f);
}
I don't have an FPU builtin hardware.
The CPPFLAGS and LDFLAGS include the following options:
-msoft-float -mno-fp-ret-in-387 -mno-fancy-math-387
I disabled the FPU support (macro CYGHWR_HAL_I386_FPU) and I enabled
CYGSEM_LIBC_STDIO_PRINTF_FLOATING_POINT and
CYGSEM_LIBC_STDIO_SCANF_FLOATING_POINT macros.
I'm running ecos-2.0 (the last version available in CVS).
Please, I cannot realize what I'm omiting.. Any idea?
--
Ing. Eduardo Salvador Sabaj
Analista de Desarrollo
CompañÃa Hasar | Grupo Hasar*
*Marcos Sastre y José Ingenieros
El Talar. Pacheco
[B1618CSD] Buenos Aires. Argentina
Tel [54 11] 4117 8900 | Fax [54 11] 4117 8998
E-mail: esabaj@hasar.com
VisÃtenos en: www.hasar.com
<http://www.hasar.com>Información legal y polÃtica de confidencialidad:
www.grupohasar.com/disclaimer <http://www.grupohasar.com/disclaimer>
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
<http://www.grupohasar.com/disclaimer>
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [ECOS] [Fwd: [ECOS] printf and floating point emulation]
2008-04-09 16:58 [ECOS] [Fwd: [ECOS] printf and floating point emulation] Eduardo Sabaj
@ 2008-04-09 18:24 ` Andrew Lunn
2008-04-09 18:46 ` Eduardo Sabaj
0 siblings, 1 reply; 6+ messages in thread
From: Andrew Lunn @ 2008-04-09 18:24 UTC (permalink / raw)
To: Eduardo Sabaj; +Cc: ecos-discuss
On Wed, Apr 09, 2008 at 01:04:03PM -0300, Eduardo Sabaj wrote:
> I found that the problem is the function vfnprint () located in
> vfnprintf.cxx. It calls cvt() and this function calls modf(). This last
> function seems to be the problem. This is the code extracted from cvt() :
> ...
> for (p = endp - 1; integer; ++expcnt) {
> tmp = modf(integer / 10, &integer);
> *p-- = to_char((int)((tmp + .01) * 10));
> }
> ...
>
> This loop never ends!
>
> Am I omiting any patch? Please I need help. If you have any suggestion
> write me as soon as you can.
> Regards,
> Eduardo
Can you give a concrete example. Something like
main()
{
printf("%.2f\n, 3.141539);
}
which causes the problem. Does the value being printed matter?
What happens when you run the test program
packages/language/c/libc/stdio/current/tests/sprintf1.c
Thanks
Andrew
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [ECOS] [Fwd: [ECOS] printf and floating point emulation]
2008-04-09 18:24 ` Andrew Lunn
@ 2008-04-09 18:46 ` Eduardo Sabaj
2008-04-10 6:12 ` Andrew Lunn
0 siblings, 1 reply; 6+ messages in thread
From: Eduardo Sabaj @ 2008-04-09 18:46 UTC (permalink / raw)
To: Andrew Lunn, ecos-discuss
Andrew, the program fails with the printing of any floating point
number. Anyway, what I'm printing is :
printf ("main: %f\n", 2.345);
The lines below were produced by the test program in:
packages/language/c/libc/stdio/current/tests/sprintf1.c
When the program reaches the first line with a %f format it hangs:
// Check 18
ret = sprintf(x, "%f", 2.5);
By the way, I downloaded the latest eCos version with the following command:
cvs -z3 -d :pserver:anoncvs@ecos.sourceware.org:/cvs/ecos co -P ecos
Any idea?
Regards,
Eduardo
----
INFO:<Starting tests from testcase sprintf1.c for C library sprintf()
function>
INFO:<These test individual features separately>
PASS:<%d test>
PASS:<%d test return code>
PASS:<%s test>
PASS:<%s test return code>
PASS:<padding test>
PASS:<padding test return code>
PASS:<hex conversion (lowercase)>
PASS:<hex conv (lowercase) return code>
PASS:<hex conversion (uppercase)>
PASS:<hex conv (upperbase ) return code>
PASS:<%c test>
PASS:<%c test return code>
PASS:<octal conversion>
PASS:<octal conversion return code>
PASS:<%u test>
PASS:<%u test return code>
PASS:<%n test>
PASS:<%n test return code>
PASS:<%% test>
PASS:<%% test return code>
PASS:<%ld test>
PASS:<%ld test return code>
PASS:<%lu test>
PASS:<%lu test return code>
PASS:<%x test>
PASS:<%x test return code>
PASS:<%X test>
PASS:<%x test return code>
PASS:<%0x test>
PASS:<%0x test return code>
PASS:<%0X test>
PASS:<%0X test return code>
PASS:<%p test return code>
INFO:<Starting floating point specific tests>
----
Andrew Lunn escribió:
> On Wed, Apr 09, 2008 at 01:04:03PM -0300, Eduardo Sabaj wrote:
>
>> I found that the problem is the function vfnprint () located in
>> vfnprintf.cxx. It calls cvt() and this function calls modf(). This last
>> function seems to be the problem. This is the code extracted from cvt() :
>> ...
>> for (p = endp - 1; integer; ++expcnt) {
>> tmp = modf(integer / 10, &integer);
>> *p-- = to_char((int)((tmp + .01) * 10));
>> }
>> ...
>>
>> This loop never ends!
>>
>> Am I omiting any patch? Please I need help. If you have any suggestion
>> write me as soon as you can.
>> Regards,
>> Eduardo
>>
>
> Can you give a concrete example. Something like
>
> main()
> {
> printf("%.2f\n, 3.141539);
> }
>
> which causes the problem. Does the value being printed matter?
>
> What happens when you run the test program
> packages/language/c/libc/stdio/current/tests/sprintf1.c
>
> Thanks
> Andrew
>
>
--
Ing. Eduardo Salvador Sabaj
Analista de Desarrollo
CompañÃa Hasar | Grupo Hasar*
*Marcos Sastre y José Ingenieros
El Talar. Pacheco
[B1618CSD] Buenos Aires. Argentina
Tel [54 11] 4117 8900 | Fax [54 11] 4117 8998
E-mail: esabaj@hasar.com
VisÃtenos en: www.hasar.com
<http://www.hasar.com>Información legal y polÃtica de confidencialidad:
www.grupohasar.com/disclaimer <http://www.grupohasar.com/disclaimer>
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [ECOS] [Fwd: [ECOS] printf and floating point emulation]
2008-04-09 18:46 ` Eduardo Sabaj
@ 2008-04-10 6:12 ` Andrew Lunn
2008-04-10 14:42 ` Eduardo Sabaj
[not found] ` <47FE1CCC.2070001@hasar.com>
0 siblings, 2 replies; 6+ messages in thread
From: Andrew Lunn @ 2008-04-10 6:12 UTC (permalink / raw)
To: Eduardo Sabaj; +Cc: Andrew Lunn, ecos-discuss
On Wed, Apr 09, 2008 at 03:17:42PM -0300, Eduardo Sabaj wrote:
> Andrew, the program fails with the printing of any floating point
> number. Anyway, what I'm printing is :
>
> printf ("main: %f\n", 2.345);
>
> The lines below were produced by the test program in:
>
> packages/language/c/libc/stdio/current/tests/sprintf1.c
>
> When the program reaches the first line with a %f format it hangs:
>
> // Check 18
> ret = sprintf(x, "%f", 2.5);
What toolchain are you using? Is it the eCos one from
http://ecos.sourceware.org/getstart.html
Andrew
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [ECOS] [Fwd: [ECOS] printf and floating point emulation]
2008-04-10 6:12 ` Andrew Lunn
@ 2008-04-10 14:42 ` Eduardo Sabaj
[not found] ` <47FE1CCC.2070001@hasar.com>
1 sibling, 0 replies; 6+ messages in thread
From: Eduardo Sabaj @ 2008-04-10 14:42 UTC (permalink / raw)
To: Andrew Lunn, ecos-discuss
I'm working with one of the pre-built toolchains for Intel x386 which
I've downloaded some years ago. Anyway, yesterday I downloaded this same
toolchain from http://ecos.sourceware.org/getstart.html.
I executed:
wget --passive-ftp
ftp://ecos.sourceware.org/pub/ecos/ecos-install.tcl
sh ecos-install.tcl
Then I compiled sprintf1.c with this new environment and the result is
the same. The program crashes with the first line with %f format.
Eduardo
Andrew Lunn escribió:
> On Wed, Apr 09, 2008 at 03:17:42PM -0300, Eduardo Sabaj wrote:
>
>> Andrew, the program fails with the printing of any floating point
>> number. Anyway, what I'm printing is :
>>
>> printf ("main: %f\n", 2.345);
>>
>> The lines below were produced by the test program in:
>>
>> packages/language/c/libc/stdio/current/tests/sprintf1.c
>>
>> When the program reaches the first line with a %f format it hangs:
>>
>> // Check 18
>> ret = sprintf(x, "%f", 2.5);
>>
>
> What toolchain are you using? Is it the eCos one from
> http://ecos.sourceware.org/getstart.html
>
> Andrew
>
>
--
Ing. Eduardo Salvador Sabaj
Analista de Desarrollo
CompañÃa Hasar | Grupo Hasar*
*Marcos Sastre y José Ingenieros
El Talar. Pacheco
[B1618CSD] Buenos Aires. Argentina
Tel [54 11] 4117 8900 | Fax [54 11] 4117 8998
E-mail: esabaj@hasar.com
VisÃtenos en: www.hasar.com
<http://www.hasar.com>Información legal y polÃtica de confidencialidad:
www.grupohasar.com/disclaimer <http://www.grupohasar.com/disclaimer>
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [ECOS] [Fwd: [ECOS] printf and floating point emulation]
[not found] ` <47FE1CCC.2070001@hasar.com>
@ 2008-04-10 19:07 ` Andrew Lunn
0 siblings, 0 replies; 6+ messages in thread
From: Andrew Lunn @ 2008-04-10 19:07 UTC (permalink / raw)
To: Eduardo Sabaj; +Cc: ecos-discuss
On Thu, Apr 10, 2008 at 10:57:32AM -0300, Eduardo Sabaj wrote:
> I'm working with one of the pre-built toolchains for Intel x386 which
> I've downloaded some years ago. Anyway, yesterday I downloaded this same
> toolchain from http://ecos.sourceware.org/getstart.html.
>
> I executed:
>
> wget --passive-ftp
> ftp://ecos.sourceware.org/pub/ecos/ecos-install.tcl
> sh ecos-install.tcl
>
> Then I compiled sprintf1.c with this new environment and the result is
> the same. The program crashes with the first line with %f format.
Humm. The only ideas i have are
1) Disassemble the code and see if it is still using the FPU.
2) Make sure your libgcc1.a was build with the same flags as eCos. This
library from the tool chain must also not use the FPU.
Andrew
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2008-04-10 14:42 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-09 16:58 [ECOS] [Fwd: [ECOS] printf and floating point emulation] Eduardo Sabaj
2008-04-09 18:24 ` Andrew Lunn
2008-04-09 18:46 ` Eduardo Sabaj
2008-04-10 6:12 ` Andrew Lunn
2008-04-10 14:42 ` Eduardo Sabaj
[not found] ` <47FE1CCC.2070001@hasar.com>
2008-04-10 19:07 ` Andrew Lunn
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).