Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 15:57 Go to next message
Benoît Bousquet is currently offline Benoît BousquetFriend
Messages: 3
Registered: March 2020
Junior Member
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 16:05]

Report message to a moderator

Re: float type works with Keil but not with Eclipse [message #1822990 is a reply to message #1822984] Tue, 17 March 2020 16:42 Go to previous messageGo to next message
Tauno Voipio is currently offline Tauno VoipioFriend
Messages: 742
Registered: August 2014
Senior Member
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.


--

Tauno Voipio
Re: float type works with Keil but not with Eclipse [message #1823021 is a reply to message #1822990] Wed, 18 March 2020 09:39 Go to previous messageGo to next message
Benoît Bousquet is currently offline Benoît BousquetFriend
Messages: 3
Registered: March 2020
Junior Member
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 10:33 Go to previous message
Miquel Delgado is currently offline Miquel DelgadoFriend
Messages: 1
Registered: June 2020
Junior Member
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: Wed Apr 24 23:56:35 GMT 2024

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

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

Back to the top