I have a device that I want to update the firmware of.
I want to use a custom bootloader interface for the update of the device, however, when I try to use this interface, the update process is super slow (in comparison to using CySysFlashWriteRow function and writing the new app by myself).
I currently have a simple POC bootloader program that writes an application from the disk.
I have two implementations for this bootloader. The first one is using the CySysFlashWriteRow function and writes the application manually, and the second one is constructing the bootloader commands and using the bootloader interface to write the program.
I saw that it is taking a lot more time to do the update with the bootloader interface.
The simple application that I am writing has 10 rows, while the real application I am using has 330 rows.
To emulate the run time of the real application update in this simple program, I write the same application 33 times.
By using the CySysFlashWriteRow function, the update takes a bit less than 10 seconds.
By using the bootloader interface, the update takes about 5.5 minutes (330 seconds)!
(There is a huge difference when writing only 10 rows as well, but it is a lot harder to measure)
I tried to look at the auto-generated code of the bootloader itself, but couldn't find any specific piece of code that took a long time there.
I understand that the bootloader adds overhead to the operations (it uses more functions, and does a lot of checks on the data), but an overhead of 33 times the original length seems way too long for me.
Is this the way it should be?
Is there any way to make the bootloader more efficient?
I am attaching my simple POC update application.
Changing the value of UPDATE_METHOD to either BOOTLOADER_INETRFACE or MANUAL_WRITING will make the bootloader run the update using the appropriate way.
Any help will be greatly appreciated,
bootloader.tar.gz 3.4 MB