public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
* ARM GNU Toolchain 13.2Rel1 newlib issue with sprintf and floating point
@ 2024-05-03  6:11 Ernesto Vigano'
  2024-05-03  7:22 ` Christophe Lyon
  0 siblings, 1 reply; 5+ messages in thread
From: Ernesto Vigano' @ 2024-05-03  6:11 UTC (permalink / raw)
  To: newlib

[-- Attachment #1: Type: text/plain, Size: 1030 bytes --]

I need to use sprintf with floating point numbers (%f format specifier) in
a project based on rpmsg_lite_str_echo_rtos on the cortex-M (NXP Processor).
I use the recommended
arm-gnu-toolchain-12.3.rel1-mingw-w64-i686-arm-none-eabi
I see that when I call

sprintf(str, "%d" 3);

the number 3 is printed to the string str.

But if I have a floating point number and I use "%f" format specifier

sprintf(str, "%f" 3.5);

I get
ASSERT ERROR " Balloc succeeded ": file
"/data/jenkins/workspace/GNU-toolchain/arm-12/src/newlib-cygwin/newlib/libc/stdlib/mprec.c"
Line "783" function name ""

It seems similar to this error
forum.pjrc.com/index.php
<https://forum.pjrc.com/index.php?threads/strange-compiling-problem-assertion-balloc-succeeded-failed-file-data-jenkins-w.72798/>
that points to this fix
github.com/.../f88aece242178ff0c187d56e34a79645fbc44a23
<https://github.com/zephyrproject-rtos/newlib-cygwin/commit/f88aece242178ff0c187d56e34a79645fbc44a23>

Is there a way to have sprintf working with floating point numbers?

Thanks

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: ARM GNU Toolchain 13.2Rel1 newlib issue with sprintf and floating point
  2024-05-03  6:11 ARM GNU Toolchain 13.2Rel1 newlib issue with sprintf and floating point Ernesto Vigano'
@ 2024-05-03  7:22 ` Christophe Lyon
  2024-05-03 17:04   ` Ernesto Vigano'
  0 siblings, 1 reply; 5+ messages in thread
From: Christophe Lyon @ 2024-05-03  7:22 UTC (permalink / raw)
  To: Ernesto Vigano', newlib

Hi,



On 5/3/24 08:11, Ernesto Vigano' wrote:
> I need to use sprintf with floating point numbers (%f format specifier) 
> in a project based on rpmsg_lite_str_echo_rtos on the cortex-M (NXP 
> Processor).
> I use the recommended 
> arm-gnu-toolchain-12.3.rel1-mingw-w64-i686-arm-none-eabi
> I see that when I call
> 
> sprintf(str, "%d" 3);
> 
> the number 3 is printed to the string str.
> 
> But if I have a floating point number and I use "%f" format specifier
> 
> sprintf(str, "%f" 3.5);

Is this a copy/paste error, or did you forget the ',' before the number 
you want to print?

Thanks,

Christophe

> 
> I get
> ASSERT ERROR " Balloc succeeded ": file 
> "/data/jenkins/workspace/GNU-toolchain/arm-12/src/newlib-cygwin/newlib/libc/stdlib/mprec.c" Line "783" function name ""
> 
> It seems similar to this error
> forum.pjrc.com/index.php 
> <https://forum.pjrc.com/index.php?threads/strange-compiling-problem-assertion-balloc-succeeded-failed-file-data-jenkins-w.72798/>
> that points to this fix
> github.com/.../f88aece242178ff0c187d56e34a79645fbc44a23 
> <https://github.com/zephyrproject-rtos/newlib-cygwin/commit/f88aece242178ff0c187d56e34a79645fbc44a23>
> 
> Is there a way to have sprintf working with floating point numbers?
> 
> Thanks

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: ARM GNU Toolchain 13.2Rel1 newlib issue with sprintf and floating point
  2024-05-03  7:22 ` Christophe Lyon
@ 2024-05-03 17:04   ` Ernesto Vigano'
  2024-05-03 17:45     ` Dave Nadler
  0 siblings, 1 reply; 5+ messages in thread
From: Ernesto Vigano' @ 2024-05-03 17:04 UTC (permalink / raw)
  To: Christophe Lyon; +Cc: newlib

