KL03 ROM Bootloader fails if application contains FTFx Flash Driver

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

KL03 ROM Bootloader fails if application contains FTFx Flash Driver

443 Views
noexcuse4you
Contributor I

I am having an issue with the KL03 becoming bricked if power is lost during transfer of the application to flash via the ROM bootloader.  If power is lost, the only way to upload the application is via the debugger.  One way around this is to always have the device start in bootloader mode by setting the Flash Option boot source bit to "Boot from ROM".  However, always booting from ROM draws too much current for our ultra low power application.  I would like to have a bit of code at the beginning of the application, that checks if the application was successfully uploaded, then check if the Boot from ROM source is set.  If it is, then set the source to Flash.

To do this, I have the main program start at 0x800.  Then, I copy 0x400 to 0x7FF to a RAM buffer, change the boot source bits to the desired setting, then copy the RAM buffer to flash.  The flash driver I'm using are the "Standard Software Flash Driver For FTFx" contained in the flash writing examples.

This procedure works fine if I copy and run the application using the debugger.  I can see the bits change and the rest of the program runs as expected.  The issue I'm having is that if I try uploading this application via the Kinetis bootloader, the bootloader only copies the first 1024 bytes and then it hangs.  If I comment out the one function that contains the flash reading and writing, I'm able to upload the application using the bootloader just fine.

Does anyone have any suggestions on what to do?  Thanks!

Labels (1)
0 Kudos
1 Reply

316 Views
jeremyzhou
NXP Employee
NXP Employee

Hi John Doe,

According to above statement, the start address of application code is the 0x00000800, and the application code works well integrate with the debugger tool, in another word, the debugger tool can program the application code in assigned area in the flash.

However it will encounter some errors if using the Kinetis bootloader unless comment out the one function that contains the flash reading and writing.

It seems so weird and I don't think the Kinetis bootloader can have some "intelligent" to recognize the executable file include some function contains the flash reading and writing operation.

So I was wondering if you can illustrate the screenshots of whole process.

I'm looking forward to your reply.
Have a great day,

Ping

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

0 Kudos