Problem returning double from a function.

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

Problem returning double from a function.

Jump to solution
1,326 Views
leccy
Contributor III

I am migrating an existing CW10.4 project to include USB with bootloader on a product.

 

Starting with the existing project, i have copied in P&E components, .lcf files etc from another product which already has USB working. This is now working as expected.

 

However, the new project is not returning a double correctly, whereas the existing project does.

 

As far as i can tell, all the project settings are the same, both use Codewarrior ARM C compiler etc.

 

I have attached screenshots showing a difference in assembler between the two projects where the double is returned from a function. These functions are identical in source code.

 

There must be a setting somewhere i have missed...

 

I've seen on non-kinetis CW that you can specify if double is 32bit or 64bit, but can't find this for kinetis.  Could it be related to this?

 

Thanks

Alex

Labels (1)
Tags (1)
1 Solution
1,218 Views
leccy
Contributor III

Fixed this issue.

I had left out an include file which contained the function which was returning double in the file where the function was being called.

This did not produce an error on compilation.

Introducing the include file changes the assembler produced to correctly return double.

View solution in original post

2 Replies
1,219 Views
leccy
Contributor III

Fixed this issue.

I had left out an include file which contained the function which was returning double in the file where the function was being called.

This did not produce an error on compilation.

Introducing the include file changes the assembler produced to correctly return double.

1,218 Views
leccy
Contributor III

In "Double return fails.png",

the line bl $T (0x1d26c)

is the address of  "(FP_fastI_Thumb_LE_v7M.a _d_itod.o      )"

So it would appear be calling a library integer to double function.

0 Kudos
Reply