Go Down

Topic: Latest/Best Ethernet Bootloader for Mega2560 & W5100 (Read 1 time) previous topic - next topic

m_elias

What's the latest on ethernet or TFTP bootloaders for Arduinos? Specifically, I'm looking to use it on a mega2560 with w5100 shield. I see the following:
https://github.com/LoathingKernel/Ariadne-Bootloader
https://github.com/codebndr/Ariadne-Bootloader
https://www.freetronics.com.au/pages/how-to-upload-a-sketch-to-your-arduino-via-a-network
     which uses https://github.com/freetronics/arduino-tftpboot
https://github.com/d0ughb0y/NetLoad

I'd like to compile with the Arduino IDE, and upload. I like how simple the Esp OTA library works but from what I've read I expect to use a TFTP client and wdt reset. I have a little experience writing bootloaders.
Any recommendations from experience? Updated/working tutorials for using the bootloader?

Juraj

https://github.com/jandrassy/ArduinoOTA

This library allows you to update sketches from IDE to your board over WiFi or Ethernet. It is a modification of the Arduino WiFi101OTA library.

On AVR for upload over InternalStorage, Optiboot bootloader with copy_flash_pages function is required. Arduino AVR package doesn't use Optiboot for Arduino Mega. For Arduino Mega you can download my boards definitions and use it to burn the modified Optiboot and to upload sketches to your Mega over USB and over network.


pert

What's the latest on ethernet or TFTP bootloaders for Arduinos? Specifically, I'm looking to use it on a mega2560 with w5100 shield. I see the following:
https://github.com/LoathingKernel/Ariadne-Bootloader
https://github.com/codebndr/Ariadne-Bootloader
https://www.freetronics.com.au/pages/how-to-upload-a-sketch-to-your-arduino-via-a-network
     which uses https://github.com/freetronics/arduino-tftpboot
https://github.com/d0ughb0y/NetLoad
Out of those links, definitely use https://github.com/LoathingKernel/Ariadne-Bootloader. The codebndr repository was historically run by LoathingKernel but since the CodeBender project has been through some changes and so LoathingKernel decided it was best to continue any further development in their own repository.

The freetronics thing is very outdated, not actively maintained, and doesn't have ATmega2560 support out of the box (if at all).

The d0ughb0y repository was created in a fit of anger after their suggestion for Ariadne was rejected. They did add some features that are interesting (some of which likely would have been welcomed into Ariadne) but unfortunately they did not follow proper development practices and instead mashed a bunch of unrelated changes into a single commit. The effort that would be required to untangle each of the changes from each other and review then is more than it would take to just implement them from scratch. That repository has not been maintained at all since that initial commit and so has not benefited from a lot of further development work on Ariadne. Considering the conditions it was created under, I would not trust the code in that repository to be well tested.

I'm a big fan of Ariadne, but I would definitely recommend considering ArduinoOTA as well, since Juraj does very good work.

Juraj


m_elias

@m_elias, some feedback?
I'm not sure when I will have time to dig into this and try it. I'm interested in your method, can you recommend a good step by step tutorial for flashing the bootloader and modifying the IDE?

Juraj

@m_elias

to use Mega with Optiboot, you need to define an alternative Mega.
under your sketches folder usually in Documents/Arduino, create folder hardware if it doesn't exist. in hardware create my_boards folder.
download https://github.com/jandrassy/my_boards as .zip using the green button
copy the avr subfolder from the zip so you have a final folder structure like this:
Documents/Arduino/hardware/my_boards/avr/bootloaders/optiboot8

prepare the board and the programmer for flashing and then choose "Arduino Mega 2560 (Optiboot)" at the end of the Tools menu. And use "Burn bootloader'. After burning Optiboot always use this custom definition of the Mega to upload sketch over USB or network.

Now you must find the active official boards package file for the avr boards. It could be installed with IDE, so under the IDE installation folder or under arduino15 folder in home directory. If you can't find it, write us, what OS do you have.
In the boards package folder create file platform.local.txt next to platform.txt file and put only this one line into this new platform.local.txt file (it overrides the key defined in platform.txt for Yun)
Code: [Select]
tools.avrdude.upload.network_pattern="{network_cmd}" -address {serial.port} -port 65280 -username arduino -password "{network.password}" -sketch "{build.path}/{build.project_name}.bin" -upload /sketch -b
The ArduinoOTA library listens for uploads from arduinoOTA tool used by the IDE. It must be version 1.2.0 of the tool (installed with AVR package 1.6.23).
Any time now the ArduinoOTA library should by available in Library Manager.
You can try the OTEthernet example.

