AnsweredAssumed Answered

Error in Freescale C90TFS flash writing library

Question asked by Frank Van Hooft on Oct 30, 2014
Latest reply on Nov 3, 2014 by Kerry Zhou

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




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.