AnsweredAssumed Answered

FLASH_Program returns error after reboot

Question asked by Timothy Miller on Jul 31, 2017
Latest reply on Aug 1, 2017 by Timothy Miller

I have a (modified) freedom_bootloader that works, as expected on the K66F.  I have a guest application that can be loaded from the bootloader.  There is an area of FLASH memory that I've designated for shared use between the guest application and the bootloader.  The guest application writes to the shared space using FLASH_Program from fsl_flash.h, and uses NVIC_SystemReset() to reboot the device.  The bootloader reads the shared space, and based on the contents of that space modifies the startup process accordingly.  This all works as I would expect.  I can reprogram the same flash location on the K66F any number of times, and after each time NVIC_SystemReset is called.


The program runs into trouble after I physically power cycle the K66F.  After that, when the guest application tries to use FLASH_Program, it gets a return code of kStatus_FLASH_CommandFailure, which, to my understanding, indicates an unspecified run-time error.  Can anyone help me resolve this issue?  My attempts at diagnosing have been unsuccessful so far.


Edit: additional infromation.