2018-10-21 06:15 AM
ex) When compiled with IAR 8.30.1, HardFault exception was occured.
float gfSetDataRate = 100.0f;
printf("Data Rate = %f \r\n", gfSetDataRate);
HardFault is occured at VCVT.F64.F32 instruction.
I also tested following case
What is wrong? IAR, my source, STM32F407 FPU?
Ggive me any other hints, please.
2018-10-21 08:59 AM
Stack too small ?
Chose a lib without float support (supposedly not causing hardfaults) ?
2018-10-21 09:34 AM
Check the FPU is being enabled, usually in the SystemInit() code, and being called from startup.s
Make sure the right libraries and target processor are being selected.
Compare and contrast source files and metadata in project between the ones crashing, and ones functioning.
2018-10-21 10:25 AM
Thanks,
I have already checked stack size up to 32kbytes and also fpu enabled function.
thank you very much.
2018-10-22 12:09 AM
Does it work, then ?
32kB is not necessary, but the 128 or 256 byte default stack of some toolchains is destined to fail quickly.
Printing floating point numbers does not strictly require the FPU.
2018-10-22 01:28 AM
No, still not working.
Yes, I think that 4 Kbytes is enough for stack in my application.
And, as attached picture, exception is occurred at execution of FPU instruction, vcvt.f64.f32,
I thought that this may be related with lazy stack. so, now reviews the lazy stacking.
Thank you very much.
2018-10-22 02:08 AM
Seems you are using floating point numbers anyway. Have you enabled the FPU ?
If I remember correctly, IAR does enable the FPU automatically in the startup, if it is set in the project options (General Options-> Target, FPU).
And check the device is set correctly (STM32F407xx, Cortex-M4F).
2018-10-22 02:40 AM
Please check that the printf formatter is set to "Full" in the project's "General Option"=>"Library Options 1".
2018-10-22 02:42 AM
Yes,
Target, and library configuration. and also, debug info picture as following.
FPU enabled routine. at that time FPU coprocessor info.
2018-10-22 03:16 AM
I found the hints on Keil site(http://www.keil.com/support/man/docs/armasm/armasm_dom1361289950613.htm).
They says that VCVT instruction can produce invalid operation, ....
and also I found that vcvt.f64.f32 never used in the gcc asm code. so, suspected that there is problem in IAR tool chain. I reported this phenomenon to IAR.
Thank all, very very much.