Looking for examples or advice on upgrading firmware in flash for KL17Z

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

Looking for examples or advice on upgrading firmware in flash for KL17Z

704 Views
nnewell
Contributor II

I'm trying to upgrade the flash in an MKL17Z256xxx processor from within the firmware. The goal is to load an image from a cellular modem into bank 1 and than either switch or write it into bank 0. I'm having trouble setting up the linker command file to use either the RAM or the flash for this purpose.  I'm looking for a detailed example of how to do this. I have only found 2 documents one just shows writing to flash while running in the same bank and the other is a document that does show some steps to using RAM but its for other IDE tool chains (I'm using Kinetis 3.2.0) and it seems to be using some old version of the FSL API. I have looked at the fsl_flash.c code which seems to support relocating to RAM but there's no documentation showing this beyond the API reference, so any examples using that library would be handy. The RAM is pretty small and I can probably afford a couple sectors in the upper flash bank for this purpose. Thanks.

0 Kudos
4 Replies

423 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi,

For the KL17 provided ROM bootloader, which could used to load the application code.

As customer mentioned "The goal is to load an image from a cellular modem into bank 1 and than either switch or write it into bank 0."

For the KL17 application code need boot at Flash address 0x0, if the image was loaded into Flash bank 1. The related image application could not be executed automatically.

Customer need to use ROM bootloader or external SWD port to program a secondary bootloader at Flash start address 0x0 of Bank0. Then the secondary bootloader could help to load another application image at Flash bank1 and jump to execute that application. 

Thank you for the attention.


Have a great day,
Ma Hui

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

0 Kudos

423 Views
nnewell
Contributor II

I'm not sure I've communicated the situation properly. I'm not loading an application I'm loading a new firmware image using a simplified COFF file format. I will copy each section to a specific location which is provided by the COFF file. It looks like I will need to relocate the vector table or disable interrupts during the flash programming procedure. The actual programming code has to be somewhere other than the sectors that I'll erase (0x0 to 0x1F000). The COFF file is currently being programmed into 0x20000 and will be up to 0x1F000 in length. Once this is setup I should be able to jump to the programming routines and "relocate" the code to the lower addresses, which start at 0x0.

This is a pretty common procedure for upgrading the entire flash over a wide area network. So my problem is defining the sectors to hold the programming code and relocating the code there at run time. In most architectures this is done in RAM, but it looks like this processor (MKL17Z) supports programming flash while executing in flash. I found a small example that appears to work, so I have two options, but I'm not familiar with how to setup this relocation section in the linker command file so I can take advantage of it.

If the bootloader already has some routines I can just call that do this that would be even better, but I don't see that. I've mostly been looking at the fsl_flash API which seems to support relocating to RAM, so an example using that would probably be the most helpful.


Thanks

0 Kudos

423 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi,

I would recommend to refer below Community threads about the fsl_flash.c driver example:

How to use "fsl_flash" componect of Processor Expert 

https://community.nxp.com/message/564378?commentID=564378#comment-564378

Wish it helps.


Have a great day,
Ma Hui

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

0 Kudos

423 Views
nnewell
Contributor II

Thanks there appears to be some good information there.

-


On Tue, 05 Sep 2017 20:07:35 -0700 Hui_Ma <admin@community.nxp.com> wrote -


NXP Community

Re: Looking for examples or advice on upgrading firmware in flash for KL17Z

reply from Hui_Ma in Kinetis Microcontrollers - View the full discussion

Hi,

I would recommend to refer below Community threads about the fsl_flash.c driver example:

How to use "fsl_flash" componect of Processor Expert

https://community.nxp.com/message/564378?commentID=564378#comment-564378

Wish it helps.

Have a great day,

Ma Hui

0 Kudos