Jump to content

ChibiOS/STM32F429Discovery demo: float not working


Recommended Posts

Posted

Hello,

I'm using the ChibiOS/STM32F429Discovery demo and wanted to start using float datatype together with math.h functions (therefore I added -lm the the options in the makefile).

In the uGFX demo (based on ChibiOS 17.6) I have the following problems:

If I set USE_FPU=hard, the software traps immediately (I have no debugger, but I think it doesn't even reach main()).

If I set USE_FPU=no or USE_FPU=softfp, the software starts but it traps as soon as I call a float math lib function like powf().

 

So I downloaded a plain ChibiOS 17.6.4 without uGFX and put the same test calculations into main().

It works fine with USE_FPU=no or USE_FPU=softfp

If I set USE_FPU=hard, the software starts but it traps as soon as I call a float math lib function like powf().

 

In the uGFX STM32F429Discovery demo, are the any FPU specific changes? Different startup code (which is needed to enable hard FPU) or anything else?

 

I'd like to use float, preferred solution is hardware FPU, but soft float would also help a lot.

 

Thanks, Tobias

Posted

With the pure ChibiOS (no uGFX) and USE_FP=hard it traps when you call powf (). This indicates you have a problem with either your compiler, the compiler options, or your C runtime library. You need to solve this first and this problem is independent of uGFX. Only once that is working is it worth adding uGFX into the mix.

Posted

Ok thanks for answering.

You're right, hard float should work with pure Chibi before switching to uGFX. I will analyse that.

However, as far as I understood, also USE_FPU=softfp will use the hardware floating point unit, it's only a difference in calling convention!? I need to take a closer look.

Thanks so far,

Tobias

 

Bye the way, just to give some positive feedback as well - it's really cool stuff what you can do with uGFX. A complete window manager with a lot of widgets, even tabs, touch input elements. It's easy to use those elements, since there is a good documentation & Wiki. Thumbs up!

Posted

Thanks for the positive feedback. It is appreciated.

Softfp - software floating point

Hard - hardware floating point

No - floating point turned off

There is one other setting (whose mnemonic I can't remember and is only on some CPU's and libraries) that uses hardware if available and software emulation if not.

Posted

inmarket, thanks again for your hint. I've been working on that for days and it drove me crazy. Finally, it was a problem with my toolchain. I was using plain command line gcc based on devkitPro. After importing the uGFX demo into Chibi Studio, everything is fine. Soft FPU, hard FPU, no problems at all. I'm happy, although I lost trust in my former toolchain.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...