Hi,
I always see HardFault when I debug a float point code. But it can run smoothly in run-time.
Firstly, I use code Style-1.
float val
val = (int32_t)NRF_ADC->RESULT;
it go into HardFault directly.
Then I split the code into Stype-2
float f_val
int i_val
i_val = (int32_t)NRF_ADC->RESULT;
f_val = i_val;
it will fault in f_val = i_val;
Then, I changed code to Style-3
float f_val
int i_val
i_val = (int32_t)NRF_ADC->RESULT;
f_val = i_val + 0.0;
it can go smoothly.
How can I use the first style directly when debug, for I dont like to change all my code into style-3. It will waste so many time, and is not a good code style.
Thanks,