Claus Stovgaard

Sample code for K70/K60 version 1.4 has low quality.

Discussion created by Claus Stovgaard on Feb 6, 2014

This is kind of a bug report. The Kinetis 120MHz bare metal sample code revision 1.4 from December has different part with low quality. The code can be found here.

https://www.freescale.com/webapp/Download?colCode=KINETIS_120MHZ_SC&appType=license&location=null&Parent_nodeId=&Parent_pageType=&Parent_nodeId=&Parent_pageType=

 

Among other things:

 

Mch.h contains a prototype for void rtc_as_refclk(void); event though this function is not implemented anywhere. E.g. you need to stub it, for compiling the code with a compiler where this is an issue.

 

From running a static code analyzer, the following comes up.

 

Output from Compiling mcg.c:

"..\..\..\ThirdParty\KINETIS_120MHZ_SC\KINETIS_120MHZ_SC\src\drivers\mcg\mcg.c", line 187: source analysis warning #15:

          "temp_reg" set but never read

     temp_reg &= ~(MCG_C1_CLKS_MASK | MCG_C1_FRDIV_MASK | MCG_C1_IREFS_MASK); // Clear values in these fields

              ^

 

"..\..\..\ThirdParty\KINETIS_120MHZ_SC\KINETIS_120MHZ_SC\src\drivers\mcg\mcg.c", line 2039:

          (when called from

          ..\..\..\ThirdParty\KINETIS_120MHZ_SC\KINETIS_120MHZ_SC\src\drivers\m

          cg\mcg.c line 876) source analysis error #14: read of potentially

          uninitialized variable "fll_freq_hz"

   return fll_freq_hz;

   ^

 

"..\..\..\ThirdParty\KINETIS_120MHZ_SC\KINETIS_120MHZ_SC\src\drivers\mcg\mcg.c", line 987: source analysis warning #15:

          "temp_reg" set but never read

   temp_reg &= ~(MCG_C1_CLKS_MASK | MCG_C1_FRDIV_MASK | MCG_C1_IREFS_MASK); // Clear values in these fields

            ^

 

"..\..\..\ThirdParty\KINETIS_120MHZ_SC\KINETIS_120MHZ_SC\src\drivers\mcg\mcg.c", line 1250: source analysis warning #15:

          "temp_reg" set but never read

   temp_reg &= ~(MCG_C1_CLKS_MASK | MCG_C1_FRDIV_MASK | MCG_C1_IREFS_MASK); // Clear values in these fields

            ^

 

"..\..\..\ThirdParty\KINETIS_120MHZ_SC\KINETIS_120MHZ_SC\src\drivers\mcg\mcg.c", line 1453: source analysis warning #15:

          "temp_reg" set but never read

   temp_reg &= ~(MCG_C1_CLKS_MASK | MCG_C1_FRDIV_MASK | MCG_C1_IREFS_MASK); // Clear CLKS, FRDIV and IREFS fields

            ^

 

"..\..\..\ThirdParty\KINETIS_120MHZ_SC\KINETIS_120MHZ_SC\src\drivers\mcg\mcg.c", line 1800: source analysis warning #15:

          "temp_reg" set but never read

   temp_reg &= ~(MCG_C1_CLKS_MASK | MCG_C1_FRDIV_MASK | MCG_C1_IREFS_MASK); // Clear values in these fields

            ^

 

Just FYI, in a hope that when you release version 1.5 is it fixed.

 

Have a nice day.

Outcomes