Connecting floating point type to project

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

Connecting floating point type to project

Jump to solution
1,246 Views
evgenik
Contributor IV

Hello.

I am working with IAR and Kinetis TWR-K21 development board,1024KB Flash, 128KB RAM.

When a function is called, which contains variables of float type, HardFault_Handler occurs. When studying this topic, I realized that I did not have a CMSIS connected (floating-point definition). After I connected the core_hm4.h file, which describes the floating-point, the function began to work, but variables of the float type in Watch show an error. 

I have examples with fsl_... drivers that work with float type without any problems. I can't use this project example as a template because I don't use fsl_.. drivers. I am using my own drivers.

Is there any specific way to connect to the IAR project the CMSIS instead of connecting core_hm4.h file? (via General Options-> Library Configuration CMSIS does not work), or need to build a project from scratch with any specific definition?

Evgeni

Labels (1)
0 Kudos
1 Solution
1,093 Views
evgenik
Contributor IV

I have found a very simple solution on how to connect the CMSIS library on the IAR site: 

https://www.iar.com/support/resources/articles/using-iar-embedded-workbench-for-arm-and-the-cmsis-ds... 

Thanks for the help

View solution in original post

0 Kudos
5 Replies
1,094 Views
evgenik
Contributor IV

I have found a very simple solution on how to connect the CMSIS library on the IAR site: 

https://www.iar.com/support/resources/articles/using-iar-embedded-workbench-for-arm-and-the-cmsis-ds... 

Thanks for the help

0 Kudos
1,093 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Evgeni Kosakovski ,

  Do you test the K21 SDK code which can be downloaded from this link:

https://mcuxpresso.nxp.com/en/select 

  I have tested it on my side with the TWR-K21F120M board, the float is working.

  Just based on the helloworld project:

pastedImage_2.png

pastedImage_3.png

You also can try the NXP sdk code on your side.

If you still have questions about it, please kindly let me know.

Best Regards,

Kerry

 

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
1,093 Views
evgenik
Contributor IV

Hi Kerry.

Thanks for your reference. But I wrote about this, I don't have fsl drivers library. I am using my own driver's library. I ask: what needs to connect to the project, like lib, h. or any other files, and check into the project configuration, that project will start work with floating-point correctly?

Thanks

Evgeni

0 Kudos
1,093 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Evgeni Kosakovski

  Do you enable the FPU on your side?

pastedImage_1.png

The SDK related header file is:

pastedImage_2.png

I think you can try the related console driver, then printf the float on your side, whether ti works with your own other drivers.

Maybe you can also refer to the SDK IAR project, then test it on your side, compare the detail difference, which one will influence your float, I didn't find any other lib for float. The K21 have the FPU, it can support the float calculation.

Best Regards,

Kerry

 

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
1,093 Views
bobpaddock
Senior Contributor III

Are math.h, and maybe stdlib.h, and related libraries linkage being included in the linker file?

I don't know their IAR names to help with those.

0 Kudos