m_elias

@m_elias

to use Mega with Optiboot, you need to define an alternative Mega.
under your sketches folder usually in Documents/Arduino, create folder hardware if it doesn't exist. in hardware create my_boards folder.
download https://github.com/jandrassy/my_boards as .zip using the green button
copy the avr subfolder from the zip so you have a final folder structure like this:
Documents/Arduino/hardware/my_boards/avr/bootloaders/optiboot8
I'm using a portable installation on Windows 7, so my path is
arduino-1.8.8\portable\sketchbook\hardware\my_boards\avr\bootloaders\optiboot8
prepare the board and the programmer for flashing and then choose "Arduino Mega 2560 (Optiboot)" at the end of the Tools menu. And use "Burn bootloader'. After burning Optiboot always use this custom definition of the Mega to upload sketch over USB or network.
I was able to flash the bootloader using my AVRISP mkII (after installing it's drivers) and I am able to flash sketches via USB with the new optiboot8 bootloader.
Now you must find the active official boards package file for the avr boards. It could be installed with IDE, so under the IDE installation folder or under arduino15 folder in home directory. If you can't find it, write us, what OS do you have.
In the boards package folder create file platform.local.txt next to platform.txt file and put only this one line into this new platform.local.txt file (it overrides the key defined in platform.txt for Yun)
Code: [Select]
tools.avrdude.upload.network_pattern="{network_cmd}" -address {serial.port} -port 65280 -username arduino -password "{network.password}" -sketch "{build.path}/{build.project_name}.bin" -upload /sketch -b
The ArduinoOTA library listens for uploads from arduinoOTA tool used by the IDE. It must be version 1.2.0 of the tool (installed with AVR package 1.6.23).
Any time now the ArduinoOTA library should by available in Library Manager.
You can try the OTEthernet example.
This last part I'm not clear on. I have created the file
arduino-1.8.8\hardware\arduino\avr\platform.local.txt and added the line
Code: [Select]
tools.avrdude.upload.network_pattern="{network_cmd}" -address {serial.port} -port 65280 -username arduino -password "{network.password}" -sketch "{build.path}/{build.project_name}.bin" -upload /sketch -b
but I'm not sure it's in the correct location. I have also installed your ArduinoOTA library.
I flashed the OTEthernet example via USB. The serial output shows it has an IP assigned via DHCP. How do I now upload via network? Should there be a new option in tools->ports?

Juraj

but I'm not sure it's in the correct location. I have also installed your ArduinoOTA library.
I flashed the OTEthernet example via USB. The serial output shows it has an IP assigned via DHCP. How do I now upload via network? Should there be a new option in tools->ports?
yes a network port should appear in Ports menu. sometimes it takes time or a restart of IDE

on Windows the location of Boards Manager installed packages is %userprofile%\AppData\Local\Arduino15\packages\ (AppData is a hidden folder)
the location of avr package installed with IDE is C:\Program Files (x86)\Arduino\hardware\arduino\avr

m_elias

on Windows the location of Boards Manager installed packages is %userprofile%\AppData\Local\Arduino15\packages\ (AppData is a hidden folder)
the location of avr package installed with IDE is C:\Program Files (x86)\Arduino\hardware\arduino\avr
https://www.arduino.cc/en/Guide/PortableIDE
As I mentioned, I'm using a portable installation so neither of those two locations exist. I do have 3 instances of platform.txt.
arduino-1.8.8\hardware
arduino-1.8.8\hardware\arduino\avr
arduino-1.8.8\portable\sketchbook\hardware\my_boards\avr

Is my platform.local.txt file correct? I have tried with it in all 3 locations, my network firewall is disabled and the only ports I see are my COM ports. COM24 is the Mega2560.

Juraj

https://www.arduino.cc/en/Guide/PortableIDE
As I mentioned, I'm using a portable installation so neither of those two locations exist. I do have 3 instances of platform.txt.
arduino-1.8.8\hardware
arduino-1.8.8\hardware\arduino\avr
arduino-1.8.8\portable\sketchbook\hardware\my_boards\avr

Is my platform.local.txt file correct? I have tried with it in all 3 locations, my network firewall is disabled and the only ports I see are my COM ports. COM24 is the Mega2560.
arduino-1.8.8\hardware\arduino\avr is the location for platform.local.txt, but this has no influence on network port detection in IDE.

the library propagates a mDns record with UDP broadcast and this record should be received by mdns service on the computer. IDE reads mdns records detected by the OS. when you used the esp8266 ArduinoOTA library did you have the network port in IDE? do you have mdns enabled on your computer?


m_elias

arduino-1.8.8\hardware\arduino\avr is the location for platform.local.txt, but this has no influence on network port detection in IDE.
So is this file there just for the Yun?
the library propagates a mDns record with UDP broadcast and this record should be received by mdns service on the computer. IDE reads mdns records detected by the OS. when you used the esp8266 ArduinoOTA library did you have the network port in IDE? do you have mdns enabled on your computer?
Do I need the esp8266 boards installed? I installed your ArduinoOTA library from github.
I did some googling and it sounds like Apple's Bonjour service is the best option for a lightweight mDNS on Windows 7 so I installed it. Then I started testing the ESP8266 OTA examples on my nodeMCU. I can successfully flash my nodeMCU via the IDE & network with the OTA-mDNS-SPIFFS example. Then I managed to flash my optiboot mega once and the IDE thought it worked and I could see the mega rebooting several times but the LED13 blink pattern never changed according to my sketch. Then neither network port showed up even after several IDE restarts. This mDNS business seems quite unreliable. Is there an easy way to flash via command line if I know my IP address?

Juraj

So is this file there just for the Yun?Do I need the esp8266 boards installed? I installed your ArduinoOTA library from github.
I did some googling and it sounds like Apple's Bonjour service is the best option for a lightweight mDNS on Windows 7 so I installed it. Then I started testing the ESP8266 OTA examples on my nodeMCU. I can successfully flash my nodeMCU via the IDE & network with the OTA-mDNS-SPIFFS example. Then I managed to flash my optiboot mega once and the IDE thought it worked and I could see the mega rebooting several times but the LED13 blink pattern never changed according to my sketch. Then neither network port showed up even after several IDE restarts. This mDNS business seems quite unreliable. Is there an easy way to flash via command line if I know my IP address?
no no it has nothing to do with esp8266. only the same system is used in for network port detection.
do you use the latest Ethernet library? (2.00). does Ethernet shield connect to network, get IP address? WebClient example works?
yes the mDNS is whimsical. but more with esp8266 then Ethernet shield so I wonder what is wrong.
things are independent.
the special bootloader is required only for the flash operations, it has nothing to do with networking.
the TCP upload server in the library is independent from the UDP mDns network-port propagation part.
and the upload tool doesn't need mdns, only the IDE doesn't allow to enter the IP address directly.
you could try the upload from command line.

Code: [Select]
packages/arduino/tools/arduinoOTA/1.2.1/bin/arduinoOTA -address 192.168.1.8 -port 65280 -username arduino -password password -sketch /temp/2q2ttt353/OTEthernet.ino.bin -upload /sketch -b
(your paths will be different)

m_elias

I have the newest Ethernet library. Everything else works except mDNS is unreliable. Command line flashing over network is working well!

Is there much memory to be saved by eliminating the mDNS parts of your ArduinoOTA library? I won't be flashing much via network, only the occasional update so manual command line is not too much effort for me. I don't think I need to bother with mDNS at all then. For testing at my desk, I will use USB.

Juraj

I have the newest Ethernet library. Everything else works except mDNS is unreliable. Command line flashing over network is working well!

Is there much memory to be saved by eliminating the mDNS parts of your ArduinoOTA library? I won't be flashing much via network, only the occasional update so manual command line is not too much effort for me. I don't think I need to bother with mDNS at all then. For testing at my desk, I will use USB.
you can modify ArduinoOTA.h in the library. replace
ArduinoOTAMdnsClass <EthernetServer, EthernetClient, EthernetUDP> ArduinoOTA;
with
ArduinoOTAClass <EthernetServer, EthernetClient> ArduinoOTA;

but I don't know if it makes a difference for Mega

Juraj

here is something about IDE and mdns
https://github.com/arduino/Arduino/issues/8408

Go Up