Trouble using Double variables

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

Trouble using Double variables

706 Views
kavehfirouzi
Contributor II

Hi,

 

I recently ported my codes from Keil uVision to Kinetis Design Studio and I ran into a strange problem, It looks like as if the Kinetis compiler doesn't know how to handle double variables properly.

So I have a static array of double variables in one of my functions. Compiler sets the memory location of the last element of this static array to 0x1fff6868. I realized one of my other static variables somewhere else in the code is getting corrupted and when I investigated I noticed it is located at the address 0x1fff686c, which means it overlaps with the double variable located at 0x1fff6868 because they're only 4 bytes apart instead of 8!

Why is this happening? Is there some sort of compiler settings I should change?

 

Regards,

K

Labels (1)
0 Kudos
Reply
2 Replies

575 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello K,

Please tell me   the name of your chip and the version of the KDS.

And could you screenshot the code and handle  of "a static array of double variables" and show the happening on memory .

BR

Alice

0 Kudos
Reply

575 Views
kavehfirouzi
Contributor II

Hi Alice,

I am using KDS 2.0.0 and the chip is MK21FN1M0AVLQ12. I got around the problem by adding an extra dummy element to the end of the double array, it's a hacky fix, but it works and my algorithm are now working fine, I am still interested to now why this happened.

I'll send what you asked for as soon as I get the chance.

Regards,

K

0 Kudos
Reply