Giter Site home page Giter Site logo

lotkao / arduinoota Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jandrassy/arduinoota

0.0 1.0 0.0 78 KB

Arduino library to upload sketch over network to Arduino board with WiFi or Ethernet libraries

License: GNU Lesser General Public License v2.1

C++ 81.56% C 18.44%

arduinoota's Introduction

Arduino library to upload sketch over network to supported Arduino board

This library allows you to update sketches on your board over WiFi or Ethernet.

The library is a modification of the Arduino WiFi101OTA library.

network port in IDE

Supported micro-controllers

  • ATmega AVR with at least 64 kB of flash (Arduino Mega, MegaCore MCUs, MightyCore 1284p and 644)
  • Arduino SAMD boards like Zero, M0 or MKR and the new "Nano 33 IoT"
  • nRF5 board supported by nRF5 core.
  • boards supported by ESP8266 and ESP32 Arduino boards package

Supported networking libraries

  • Ethernet library - Ethernet shields and modules with Wiznet 5100, 5200 and 5500 chips
  • WiFi101 - WiFi101 shield and MKR 1000
  • WiFiNINA - MKR 1010, MKR 4000, Nano 33 IoT and any supported MCU with attached ESP32 as SPI network adapter with WiFiNINA firmware
  • WiFiEspAT - esp8266 as network adapter with AT firmware
  • WiFiLink - esp8266 as network adapter with WiFiLink firmware (SPI or Serial)
  • UIPEthernet - shields and modules with ENC28j60 chip
  • WiFiSpi - esp8266 as SPI network adapter with WiFiSpi library updated with this PR
  • WiFi - Arduino WiFi Shield (not tested)
  • WiFi library of ESP8266 and ESP32 Arduino boards package

UIPEthernet, WiFiSpi and WiFi library don't support UDP multicast for MDNS, so Arduino IDE will not show the network upload port. WiFiEspAT and WiFiLink doesn't support UDP multicast, but the firmware propagates the MDNS record.

Installation

The library is in Library Manager of the Arduino IDE.

Arduino SAMD boards (Zero, M0, MKR, Nano 33 IoT) are supported 'out of the box'.

For nRF5 boards two lines need to be added to platform.txt file of the nRF5 Arduino package (until the PR that adds them is accepted and included in a release). Only nRF51 was tested until now. For details scroll down.

For ESP8266 and ESP32 boards, platform.local.txt from extras folder need to be copied into boards package installation folder and the bundled ArduinoOTA library must be deleted. For details scroll down.

ATmega boards require to flash a modified Optiboot bootloader for flash write operations. Details are below.

ATmega support

The size of networking library and SD library limit the use of ArduinoOTA library to ATmega MCUs with at least 64 kB flash memory.

There are other network upload options for here excluded ATmega328p: (Ariadne bootloader for Wiznet chips, WiFiLink firmware for the esp8266).

For upload over InternalStorage, Optiboot bootloader with copy_flash_pages function is required. MegaCore 2.0.2 bootloader source has copy_flash_pages functions. (The build hex files do not contain it.)

Most common ATmega board with more then 64 kB of flash memory is Arduino Mega. To use it with ArduinoOTA library, you can't use it directly with the Arduino AVR package, because the package doesn't have the right fuse settings for Mega with Optiboot. 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.

For SDStorage a 'SD bootloader' is required to load the uploaded file from the SD card. There is no good SD bootloader. 2boots works only with not available old types of SD cards and zevero/avr_boot doesn't yet support USB upload of sketch. The SDStorage was tested with zevero/avr_boot. The ATmega_SD example shows how to use this ArduinoOTA library with SD bootloader.

To use remote upload from IDE with SDStorage or InternalStorage, copy platform.local.txt from extras/avr folder, next to platform.txt in the boards package used (Arduino-avr or MCUdude packages). Packages are located in ~/.arduino15/packages/ on Linux and %userprofile%\AppData\Local\Arduino15\packages\ on Windows (AppData is a hidden folder). The platform.local.txt contains a line to create a .bin file and a line to override tools.avrdude.upload.network_pattern, because in platform.txt it is defined for Yun.

The IDE upload tool is installed with Arduino AVR core package. At least version 1.2 of the arduinoOTA tool is required. For upload from command line without IDE see the command template in extras/avr/platform.local.txt.

ESP8266 and ESP32 support

The ArduinoOTA library bundled with ESP8266 and ESP32 Arduino packages works only with native WiFi libraries. This library allows to upload a sketch to esp8266 or esp32 over Ethernet with Ethernet or UIPEthernet library. Upload over the native WiFi library works too.

To use this library instead of the bundled library, the bundled library must be removed from the boards package library folder. To override the configuration of OTA upload in platform.txt, copy the platform.local.txt file from extras folder of this library next to platform.txt file in boards package installation folder. Packages are located in ~/.arduino15/packages/ on Linux and %userprofile%\AppData\Local\Arduino15\packages\ on Windows (AppData is a hidden folder).

The esp8266 boards package has bundled Ethernet library. It is an old version of the Arduino Ethernet library which works only with W5100 chips. It is better to remove it from boards package and install the Ethernet library from Library Manager in IDE.

This library supports SPIFFS upload to esp8266 and esp32, but the IDE plugins have the network upload tool hardcoded to espota. It can't be changed in configuration. To upload SPIFFS, call the plugin in Tools menu and after it fails to upload over network, go to location of the created bin file and upload the file with arduinoOTA tool from command line. The location of the file is printed in the IDE console window. Upload command example (linux):

~/arduino-1.8.8/hardware/tools/avr/bin/arduinoOTA -address 192.168.1.107 -port 65280 -username arduino -password password -sketch OTEthernet.spiffs.bin -upload /data -b

(the same command can be used to upload the sketch binary, only use -upload /sketch)

nRF5 support

Note: Only nRF51 was tested for now

If SoftDevice is not used, the sketch is written from address 0. For write to address 0 the sketch must be compiled with -fno-delete-null-pointer-checks.

For SD card update use SDUnRF5 library.

To use remote upload from IDE, add lines from this PR to sandeepmistry/hardware/nRF5/0.6.0/platform.txt at the end of section "OpenOCD sketch upload":

If you use SoftDevice, stop BLE before applying update. Use ArduinoOTA.beforeApply to register a callback function. For example in setup ArduinoOTA.beforeApply(shutdown); and add the function to to sketch:

void shutdown() {
  blePeripheral.end();
}

Boards tested

  • SAMD
    • Arduino MKR Zero
    • Crowduino M0 SD
  • nRF5
    • Seeed Arch Link
  • ATmega
    • Arduino Mega
    • Badio 1284p
  • esp8266
    • Wemos D1 mini
  • esp32
    • ESP32 Dev Module

Contribution

Please report tested boards.

Other ARM based MCUs could be added with code similar to SAMD and nRF5.

arduinoota's People

Contributors

agdl avatar cmaglie avatar facchinm avatar jandrassy avatar marcusjoh avatar sandeepmistry avatar tommag avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.