Skip to main content



      Home
Home » Language IDEs » C / C++ IDE (CDT) » float type works with Keil but not with Eclipse(float type works with Keil but not with Eclipse)
float type works with Keil but not with Eclipse [message #1822984] Tue, 17 March 2020 11:57 Go to next message
Eclipse UserFriend
Hi all,

As said in the title I am facing quite curious (maybe not so) behavior. While my program works fine when compiled with Keil, float variables behave strangely when the same code is compiled with gcc.

In my code, I printf the float variables : When compiled with Keil, it gives me the right values (i.e : "float value = 0.15" but with gcc, the printf returns blank stuff like : "float value =")

Does anyone encountered the issue? Is it a matter of type definition? Compiler options?

Thank you for your help

Regards

[Updated on: Tue, 17 March 2020 12:05] by Moderator

Re: float type works with Keil but not with Eclipse [message #1822990 is a reply to message #1822984] Tue, 17 March 2020 12:42 Go to previous messageGo to next message
Eclipse UserFriend
The question is actually off-topic for Eclipse. The phenomena are pretty surely there even when using the compilers from the command line.

You have not given any useful details, but let's guess:

The reference to Keil suggests that you're cross-compiling to an ARM processor.
My experience from both ARM7TDMI and Cortex-M have shown that misbehaving floats were due to incorrect start-up code and/or incorrect linker scripts.
Re: float type works with Keil but not with Eclipse [message #1823021 is a reply to message #1822990] Wed, 18 March 2020 05:39 Go to previous messageGo to next message
Eclipse UserFriend
Tauno Voipio wrote on Tue, 17 March 2020 16:42
The question is actually off-topic for Eclipse.


You are right, my bad. I guess the majority of people using gcc is doing it through Eclipse? You are right about cross compilation, thank you for the guess.
Actually, I found the answer is that it was the printf function which was not working properly. Keil uses microlib library while gcc uses nano.specs, and nano.specs deosn't includes same printf functions. The command -u_printf_float is needed. Problem solved, thank you!
Re: float type works with Keil but not with Eclipse [message #1828563 is a reply to message #1823021] Fri, 12 June 2020 06:33 Go to previous message
Eclipse UserFriend
Hi,

I am using Eclipse and I'm having the same problem. Could you explain me how did you resolved it? I don't understand what do you refer about using command -u_printf_float.

Thanks in advance,


Miquel
Previous Topic:Code block editing
Next Topic:So I've updated to 2019-12...
Goto Forum:
  


Current Time: Sun Jul 13 14:47:51 EDT 2025

Powered by FUDForum. Page generated in 0.03224 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top