/var/www/restricted/ssh/stm32/www/stm32circle/ STM CircleOS forum / Problem with casting int to float and vice versa

Username:     
Password:     
             

Forum

# 1   2010-06-04 09:37:27 Problem with casting int to float and vice versa

francom
New member
Registered: 2010-04-21
Posts: 1

Problem with casting int to float and vice versa

Hi,
I'm using codesourcery compiler and stm32f103 uC.
The problem is when i try to cast between int and float. I.e.:

Code:

 
float a = (float)b;  //where b is uint16_t
//or
uint16_t b = (uint16_t)a; //where a is float

In this case in the runtime  uC gets stopped and in gdb i see that it's in the HardFault Handler.

I compile codes with -mfloat-abi=soft option and using float operation and function from math.h is ok.

Does anyone have this problem?

Offline

 

Board footer