blhost erase option (not erase the boot options, just the app)

Is there a way I can do a firmware update using blhost but not erase the flash boot options? I have a MKL17Z128 CPU so it has the latest bootloader code. When I update the KL17 firmware, a different CPU will reset the Kinetis and using the BOOTPIN_OPT, force the CPU into boot.

Currently I use the command: blhost -p COM44,115200 flash-image kl17.hex erase

And the result is:

Ping responded in 1 attempt(s)

Inject command 'flash-image'

Successful generic response to command 'flash-erase-region'

Successful generic response to command 'flash-erase-region'

Wrote 192 bytes to address 0

Successful generic response to command 'write-memory'

(1/2)100% Completed!

Successful generic response to command 'write-memory'

Wrote 24624 bytes to address 0x400

Successful generic response to command 'write-memory'

(2/2)100% Completed!

Successful generic response to command 'write-memory'

Response status = 0 (0x0) Success.

I would like to not erase the section at address 0x400 so I can always be able to force the CPU into the boot code. One of the options in the flash options is where I set the boot configuration to allow us to reset the CPU and force it into the boot code and that’s not the default option on a CPU with the boot option at 0x400 erased.

The boot option I don’t want to lose is blhost -p COM44,115200 write-memory 0x040C {{FEF9}} . It’s possible I can erase the boot options section at 0x400 and something goes wrong before we write the options back in and then I can’t force the CPU into the boot code with the external signals (reset/boot option).

It would be nice if there was an option to the command: blhost -p COM44,115200 flash-image kl17.hex erase to not erase the flash at address 0x400.

Is there a way I can do a firmware update using blhost but not erase the flash boot options?

No, unfortunately there is not command to avoid erasing the flash address 0x400. Any flash sector written to must be previously erased.

As reference you could check all the commands available in the blhost tool in the user's guide document located in the path: {NXP_Kinetis_Bootloader_2_0_0}\doc\Kinetis blhost User's Guide.pdf

My recommendation is that if you want to have this field with F9 value, then you should included in your image file, in this case in your kl17.hex. So every time you call the command blhost -p COM44,115200 flash-image kl17.hex erase, it will program again your flash configuration at 0x400.