Jerome Pitt

Modifying KBOOT1.2 to program an image from external SPI FLASH

Discussion created by Jerome Pitt on Mar 3, 2019
Latest reply on Mar 28, 2019 by Mark Butcher

Hi All

 

I have application that requires FOTA updates, and currently uses the below software components....

 

KBOOT 1.2
KSDK 1.3 
MQX V5 RTOS

KDS3.2

 

all running on MK22FX512A MCU.

 

What I'm now up to, is modifying the bootloader to program a firmware image from external flash using DSPI peripheral.

 

I believe this should be possible, but isn't built-in functionality.

 

Currently this is what I think I know and or have discovered about the bootloader.

 

1. KBOOT1.2 has DSPI low-level driver, as this is one of the active peripherals supported for executing bootloader protocol.

2. The bootloader is designed to accept commands over a peripheral to execute the flash functions required to erase, read, write to internal FLASH, my application WILL NOT BE doing this, I simply wish to read out my image from external FLASH and write directly into the MCUs flash memory.
3. Can the bootloader write to internal flash while executing code, or is relocating to RAM while executing? Is this something I need to be concerned about or is it already taken care of by the bootloader.
4. I think I may have to create some pseduo-dspi driver, that will mimic the commands it would normally receive over the

peripheral and have some internal state machine, manage the erase,verify,write commands to the upper layers of the bootloader. There may be some overhead in doing it this way, but at least the bootloader isn't hacked to pieces to make it do what I want, I can keep it modular, and seperate to the other bootloader source??

5. I'm currently using the bootloader via custom desktop application to flash over USB. So I still need to maintain this functionality, with whatever solution I come up with.

6. As part of the debugging process, I absolutely need printfs working to a serial port, this currently is not enabled / does not work in KBOOT1.2. They're are some references to debug_printf but no code behind, seems it may have been removed from the source before being released, possibly to keep a low memory footprint?

 

That's all for now, I'll keep this post updated.

Any help would be appreciated!

Outcomes