Error in Freescale C90TFS flash writing library

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

Error in Freescale C90TFS flash writing library

949 Views
frankvanhooft
Contributor III

This week I downloaded the latest version of the C90TFS flash writing / eeprom emulation library from the Freescale website. Then built and tried to run a sample program on the KL25Z128 (Freedom board) processor. It didn't work (although the documentation says it's been tested).

The problem lies with a bug in file SSD_FTFx_Internal.h.  The file contains this:

/* Select file .h for each derivatives */

#if (FTFx_KX_256K_256K_4K_2K_2K == FLASH_DERIVATIVE)

    #include "FTFx_KX_256K_256K_4K_2K_2K.h"

#elif (FTFx_KX_128K_128K_4K_2K_2K == FLASH_DERIVATIVE)

    #include "FTFx_KX_128K_128K_4K_2K_2K.h"

#elif ((FTFx_KX_512K_0K_4K_2K_0K == FLASH_DERIVATIVE) || (FTFx_KX_256K_0K_4K_2K_0K == FLASH_DERIVATIVE))

    #include "FTFx_KX_(512_256)K_0K_4K_2K_0K.h"

#elif (FTFx_CX_256K_32K_2K_1K_1K == FLASH_DERIVATIVE)

    #include "FTFx_CX_256K_32K_2K_1K_1K.h"

#elif ((FTFx_CX_128K_32K_2K_1K_1K == FLASH_DERIVATIVE) || (FTFx_CX_64K_32K_2K_1K_1K == FLASH_DERIVATIVE)\

    || (FTFx_CX_32K_32K_2K_1K_1K == FLASH_DERIVATIVE))

    #include "FTFx_CX_(128_64_32)K_32K_2K_1K_1K.h"

#elif (FTFx_KX_512K_512K_16K_4K_4K == FLASH_DERIVATIVE)

    #include "FTFx_KX_512K_512K_16K_4K_4K.h"

#elif ((FTFx_KX_1024K_0K_16K_4K_0K == FLASH_DERIVATIVE) || (FTFx_KX_1024K_0K_4K_4K_0K == FLASH_DERIVATIVE)\

    || (FTFx_KX_2048K_0K_4K_4K_0K))

    #include "FTFx_KX_(2048_1024)K_0K_(16_4)K_4K_0K.h"

#elif ((FTFx_KX_128K_0K_2K_1K_0K == FLASH_DERIVATIVE)||(FTFx_KX_64K_0K_2K_1K_0K == FLASH_DERIVATIVE)\

    ||(FTFx_KX_32K_0K_2K_1K_0K == FLASH_DERIVATIVE))

    #include "FTFx_KX_(128_64_32)K_0K_2K_1K_0K.h"

#elif ((FT

etc

I've highlighted the error above in red. That line should say:

    || (FTFx_KX_2048K_0K_4K_4K_0K == FLASH_DERIVATIVE))

Due to this error, it always includes the header file FTFx_KX_(2048_1024)K_0K_(16_4)K_4K_0K.h regardless of which FLASH_DERIVATIVE you specify in your user_cfg.h file.

Now it becomes luck of the draw - maybe the .h file you get will work for you, and maybe it won't. That .h file it's pulling in contains not only information about the flash partitioning for the processor, but also things like the processor type, CPU core, endianness, etc. So it's pretty critical to a successful build & execution.

I hope this helps others who might be having troubles.

0 Kudos
4 Replies

634 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Frank Van Hooft,

      Thank you very much for your C90TFS bug sharing!

      I check it, the new version really have this problem, the new added line missed the "  == FLASH_DERIVATIVE".

    Actaully, if you are using FRDM-KL25Z, you can use the last version of C90TFS, that have no problem, I already run that KL25 code, it works fine, and don't have this bug.

/* Select file .h for each derivatives */

#if (FTFx_KX_256K_256K_4K_2K_2K == FLASH_DERIVATIVE)

    #include "FTFx_KX_256K_256K_4K_2K_2K.h"

#elif (FTFx_KX_128K_128K_4K_2K_2K == FLASH_DERIVATIVE)

    #include "FTFx_KX_128K_128K_4K_2K_2K.h"

#elif ((FTFx_KX_512K_0K_4K_2K_0K == FLASH_DERIVATIVE) || (FTFx_KX_256K_0K_4K_2K_0K == FLASH_DERIVATIVE))

    #include "FTFx_KX_(512_256)K_0K_4K_2K_0K.h"

#elif (FTFx_CX_256K_32K_2K_1K_1K == FLASH_DERIVATIVE)

    #include "FTFx_CX_256K_32K_2K_1K_1K.h"

#elif ((FTFx_CX_128K_32K_2K_1K_1K == FLASH_DERIVATIVE) || (FTFx_CX_64K_32K_2K_1K_1K == FLASH_DERIVATIVE)\

    || (FTFx_CX_32K_32K_2K_1K_1K == FLASH_DERIVATIVE))

    #include "FTFx_CX_(128_64_32)K_32K_2K_1K_1K.h"

#elif (FTFx_KX_512K_512K_16K_4K_4K == FLASH_DERIVATIVE)

    #include "FTFx_KX_512K_512K_16K_4K_4K.h"

#elif ((FTFx_KX_1024K_0K_16K_4K_0K == FLASH_DERIVATIVE) || (FTFx_KX_1024K_0K_4K_4K_0K == FLASH_DERIVATIVE))

    #include "FTFx_KX_1024K_0K_(16_4)K_4K_0K.h"

#elif ((FTFx_KX_128K_0K_2K_1K_0K == FLASH_DERIVATIVE)||(FTFx_KX_64K_0K_2K_1K_0K == FLASH_DERIVATIVE)\

    ||(FTFx_KX_32K_0K_2K_1K_0K == FLASH_DERIVATIVE))

    #include "FTFx_KX_(128_64_32)K_0K_2K_1K_0K.h"

    I attached the last version of C90TFS, If you need, you can use it.


     

    Wish it helps you!


Have a great day,

Jingjing

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

0 Kudos

634 Views
frankvanhooft
Contributor III

Thanks for the posting.  The file you attached is pretty old. The installer says it's revision 1.01, the files are dated Dec 2013, whereas the latest version on the website is 1.03, dated Aug - Oct 2014.  The file you attached doesn't have the bug, this is true, probably because it doesn't support all the processors any longer. For example the file configuration file FTFx_KX_(2048_1024)K_0K_(16_4)K_4K_0K.h  is not part of the older 1.01 revision.

0 Kudos

634 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Frank Van Hooft,

      Yes, you are right.  Revision 1.01 doesn't support all the processors, but if you just using the KL25 , that version is OK.

      About the bug of revision 1.03, I will pass it to the according department, it may updated in the next version.

    Thank you for your bug sharing.


Have a great day,
Jingjing

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

0 Kudos

634 Views
frankvanhooft
Contributor III

I've managed to get flash erasing and programming working, using rev 1.03 of the flash driver library. Between this bug (described above) and a couple of other things it wasn't exactly a 5 minute job. To help others I've documented the things I tripped over here:

http://blog.frankvh.com/2014/11/02/using-the-freescale-tfs-flash-driver-software-bugs-notes/

Hopefully this will help others get up and running much more quickly than I did.

0 Kudos