FPU unit hardfault

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

FPU unit hardfault

731 Views
aminesedki_as
Contributor I

Hello everybody,

I'm using TWR-K60D100M to deal with floating point number so i create a new project and include a soft Fpu , when i tried to debug the program it's jumping on hardfault that i can understand, for this i added here a screenshot maybe someone can help me.

Thanks for u. screenshot.jpg

Labels (1)
Tags (1)
0 Kudos
5 Replies

579 Views
aminesedki_as
Contributor I

Hi Sabina please find here the zip file of my project it's juste a simple exemple the goal for me is to understand how to use the FPU.

Thank you for your quick reaction 

0 Kudos

579 Views
Sabina_Bruce
NXP Employee
NXP Employee

Hello Amine,

 

Thank you for the information.

 

Firstly I would like to point out that the TWR-K60D100 does not have an FPU in hardware. I noticed you modified the MK60D10.h file and changed the following value to one:

 

#define __FPU_PRESENT                  1         /**< Defines if an FPU is present or not */

 

It is crucial that these files are not modified as they represent the core cortex configuration, in this case as I mentioned there is no FPU physically present so this value has to remain 0.

 

 

Also I noticed that in your settings you have selected the softABI mode, this is incorrect as this is for operations that are implemented in hardware. You can refer to this article for more information about the floating point variants,

Now in order to change your project to the correct mode, you can select your project and click on PROPERTIES > C/C++ BUILD > SETTINGS

pastedImage_1.png

pastedImage_3.png

Here you can make sure that the Floating point is set to None in the Architecture for the MCU C Compiler , as well as the Architecture & Headers in MCU Assembler and Architecture in the MCU Linker.

After you have modified your project build and run it again. This will automatically emulate the floating point instructions for you and you should see the correct printed value in your console. 

Let me know if this has positive results for you,

Sabina

0 Kudos

579 Views
aminesedki_as
Contributor I

Hi Sabina,

thank u very much it's work but i want to know if i turn this program on the K60 if it's will work and not only work on the console 

Thank u very muchresults.jpg

0 Kudos

579 Views
Sabina_Bruce
NXP Employee
NXP Employee

Hi Amine,

In order to see this work when you are not debugging, you need to change the settings to UART so you can see the same in a serial terminal even if it is not debugging.

To do this you need to select your project and go to the quickstart panel. Here you can select Quick Settings > SDK Debug Console > UART Console.

pastedImage_1.png

Finally select your project again, right click and select Clean. Then rebuild your project and run it. If you end the debug session and reset your board you can see the results in a serial terminal like TeraTerm.

Hope this helps,

Sabina

0 Kudos

579 Views
Sabina_Bruce
NXP Employee
NXP Employee

Hi Amine,

Could you please provide the details on how you created your project to include the FPU by software?

You can provide the project itself by attaching the ZIP file or screenshots as well.

Thank you,

Sabina

0 Kudos