Floating point calcs on Kinetis CPU CW 10.1 MQX 3.7

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

Floating point calcs on Kinetis CPU CW 10.1 MQX 3.7

1,572 Views
intevac_coder
Contributor III

Hello,

 

I am having a little challenge getting some basic floating point calculations to work with the K40 tower system.

HW: K40 tower system

CW Dev studio 1.0.0  Build Id: b15_2105-A22-A1

CW ver 10.1.5, build id 110204

MQX 3.7

 

In the debugger, I am stepping through my code and find that the floating point calculations are not working correctly.  Code like this:

 

float DG_const;

DG_const = 1023.0 / 21467.05;

 

DG_const reports back a value of 3.07e-44 in the variables window.

 

and the line

DG_denom = powf(255.0 , 1.8);

shows DG_denom = 0

in the variables window.  I have #include <math.h> in the header.  Is there a setting(s) that need to be added for f-p calculations to work?

 

Thanks!

 

 

 

1 Reply

695 Views
intevac_coder
Contributor III

I received a message from Freescale support:

 

I think you should ewl model for your library configurations. You need choose c9x if you want to use math function like powf().see enclosed screenshot.

 

I extracted the description from help as below:

ewl and ewl_c++ models have a smaller memory footprint. Also, the ewl and ewl_c++ models have relevant sub-models that allow the user to select the desired print and scan formatters and the IO scheme.

c9x and c9x_c++ models are fully C99 compliant. The c9x and c9x_c++ models do not have sub-models.

 

The attached Setlib distills down to this:

 

Floating Point

To get floating point calcs to work, the Compiler tool settings must be changed.

Click on the project in the Project window.

Select Project from the menu:

Properties

Tool Settings->Librarian->Model->c9x

The EWL library has a smaller footprint but doesn’t support floating point calculations.

0 Kudos