I have adapted the ethernet firmware update from Shinichiro Nakamura (great job!) to pick the file from an USB stick. Unfortunately it doesn't work properly.
I made two different .bin files. One with the firmware update function running on the Mbed (led 1 blinking) and another with only led 2 blinking stored on the USB Stick. Both programs work properly when downloading them to the Mbed.
After downloading the program with the firmware update function and resetting the mbed, the update should be executed.
According to the Log file produced by the program, everything should be fine but nevertheless it seems as if the old firmware runs. The size of the .bin file before the reset is 48kB, after the reset the size is equal to the filesize on the usb stick (11kB).
I have already had a look into the .bin file and compared the two files (firmware.bin on mbed & firmware.bin on USB stick) after the fimware update. Since there were no diffences I can't explain why led1 is still blinking.
Can anyone give me some support, please! I have added the firmware update program and a photo from my setup. USB connection works.
Thank you in advance!
Could it be because you've called them the same name ? Maybe mbed doesn't think it needs to reflash the LPC as it doesn't see a file name change ?
does it work if you call them different names.
(but remember, Mbed will always run the most recent file in its memory when reflashing the CPU, so you'll have to make sure the second one has a later date too.)
Just an idea.
Thank's for your idea.
As far as I understood the boot process on the mbed it always loads the firmware from the local filesystem. Before executing the firmware update function it is the software which includes this function and after executing this function it should be the "stupid" function which only can blink the led. Since there is only one firmware available it can only load this firmware after reset. That's why the same name has no effect (from my point of view).
But I will try to change the name.
Actual Status: Different filenames don't work at all, I don't know why.
What I recognized was the following: Changing one character in the .bin file after the update followed by the reset and storing the changed file under the same name forces the mbed to reload the file -> the new, updated file runs on mbed (Hooray!!!). I changed the character from the PC, which changes the file's timestamp too. So this seems to be the point where I have to stick on.
Does anybody know if there is a possibility to get the timestamp information from a local file and to change it? If this is possible, I could save it in the txt file and after the change the timestamp of the updated file to a later date.
Your idea (To use USB mass-storage) is great.
The instance of FirmwareUpdater have log field.
Could you send me your output of the log information with the latest version?
To use log is really easy.
FirmwareUpdater fwup("firmware", "firmware", true);
The instance is here.
* @param url URL for firmware. Do not include a target file name.
* @param name An application name. Do not include a extention.
* @param log True if logging.
FirmwareUpdater(std::string src_name, std::string dest_name, bool log = false);
Here is the log file:
Local firmware version is 1. (/local/firmware.txt)
Source firmware version is 2. (/fs/firmware.txt)
INFO: Deleted '/local/FIRMWARE.BIN'.
File copying... (/fs/firmware.txt->/local/firmware.txt)
File copied. (/fs/firmware.txt->/local/firmware.txt)
File copying... (/fs/firmware.bin->/local/firmware.bin)
File copied. (/fs/firmware.bin->/local/firmware.bin)
Local firmware version is 2. (/local/firmware.txt)
Local firmware version is 2. (/local/firmware.txt)
I just have sent you the link to my project together with some informations.
Your program based on my FirmwareUpdater version 0.0.1.
But the implementation have some bugs.
Please re-implement your program on the version 0.0.2.
To cleanup all .bin files is important for your project.
Because local file copy in FirmwareUpdater can NOT control the date of the file.
Please try to update your FirmwareUpdaterWithUsbMass. :)
It's a great project!
Hi Shin, thank you for your information.
That's the cuuren status:
I have implemented the version 0.0.2 of your FirmwareUpdater but without success. You can find the project on http://mbed.org/users/Markus_Paar/programs/firmwareV3/lxqw92.
The problem is still the same: All .bin files are deleted by the cleanup function and the new firmware file is copied to the local file system. Nevertheless the mbed does not flash the LCP. Only restoring the .bin file from the PC (changing the timestamp) leads to success.
Here is the Log File:
INFO: Version file '/local/firmware.txt': Version 1.
INFO: Version file '/fs/firmware.txt': Version 2.
INFO: Firmware updating... (1 -> 2)
INFO: File copying... (/fs/firmware.txt->/local/firmware.txt)
INFO: File copied. (/fs/firmware.txt->/local/firmware.txt)
INFO: File copying... (/fs/firmware.bin->/local/firmware.bin)
INFO: File copied. (/fs/firmware.bin->/local/firmware.bin)
INFO: Version file '/local/firmware.txt': Version 2.
The programm should do everything right but it doesn't. Maybe you have an idea what can be done to solve this problem.
My original version uses temporary files for copying .bin and .txt.
See EXT_BINTMP and EXT_TXTTMP.
But you removed these implementations.
So all local bin files removed. :)
Please think about "Why the original version uses temporary files?".
(Because ... for the "Important things".)
That's the cause, and you can fix it. :)
Please log in to post a reply.