Hello,
First of all, I would like to applaud TI for including support for EtherCAT online application upgrade over FoE since SDK 1.0.0.6. I think it adds a lot of value to the SDK, and is a very desirable feature for virtually all EtherCAT devices.
"Semiconductor Device Profile: Firmware Upgrade over EtherCAT v0.1.11" has not been published by the ETG yet, but TI has done a good job at implementing it anyway. There are some features mentioned in this document (even though it is still in draft form) that I think would greatly improve the sample implementation of firmware upgrade via FoE.
-
Firmware manifest: The firmware file shall include a header / identifier such that the slave can recognize the download with the expected signature so it can accept the firmware file (before erasing the current application). This enables the vendor to “certify” valid downloads.
-
The slave shall be able to recover from a failed download by having a permanent image that can restart a download (by FOE) if the firmware upgrade has failed.
-
After a power supply failure during a firmware upgrade, firmware shall be upgradable by upgrade method defined herein.
The document also describes using an md5 algorithm hash/checksum to verify file integrity. You can have two versions of the firmware (original version supplied by manufacturer and upgradable version) stored in two different areas of the flash chip. The manufacturer-supplied default firmware can be stored in a write-protected region of the flash chip. A bootloader can check the integrity of the updatable firmware (e.g., by computing the md5 hash/checksum and comparing it with the md5 checksum value stored in the file header). If the updatable firmware is valid, the bootloader loads that firmware. Otherwise, the updated firmware has been corrupted or is not there, and the manufacturer-supplied default firmware is loaded. This way another FoE firmware updated can be attempted, and the device will not become a paperweight if something goes wrong during the firmware update.
I think it would add a lot of vaule if TI fully implements "Semiconductor Device Profile: Firmware Upgrade over EtherCAT" if/when it is published by the ETG.
It would probably also be beneficial to implement some features in "ETG.5003 Semiconductor Device Profile - ETG.5003.1 Common Device Profile (CDP)" even though it is still in draft form.
Regards