[-- Attachment #1: Type: text/plain, Size: 1470 bytes --]

It's a copy-paste error.
The syntax is the right one

Il ven 3 mag 2024, 09:22 Christophe Lyon <christophe.lyon@arm.com> ha
scritto:

> Hi,
>
>
>
> On 5/3/24 08:11, Ernesto Vigano' wrote:
> > I need to use sprintf with floating point numbers (%f format specifier)
> > in a project based on rpmsg_lite_str_echo_rtos on the cortex-M (NXP
> > Processor).
> > I use the recommended
> > arm-gnu-toolchain-12.3.rel1-mingw-w64-i686-arm-none-eabi
> > I see that when I call
> >
> > sprintf(str, "%d" 3);
> >
> > the number 3 is printed to the string str.
> >
> > But if I have a floating point number and I use "%f" format specifier
> >
> > sprintf(str, "%f" 3.5);
>
> Is this a copy/paste error, or did you forget the ',' before the number
> you want to print?
>
> Thanks,
>
> Christophe
>
> >
> > I get
> > ASSERT ERROR " Balloc succeeded ": file
> >
> "/data/jenkins/workspace/GNU-toolchain/arm-12/src/newlib-cygwin/newlib/libc/stdlib/mprec.c"
> Line "783" function name ""
> >
> > It seems similar to this error
> > forum.pjrc.com/index.php
> > <
> https://forum.pjrc.com/index.php?threads/strange-compiling-problem-assertion-balloc-succeeded-failed-file-data-jenkins-w.72798/
> >
> > that points to this fix
> > github.com/.../f88aece242178ff0c187d56e34a79645fbc44a23
> > <
> https://github.com/zephyrproject-rtos/newlib-cygwin/commit/f88aece242178ff0c187d56e34a79645fbc44a23
> >
> >
> > Is there a way to have sprintf working with floating point numbers?
> >
> > Thanks
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: ARM GNU Toolchain 13.2Rel1 newlib issue with sprintf and floating point
  2024-05-03 17:04   ` Ernesto Vigano'
@ 2024-05-03 17:45     ` Dave Nadler
  2024-05-03 17:46       ` Ernesto Vigano'
  0 siblings, 1 reply; 5+ messages in thread
From: Dave Nadler @ 2024-05-03 17:45 UTC (permalink / raw)
  To: Ernesto Vigano', Christophe Lyon; +Cc: newlib

[-- Attachment #1: Type: text/plain, Size: 2145 bytes --]

Hi Ernesto- If you are not using FreeRTOS ignore this.
If you are: Perhaps you have not got a correct sbrk setup.
Many FreeRTOS demos from NXP and ST have this problem.
See https://nadler.com/embedded/NXP_newlibAndFreeRTOS.html
Hope that helps!
Best Regards, Dave

On 5/3/2024 1:04 PM, Ernesto Vigano' wrote:
> It's a copy-paste error.
> The syntax is the right one
>
> Il ven 3 mag 2024, 09:22 Christophe Lyon <christophe.lyon@arm.com> ha 
> scritto:
>
>     Hi,
>
>     On 5/3/24 08:11, Ernesto Vigano' wrote:
>     > I need to use sprintf with floating point numbers (%f format
>     specifier)
>     > in a project based on rpmsg_lite_str_echo_rtos on the cortex-M (NXP
>     > Processor).
>     > I use the recommended
>     > arm-gnu-toolchain-12.3.rel1-mingw-w64-i686-arm-none-eabi
>     > I see that when I call
>     >
>     > sprintf(str, "%d" 3);
>     >
>     > the number 3 is printed to the string str.
>     >
>     > But if I have a floating point number and I use "%f" format
>     specifier
>     >
>     > sprintf(str, "%f" 3.5);
>
>     Is this a copy/paste error, or did you forget the ',' before the
>     number
>     you want to print?
>
>     Thanks,
>     Christophe
>
>     >
>     > I get
>     > ASSERT ERROR " Balloc succeeded ": file
>     >
>     "/data/jenkins/workspace/GNU-toolchain/arm-12/src/newlib-cygwin/newlib/libc/stdlib/mprec.c"
>     Line "783" function name ""
>     >
>     > It seems similar to this error
>     > forum.pjrc.com/index.php <http://forum.pjrc.com/index.php>
>     >
>     <https://forum.pjrc.com/index.php?threads/strange-compiling-problem-assertion-balloc-succeeded-failed-file-data-jenkins-w.72798/>
>     > that points to this fix
>     > github.com/.../f88aece242178ff0c187d56e34a79645fbc44a23
>     <http://github.com/.../f88aece242178ff0c187d56e34a79645fbc44a23>
>     >
>     <https://github.com/zephyrproject-rtos/newlib-cygwin/commit/f88aece242178ff0c187d56e34a79645fbc44a23>
>     >
>     > Is there a way to have sprintf working with floating point numbers?
>     >
>     > Thanks
>
-- 
Dave Nadler, USA East Coast voice (978) 263-0097,drn@nadler.com, Skype
  Dave.Nadler1

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: ARM GNU Toolchain 13.2Rel1 newlib issue with sprintf and floating point
  2024-05-03 17:45     ` Dave Nadler
@ 2024-05-03 17:46       ` Ernesto Vigano'
  0 siblings, 0 replies; 5+ messages in thread
From: Ernesto Vigano' @ 2024-05-03 17:46 UTC (permalink / raw)
  To: Dave Nadler; +Cc: Christophe Lyon, newlib

[-- Attachment #1: Type: text/plain, Size: 2086 bytes --]

Ho Dave,
I use FreeRTOS.
I'm going to verify and I let you know

Thanks


Il ven 3 mag 2024, 19:45 Dave Nadler <drn@nadler.com> ha scritto:

> Hi Ernesto- If you are not using FreeRTOS ignore this.
> If you are: Perhaps you have not got a correct sbrk setup.
> Many FreeRTOS demos from NXP and ST have this problem.
> See https://nadler.com/embedded/NXP_newlibAndFreeRTOS.html
> Hope that helps!
> Best Regards, Dave
>
> On 5/3/2024 1:04 PM, Ernesto Vigano' wrote:
>
> It's a copy-paste error.
> The syntax is the right one
>
> Il ven 3 mag 2024, 09:22 Christophe Lyon <christophe.lyon@arm.com> ha
> scritto:
>
>> Hi,
>>
>> On 5/3/24 08:11, Ernesto Vigano' wrote:
>> > I need to use sprintf with floating point numbers (%f format specifier)
>> > in a project based on rpmsg_lite_str_echo_rtos on the cortex-M (NXP
>> > Processor).
>> > I use the recommended
>> > arm-gnu-toolchain-12.3.rel1-mingw-w64-i686-arm-none-eabi
>> > I see that when I call
>> >
>> > sprintf(str, "%d" 3);
>> >
>> > the number 3 is printed to the string str.
>> >
>> > But if I have a floating point number and I use "%f" format specifier
>> >
>> > sprintf(str, "%f" 3.5);
>>
>> Is this a copy/paste error, or did you forget the ',' before the number
>> you want to print?
>>
>> Thanks,
>> Christophe
>>
>> >
>> > I get
>> > ASSERT ERROR " Balloc succeeded ": file
>> >
>> "/data/jenkins/workspace/GNU-toolchain/arm-12/src/newlib-cygwin/newlib/libc/stdlib/mprec.c"
>> Line "783" function name ""
>> >
>> > It seems similar to this error
>> > forum.pjrc.com/index.php
>> > <
>> https://forum.pjrc.com/index.php?threads/strange-compiling-problem-assertion-balloc-succeeded-failed-file-data-jenkins-w.72798/
>> >
>> > that points to this fix
>> > github.com/.../f88aece242178ff0c187d56e34a79645fbc44a23
>> > <
>> https://github.com/zephyrproject-rtos/newlib-cygwin/commit/f88aece242178ff0c187d56e34a79645fbc44a23
>> >
>> >
>> > Is there a way to have sprintf working with floating point numbers?
>> >
>> > Thanks
>>
> --
> Dave Nadler, USA East Coast voice (978) 263-0097, drn@nadler.com, Skype
>  Dave.Nadler1
>
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-05-03 17:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-03  6:11 ARM GNU Toolchain 13.2Rel1 newlib issue with sprintf and floating point Ernesto Vigano'
2024-05-03  7:22 ` Christophe Lyon
2024-05-03 17:04   ` Ernesto Vigano'
2024-05-03 17:45     ` Dave Nadler
2024-05-03 17:46       ` Ernesto Vigano'

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).