ciminaghi / libdfu

Other
6 stars 3 forks source link

upload with IDE built-in ArduinoOTA tool #3

Open JAndrassy opened 6 years ago

JAndrassy commented 6 years ago

Hi Davide. me again :-). Some months ago I added to a copy of your library code to receive upload from the default OTA upload tool in IDE. I would add it as pull request, but to which branch? Here it is. Changes are only in arduino-server.cpp

The upload support was for some Latvian guy who sells Arduinos and wanted to reflash Uno WiFis, he had on stock, with WiFi Link. But he didn't. Then I thought that WiFi Link is dead so I left it. But now I see that WiFi Link lives in "red" and more important that your library supports it. So the default upload would be good for "red".

ciminaghi commented 6 years ago

Hi,

when the library was written, file uploads within the arduino environment were done by means of the python script called arduino_mcuota.py or something like that. Such script simply split the .hex file in chunks and sent them via http post. This used to work, and it still does, I use it for my tests (since I personally don't like the arduino environment, I just launch the script as a command line program). From what you're saying, and from a comment in your code (// handles upload with new mcu_ota tool), I understand that there is a new mcu ota tool, which does things in a different way. If that is the case, then I'd rather have two different rx methods, for the moment at least: the "old" arduino and the new one, with different names, because I'd like to do my tests with the script I've used so many times. By the way, do you know why the ota tool has been changed ? I can't remember any serious technical flaws, and the new one doesn't look simpler, at least on the rx side.

As far as branches are concerned, nordic-zip and red are the newest ones. red comes from nordic-zip and adds support for the red board by what's next. nordic-zip adds support for the arduino primo. While I still have to do serious tests on the primo, the red board should work well, so I think red will eventually become the new master.

Davide

JAndrassy commented 6 years ago

my version of arduino-server.cpp supports both upload tools

mcu-ota is from arduino.org (repo). I don't know it it was in the arduino.org fork of IDE. When I started with Arduino in April 2017, ArduinoOTA tool was configured in platform.txt and it was working with Uno WiFi factory firmware (esp-link). But then I changed to WiFiLink and I configured the mcu-ota tool in my installation of IDE to have OTA upload. Also I added instruction to install mcu-ota to the reference I wrote on github for WiFi Link, but the feedback was that it is a complication.

Of course the whatsnext core package could configure mcu-ota in platform.txt.

JAndrassy commented 6 years ago

To Primo. I don't have it, but it has WiFiLink so I made some troubleshooting sessions with Primo owners on forum. One of them installed esp8266 core and OTA uploaded Blink to esp8266. That disabled any option to change the sketch in esp8266. No Serial connection, no OTA. Only option to recover WiFi was to solder the Serial connection (or return the board). So it is risky to update the esp8266 firmware on Primo. Only way is OTA and if it fails then onboard esp8266 is bricked. So I don't see who would risk to update WiFLink firmware on Primo.