I need a firmware uploader doing the following: 1. Open file dialog for specifying [url removed, login to view] file for loading.
2. Load that file (max 768kbytes) to memory, calculate SHA1 checksum of the file + program internal key. Load hexadecimal SHA1 from file xxx.key. If they agree, continue, otherwise abort with error message.
3. Continuously check for present serial COM ports. Whenever a new port is found, open it with 115200,8N1. The program must not poll the COM ports that existed when the software is started.
4. Check incoming data from all opened COM ports. Whenever two consecutive 'C'-characters are received, upload the loaded binary file with XModem 1k protocol and close the port after the transmission.
5. Simple GUI must have exit-button and 'Load image'-button for loading a firmware file.
Background: I have devices that use FT232R chip for USB-serial conversion. The devices can receive new firmware through XModem protocol. I want to be able to click 'upgrade firmware' on the device and plug it into USB port. This way I can upgrade many devices with minimal interaction by just single selection and USB plugging.
Note that the program must survice if a serial port is plugged unplugged on the fly. Check and handle the exceptions in the code!