Page 2 of 2

Re: float acting like double

Posted: Thu Jan 15, 2026 9:08 pm
by Giovanni
Could setVal be corrupted in some unexpected way? a stack overflow or an overflow in some adjacent variable.

Giovanni

Re: float acting like double

Posted: Fri Jan 16, 2026 4:36 pm
by jcbless
I don't think that a stack overflow is occurring, but I'm not sure that I know exactly what I should be looking for. Please give me some hints. I don't know what to look for regarding an overflow in adjacent variables.

The working area I started with for thread1 was 1024. I've gone as high as 10000 without any change in behavior.

Also another interesting fact is that when it is giving the double like values, it interspaces them with 0's like this:
Float into vSV: 406F4000
Float into vSV: 0
Float into vSV: 406F4000
Float into vSV: 0
Float into vSV: 406F4000
Float into vSV: 0

Thanks,
John

Re: float acting like double

Posted: Fri Jan 16, 2026 6:05 pm
by Giovanni
Try to package a very minimal project showing the problem, I am out of ideas.

Giovanni

Re: float acting like double

Posted: Sun Jan 18, 2026 10:30 am
by alex31
-what fpu option do you use ? (USE_FPU_OPT in Makefile) ?
° for stm32h7, if using FPU, should be -mfpu=fpv5-d16
° If you have several units compiled separately, you must keep -mfloat-abi value consistent in all the project
since it tell the compiler how are passed the float parameters, in fpu registers or cpu registers.

-what compiler ?

After assuring that you have consistent USE_FPU_OPT in all your project, you can try the three possible value : 'no', 'soft', 'hard' to check if you keep the same strange behavior.

To go further, follow Giovanni advice, try a simple example in a single main.c and post it here.

A.