{"id":20726661,"url":"https://github.com/embeddedartistry/athena-bootloader","last_synced_at":"2025-04-23T18:41:51.442Z","repository":{"id":43007509,"uuid":"221288939","full_name":"embeddedartistry/athena-bootloader","owner":"embeddedartistry","description":"An AVR Arduino bootloader that supports uploads over Ethernet (via TFTP) and Serial.","archived":false,"fork":false,"pushed_at":"2022-03-25T19:46:45.000Z","size":2724,"stargazers_count":13,"open_issues_count":22,"forks_count":5,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-03-30T02:22:56.151Z","etag":null,"topics":["arduino","arduino-ethernet","arduino-ide","arduino-sdk","arduino-uno","ariadne-bootloader","bootloader","ethernet-shield","hacktoberfest","serial","tftp-bootloader","tftp-server"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-2.1","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/embeddedartistry.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"docs/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-11-12T18:50:56.000Z","updated_at":"2025-02-12T03:43:46.000Z","dependencies_parsed_at":"2022-09-07T17:35:31.739Z","dependency_job_id":null,"html_url":"https://github.com/embeddedartistry/athena-bootloader","commit_stats":null,"previous_names":[],"tags_count":54,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/embeddedartistry%2Fathena-bootloader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/embeddedartistry%2Fathena-bootloader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/embeddedartistry%2Fathena-bootloader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/embeddedartistry%2Fathena-bootloader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/embeddedartistry","download_url":"https://codeload.github.com/embeddedartistry/athena-bootloader/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250493322,"owners_count":21439734,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arduino","arduino-ethernet","arduino-ide","arduino-sdk","arduino-uno","ariadne-bootloader","bootloader","ethernet-shield","hacktoberfest","serial","tftp-bootloader","tftp-server"],"created_at":"2024-11-17T04:26:32.639Z","updated_at":"2025-04-23T18:41:51.424Z","avatar_url":"https://github.com/embeddedartistry.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Athena Bootloader for Arduino\n\nAthena is an Ethernet- and Serial-capable bootloader for Arduino. Using an Arduino Ethernet board or Wiznet W5x00 shield, you can upload programs to your Arduino over Ethernet. Athena starts a TFTP server on the Arduino board, and files can be transferred using any TFTP client.\n\nEmbedded Artistry has forked this bootloader version from the [original project](https://github.com/loathingKernel/ariadne-bootloader), which seems to be no longer actively maintained. We are making many improvements and enhancements to the previous implementation.\n\nAthena is implemented for AVR chips. ARM chips cannot use this bootloader.\n\nBootloader binary files for different versions can be found on the [Releases](https://github.com/embeddedartistry/athena-bootloader/releases) page.\n\n**Table of Contents:**\n\n1. [Getting the Bootloader](#getting-the-bootloader)\n\t1. [git-lfs](#git-lfs)\n1. [Dependencies](#dependencies)\n\t1. [avr-gcc](#avr-gcc)\n\t1. [avrdude](#avrdude)\n1. [Supported Boards](#supported-boards)\n\t1. [Notes on ATMega32U4 Support](#notes-on-atmega32u4-support)\n\t1. [Notes on WIZnet Shields](#notes-on-wiznet-shields)\n\t1. [Other Tested Boards](#other-tested-boards)\n1. [Repository Structure](#repository-structure)\n1. [Quickstart Checklist](#quickstart-checklist)\n2. [Related Documents](#related-documents)\n1. [Downloading and Building the Bootloader](#downloading-and-building-the-bootloader)\n1. [Installing the Bootloader Project](#installing-the-bootloader-project)\n\t1. [Arduino SDK Installation](#arduino-sdk-installation)\n\t1. [Atmel Studio Installation](#atmel-studio-installation)\n1. [Flashing the Bootloader](#flashing-the-bootloader)\n\t1. [Programming Hardware Requirements](#programming-hardware-requirements)\n\t2. [Connecting Pins](#connecting-pins)\n\t3. [Programming with Arduino IDE](#programming-with-arduino-ide)\n\t4. [Programming with Atmel Studio](#programming-with-atmel-studio)\n\t4. [Programming with AVRDUDE](#programming-with-avrdude)\n1. [Flashing Applications via Serial](#flashing-applications-via-serial)\n1. [Flashing Applications via TFTP](#flashing-applications-via-tftp)\n\t1. [Converting Your Sketch to the Right Format](#converting-your-sketch-to-the-right-format)\n\t1. [Using a TFTP Client to Upload the Sketch](#using-a-tftp-client-to-upload-the-sketch)\n\t\t1. [Windows Upload](#windows-upload)\n\t\t1. [Linux and OS X Upload](#linux-and-os-x-upload)\n\t\t\t1. [Linux TFTP Note](#linux-tftp-note)\n1. [Enabling Remote Reset and Reprogram Capabilities](#enabling-remote-reset-and-reprogram-capabilities)\n\t1. [Reprogramming Without The Reset Server Library](#reprogramming-without-the-reset-server-library)\n1. [Changing the Ethernet CS Pin](#changing-the-ethernet-cs-pin)\n2. [Enabling Ethernet Reset Behavior](#enabling-ethernet-reset-behavior)\n1. [Troubleshooting](#troubleshooting)\n1. [EEPROM Requirements](#eeprom-requirements)\n1. [Test Binaries](#test-binaries)\n1. [Supporting Libraries](#supporting-libraries)\n1. [Useful References](#useful-references)\n1. [Acknowledgments](#acknowledgments)\n\t1. [Contributors](#contributors)\n\t2. [Donors](#donors)\n1. [License](#license)\n\n## Cloning the Repository\n\nTo download this repository for local development, we recommend cloning with the `--recursive` flag to ensure submodules (e.g., [supporting libraries](#supporting-libraries)) are automatically downloaded.\n\n```\n$ git clone https://github.com/embeddedartistry/athena-bootloader.git --recursive\n```\n\nYou can also download submodules after cloning with:\n\n```\n$ git submodule update --init --recursive\n```\n\nYou can also [access .zip archives from latest release page](https://github.com/embeddedartistry/athena-bootloader/releases/latest). Download the latest ProjectFile .zip archive for the latest release, which contains the full source tree (including submodules) and populated binary files. This is what you should use for populating the Arduino hardware folder.\n\n### git-lfs\n\nThis project requires you to use [git-lfs](https://git-lfs.github.com). Images and documentation are stored within git-lfs. If you have git-lfs installed, these files will downloaded correctly when cloning the repository.\n\nIf you do not have this installed, please visit [the git-lfs web page](https://git-lfs.github.com) for installation instructions.\n\nIf you cloned this repository before installing git-lfs, please run `git lfs pull`. If you have git-lfs installed before cloning the repository, git will automatically perform a `git lfs pull` for you.\n\nWhen you don't have git-lfs installed, you will see all of the files in the repository. However, files stored with git-lfs will show up as small placeholders. Trying to use these files will result in errors.\n\n## Dependencies\n\nThis project requires Arduino SDK 1.15 or later due to the project's source layout.\n\nThe following dependencies are required to compile and use this bootloader:\n\n* [avr-gcc](#avr-gcc)\n* [avrdude](#avrdude)\n\n### avr-gcc\n\nIf you have the Arduino IDE or Atmel Studio installed on your system, you already have avr-gcc.\n\nFor manual installation on Linux/WSL:\n\n```\n$ sudo apt-get install gcc-avr binutils-avr avr-libc gdb-avr\n```\n\nFor manual installation on OS X using [Homebrew](https://brew.sh):\n\n```\nbrew tap osx-cross/avr\nbrew install avr-libc\nbrew install avrdude --with-usb\n```\n\nFor manual download of the command line tools, see [the compiler page](https://www.microchip.com/mplab/avr-support/avr-and-arm-toolchains-c-compilers).\n\n### avrdude\n\nIf you have the Arduino IDE installed on your system, you already have avr-gcc.\n\nFor manual installation on Linux/WSL:\n\n```\nsudo apt-get install avrdude\n```\n\nFor manual installation on OS X using [Homebrew](https://brew.sh):\n\n```\nbrew install avrdude --with-usb\n```\n\nFiles can be [manually downloaded from the AVRDUDE project here](http://savannah.nongnu.org/projects/avrdude).\n\nFor information on integrating avrdude with Atmel Studio, see these links:\n\n* [Integrate avrdude with Atmel Studio](https://www.asensar.com/guide/arduino_atemlstudio/integrate-avrdude-with-atmel-studio.html)\n* [Arduino to Atmel Studio 7 external programmers, ISP and serial programming](https://www.avrfreaks.net/forum/arduino-atmel-studio-7-external-programmers-isp-and-serial-programming)\n* [How to Load Programs to an Arduino UNO from Atmel Studio 7](https://medium.com/jungletronics/how-to-load-programs-to-an-arduino-uno-from-atmel-studio-7-83c8dd8d175d)\n\n## Supported Boards\n\nOfficially supported MCUs:\n\n* __ATmega328__\n* __ATmega2560__\n* __ATmega1284__\n* __ATmega32U4__ ([see notes](#notes-on-atmega32u4-support))\n\nOfficially supported Ethernet controllers ([see notes](#notes-on-wiznet-shields)):\n\n* __WizNet W5100__\n* __WizNet W5200__\n* __WizNet W5500__\n\nOfficially supported Arduino Boards:\n\n* [Arduino Ethernet][17]\n* [Arduino Uno][18]\n* [Arduino Duemilanove w/ ATmega328][19]\n* [Arduino Mega 2560][20]\n\n### Notes on ATmega32U4 Support\n\nThe ATmega32U4 is supported, but the chip cannot support uploads over USB serial. It should be possible to upload sketches over the serial port (non-USB), but this has not been tested. The Caterina bootloader requires the majority of bootloader space to implement USB support. It is unclear whether both USB and Ethernet support can be implemented for this chip.\n\n### Notes on WIZnet Shields\n\nOn WIZnet shields pins 11,12, and 13 are **tied up** (by default) with the corresponding pins on the ICSP header.  For more information on handling these pins, see [this document](docs/spi_on_wiznet_ethernet_shields.md).\n\n### Other Tested Boards\n\nThese boards have been reported to work with the Athena bootloader:\n\n* [ITead Studio IBoard][21]\n* [Sparkfun Ethernet Pro][22]\n* [XBoard Relay][28]\n\nIf you think another board can be added to this list, please [contact us](mailto:contact@embeddedartistry.com).\n\n## Repository Structure\n\nThis repository is structured to follow the [latest Arduino IDE standard for 3rd-party hardware](https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5-3rd-party-Hardware-specification). Here is an overview of the structure:\n\n* [`avr/`](avr): This is where the bootloader code, pre-built binaries, and helper libraries live\n\t- [`bootloaders/athena/`](avr/bootloaders/athena) contains the pre-built bootloader `.hex` files, as well as [source code for the bootloader](avr/bootloaders/athena/src)\n\t- [`libraries/`](avr/libraries) contains helper libraries that are used to interact with the bootloader from an Arduino application\n\t- [`variants/`](avr/variants) contains additional board definitions\n* [`docs/`](docs) contains additional reference documentation, images, and GitHub templates\n* [`extras/`](extras) contains miscellaneous useful utilities\n\n## Quickstart Checklist\n\nThis is the abbreviated checklist for installing and using the bootloader:\n\n1. [Download the bootloader](#download-the-bootloader) and [install it to the proper location](#arduino-sdk-installation)\n\t1. Just need the bootloader binaries? Check the [releases page](https://github.com/embeddedartistry/athena-bootloader/releases).\n1. [Flash the bootloader to the device](flashing-the-bootloader)\n2. **DO NOT SKIP:** Program network settings for the device using the [`AthenaEEPROM`](#supporting-libraries) library or [example sketches](https://github.com/embeddedartistry/AthenaEEPROM/tree/master/examples)\n\t1. More information available in [docs/network_configuration.md](docs/network_configuration.md)\n3. Include the [`AthenaEthernetReset`](#supporting-libraries) library in your application (or use the [`ResetServer` example sketch](https://github.com/embeddedartistry/AthenaEthernetReset/blob/master/examples/AthenaResetServer/AthenaResetServer.ino)\n\t1. Create a reset server and specify a port\n\t2. Call `.begin()` on the server object in `setup()`\n\t3. Call `.check()` on the server object in `loop()`\n4. When your application is running, trigger a reprogramming mode using curl or a web browser\n\t1. URL Format: `http://{ip}:{port}/{reset_path}/reprogram`\n\t\t1. Example using default settings: `curl 192.168.1.128:8080/athena/reprogram`\n\t2. The device will respond with:\n\t\t1. \"Arduino will reset for reprogramming in 2 seconds\"\n\t3. You must use the \"password\" programmed via the AthenaEEPROM library to successfully enter the programming mode. The default password is `athena`\n5. Follow the [TFTP Upload](#flashing-applications-via-tftp) instructions to send a new binary to the device\n\nNot able to connect to the device? Check out the [debugging guide](docs/Debugging.md).\n\nNeed to use a custom board file for compiling and uploading sketches? Once you've flashed the bootloader, you can do that safely. You will need to install the [AthenaEthernetReset](https://github.com/embeddedartistry/AthenaEthernetReset) and [AthenaEEPROM](https://github.com/embeddedartistry/AthenaEEPROM) libraries separately, however, because the IDE only picks them up in the bootloader folder if you've selected an Ariadne configuration.\n\n## Related Documents\n\n* [Compiling Instructions](docs/compiling.md) for anyone looking to modify the bootloader\n* [AVRDUDE Instructions](docs/avrdude.md) for manually flashing outside of the Arduino IDE or Atmel Studio using AVRDUDE\n* [Debugging Guide](docs/Debugging.md) provides pointers for debugging failures to connect to the device\n* [Network Configuration](docs/network_configuration.md) provides pointers on configuring the network settings for your device\n* [Converting Binaries for TFTP Upload](docs/converting_binaries.md) provides more detailed instructions on the conversion process, with example locations for each OS when using the Arduino IDE\n\n## Downloading and Building the Bootloader\n\nYou can clone the repository from GitHub:\n\n```\n$ git clone https://github.com/embeddedartistry/athena-bootloader --recursive\n```\n\nIf you have configured your GitHub account with SSH keys, you can also use the SSH checkout:\n\n```\n$ git clone git@github.com:embeddedartistry/athena-bootloader.git --recursive\n```\n\nNote that you must use the `--recursive` flag because the project contains submodules. If you cloned without the `--recursive` flag, perform:\n\n```\n$ git submodule update --init\n```\n\nTo build binaries within the repository, run `make`.\n\nYou can also download a zip archive of the repository from [the GitHub repository page](https://github.com/embeddedartistry/athena-bootloader).\n\n## Installing the Bootloader Project\n\n1. [Arduino SDK Installation](#arduino-sdk-installation)\n1. [Atmel Studio Installation](#atmel-studio-installation)\n\n### Arduino SDK Installation\n\n\nYou have two options for installing the bootloader:\n\n1. Use the board manager\n2. Manual installation\n\n#### Board Manager Installation\n\nFollow [these Arduino IDE instructions for **Third Party Boards**](https://support.arduino.cc/hc/en-us/articles/360016119519-How-to-add-boards-in-the-board-manager), and add this custom URL: https://raw.githubusercontent.com/embeddedartistry/athena-bootloader/master/package_athena-bootloader_index.json .\n\nOnce that URL is added, navigate to Tools -\u003e Boards submenu -\u003e Board manager. You will be able to search for \"Athena\" and then install the board package.\n\n#### Manual Installation\n\nIn order for the Arduino IDE to access the information, you need to place the `athena-bootloader` repository within the `hardware/` folder of your \"Sketchbook Location\". You can find this location by viewing the Arduino IDE settings. The default location is often the `Arduino/` folder in your home directory or in `Documents/`.\n\nFor our system, which is OS X, the Sketchbook location is:\n\n```\n/Users/embeddedartistry/Documents/Arduino\n```\n\nOn Windows, it should be in `My Documents\\Arduino\\`.\n\nOur Sketchbook folder does not have a `hardware` directory by default. We created the folder ourselves:\n\n```\n$ mkdir -p /Users/embeddedartistry/Documents/Arduino/hardware\n```\n\nYou can go to [the releases page]() and download the `athena_bootloaders-VERSION.zip` file for a given release, unzipping that in the target directory.\n\nYou can also clone the repository within that directory, or you can use a symbolic link within the `hardware/` folder:\n\n```\n$ cd /Users/embeddedartistry/Documents/Arduino/hardware\n$ ln -s ~/src/athena-bootloader/ ./athena\n```\n\nIf you cloned the repository, you will need to build the bootloader files.\n\n```\n$ make\n```\n\nIn either case, once the `athena-bootloader` folder is placed in the `hardware/` folder, Arduino will detect it. Restart the IDE if it is already open. You should now see the Athena bootloader show up in the board list.\n\n![Image showing the Athena bootloader in boards](docs/boards.png \"Athena Listed in Boards\")\n\n### Atmel Studio Installation\n\nIf you are using Atmel Studio, our recommendation is to use the Visual Micro extension. When you are using the Visual Micro add-on, the standard installation instructions will apply. Then, use the Visual Micro board manager to select the proper Athena board definition for your target. \n\nFor more information, see this link:\n\n* [Visual Micro: The Board Manager](https://www.visualmicro.com/page/User-Guide.aspx?doc=Board-Manager.html)\n\n## Flashing the Bootloader\n\n1. [Programming Hardware Requirements](#programming-hardware-requirements)\n2. [Connecting Pins](#connecting-pins)\n3. [Programming with Arduino IDE](#programming-with-arduino-ide)\n4. [Programming with AVRDUDE](#programming-with-avrdude)\n\n### Programming Hardware Requirements\n\nTo flash the bootloader to a device, you will need an in-system programmer (ISP). You can purchase an [AVR-ISP][2] or [USBtinyISP][3], which work for most Arduino devices. \n\nSome devices do not work reliably with the ATMega2560 due to page size requirements. For the ATMega2560, you will need a ISP such as [Atmel's AVRISP mkII][6], [Atmel's AVRISP STK500 USB ISP Programmer](http://wiki.seeedstudio.com/Atmel_AVRISP_STK500_USB_ISP_Programmer/), [Olimex's AVR-ISP-MK2][7], or any similarly-capable programmer.\n\nIf you have a spare Arduino, you can build a [ParallelProgrammer][4] or an [ArduinoISP][5].  Nick Gammon has published a [guide][8] for using one Arduino to program another, and his method is reported to work with the ATMega2560.\n\n### Connecting Pins\n\nThe programmers should be connected to the `ICSP` pins. On Arduino boards, the ISCP pins are a 2x3 header located near the processor. The board must be powered by an external power supply, by the programmer, or by the USB port. If you are using an _ArduinoISP_, consult [this link][5] for additional instructions.\n\n![Image showing the ISP connected to the board](docs/flashing.png \"ISP Connection Image\")\n\n### Programming With Arduino IDE\n\nAfter you have connected the Arduino board and the programmer to your computer launch the Arduino IDE.\n\nFirst, navigate to the __Tools__ \u003e __Board__ menu and select your target board from the `Athena Bootloader` list (at the bottom in our view).\n\n![Image showing the Athena bootloader in boards](docs/boards.png \"Athena Listed in Boards\")\n\nNext, navigate to the __Tools__ \u003e __Version__ menu and select Wiznet chip from the list, as well as \"Standard\" or \"Debug\" mode. Debug binaries are larger, but contain helpful Serial output for seeing what the bootloader is doing. The *only* difference between Standard and Debug mode is the serial output.\n\n![Image showing the Athena bootloader versions](docs/version.png \"Athena Bootloader Versions\")\n\nBy default, bootloader updates will erase the contents of the EEPROM. Because the Athena EEPROM layout is different from the default layout, this approach is advisable. If you're simply upgrading Athena bootloader versions, you probably want to keep your previously configured device to a new version.\n\nNavigate to the __Tools__ \u003e __Erase EEPROM?__ menu and select `Save` to prevent the EEPROM from being erased.\n\n![Image showing the Erase/Save EEPROM menu](docs/erase_eeprom.png \"Erase Menu\")\n\n\u003e **Note:** If you are manually flashing the application or need to specify fuse settings, use a high_fuse setting of `0xD8` to erase, and `0xD0` to preserve.\n\nNext, go to the __Tools__ \u003e __Programmer__ menu and select the programmer you are using.\n\n![Image showing the tools menu](docs/tools.png \"Programming Tools Menu\")\n\nIn case you are using _ArduinoISP_, make sure that the selected port in the __Tools__ \u003e __Serial Port__ menu refers to the _ArduinoISP_. You should not select the board that you want to burn the bootloader on. This requirement applies to other serial-based programmers, such as the AVR-ISP 2.0 (\"Atmel STK500 Development Board\").\n\nTo flash the bootloader, select the __Tools__ \u003e __Burn Bootloader__ menu option.\n\n![Image showing the Burn Bootloader menu option](docs/burn.png \"Burn Bootloader Menu Option\")\n\nCheck the Arduino console output to confirm that the bootloader was flashed successfully.\n\n### Programming with Atmel Studio\n\nIf you have configured the [Visual Micro board manager](#atmel-studio-implementation), you can configure your programmer and burn in the bootloader in the [visual micro menu](https://www.visualmicro.com/page/User-Guide.aspx?doc=Visual-Micro-Menu.html) similarly to the Arduino IDE.\n\nYou can also [manually flash the bootloader in Atmel Studio](https://wspublishing.net/avr-c/restoring-arduino-mega-bootloader/). For this, you will need to manually supply fuse settings for your configuration. These settings can be found in [boards.txt](avr/boards.txt).\n\n### Programming with AVRDUDE\n\nInstructions on manually programming the bootloader with AVRDUDE are described in [docs/avrdude.md](docs/avrdude.md)\n\n## Flashing Applications via Serial\n\nAthena is built off of the standard Arduino AVR bootloaders. Serial upload capabilities are preserved. Serial uploads work even when an Ethernet shield is not installed.\n\nTo flash an application over USB/Serial:\n\n1. Plug in the USB cable\n2. Select the serial port for the device and the appropriate board from the __Tools__ \u003e __Board__ menu. \n3. Program the device\n\nIf your device has auto-reset capabilities, such that a Serial connection resets the device, programming will work with a sketch is running.\n\nIf your device does not have auto-reset capabilities, then you will need to press the reset button on the device to enter the bootloader mode. In this case, if there is a __valid__ program already flashed on the Arduino, you have to reprogram the device in the next __5 seconds__. If you don't, the bootloader will initiate the program that is already flashed onto the Arduino. In case there is no program flashed or the program has been marked as __invalid__, the bootloader will never time out and you can reprogram it at any time.\n\n\u003e **Note:** For boards other than the Arduino Mega, the primary LED will start blinking rapidly when the bootloader is running.\n\nAfter a successful flashing in either case, the bootloader will automatically start the application.\n\n## Flashing Applications via TFTP\n\nFlashing applications via TFTP requires multiple moving parts. This README references the default network settings and assumes that your network is configured so these settings will work.\n\n```\n* IP Address:  192.168.1.128\n* Subnet Mask: 255.255.255.0\n* Gateway:     192.168.1.1\n* MAC Address: 0xDE.0xAD.0xBE.0xEF.0xFE.0xED\n\n* TFTP Negotiation Port: 69\n* TFTP Data Port: 46969\n```\n\nFor more information on network configuration, see [docs/network_configuration.md](docs/network_configuration.md)\n\n**If the default values will not work, you MUST configure the network settings for the TFTP server in the bootloader and the AthenaEthernetReset server to work correctly with your network configuration.**\n\nThe process flow is:\n\n1. Reset into TFTP mode in the bootloader\n2. Connect to the device\n2. Upload a binary image\n3. After upload completes, the new application auto-boots\n\n### Converting Your Sketch to the Right Format\n\nWhile Arduino serial flashing uses __HEX__ files, the bootloader TFTP server only works with binary files. You must manually convert your programs the `.bin` file format using `avr-objcopy`.\n\nFor detailed instructions, see [docs/converting_binaries.md](docs/converting_binaries.md). Only brief notes are shown here.\n\nThe first step is to find the `.hex` file you want to flash to your device. If you're using the Arduino IDE, look for a line in the build output referencing a `.hex` file. It is placed in a temporary folder, such as this:\n\n```\n/var/folders/0h/_66m4dqj3p1b3j1xqg10r08w0000gn/T/arduino_build_678002/WebServer.ino.hex \n```\n\nCopy that path and use it in with the following command structure:\n\nWindows:\n\n```\n\"C:\\Program Files\\Arduino\\hardware\\tools\\avr\\bin\\avr-objcopy.exe\" -I ihex \"C:\\path\\to\\your\\program.hex\" -O binary program.bin\n```\n\nLinux, WSL, and OS X:\n\n```\navr-objcopy -I ihex /path/to/sketch.hex -O binary sketch.bin\n```\n\n### Using a TFTP Client to Upload the Sketch\n\nTo upload the binary over Ethernet, you will need a TFTP client. All three major OSes have tools that you can use through the command line.\n\nNo matter the OS, the following flow must be used:\n\n1. Put the device into bootloader mode, either via the reset button or the Ethernet Reset Server library.\n2. Connect to the device using TFTP and the configured port (69 by default)\n3. Enable \"octet mode\" or \"binary mode\"\n3. Send the binary file to the device using the `PUT` command\n\nAfter the binary is uploaded, the bootloader will automatically run the application.\n\nIf the upload fails, wait for the upload process on the bootloader to timeout. That takes about __10 seconds__. For this period you should witness the indication led doing some random blinking. Note that the LED on an Arduino Mega will not blink due to contention with the SCK pin.\n\nAfter the timeout the TFTP server should restart itself and wait for a new upload.\n\n#### Windows Upload\n\nWindows provides a `tftp` command that can be used:\n\n```\nMicrosoft Windows XP [Version 5.1.2600]\n(C) Copyright 1985-2001 Microsoft Corp.\n\nC:\\Documents and Settings\\Administrator\u003etftp\n\nTransfers files to and from a remote computer running the TFTP service.\n\nTFTP [-i] host [GET | PUT] source [destination]\n\n\t-i              Specifies binary image transfer mode (also called\n\t\t\t\t\t\t\t\t\toctet). In binary image mode the file is moved literally, byte by byte. Use this mode when transferring binary files.\n\thost            Specifies the local or remote host.\n\tGET             Transfers the file destination on the remote host to\n\t\t\t\t\t\t\t\t\tthe file source on the local host.\n\tPUT             Transfers the file source on the local host to\n\t\t\t\t\t\t\t\t\tthe file destination on the remote host.\n\tsource          Specifies the file to transfer.\n\tdestination     Specifies where to transfer the file.\n```\n\nHere is an example upload command:\n\n```\nC:\\Documents and Settings\\Administrator\u003etftp -i 192.168.1.128 PUT sketch.bin\n```\n\n#### Linux and OS X Upload\n\nLinux and OS X both have a `tftp` command:\n\n```\n$ tftp [ip] [port]\n```\n\nFor the default bootloader, the command would be:\n\n```\n$ tftp 192.168.1.128 69\n```\n\nOr, because 69 is the default TFTP port, you could simply say:\n\n```\n$ tftp 192.168.1.128\n```\n\nYou should be greeted by the TFTP prompt:\n\n```\ntftp\u003e\n```\n\nEnable binary/octet mode to tell TFTP to send binary data:\n\n```\ntftp\u003e mode octet\n```\n\nYou can optionally enable verbose output settings:\n\n```\ntftp\u003e trace\ntftp\u003e verbose\n```\n\nTo send the sketch to the board, issue a `PUT` command:\n\n```\ntftp\u003e put [sketch].bin\n```\n\nYou should see your TFTP client sending packets. A correct output sample of the TFTP client uploading the *blink* sketch is below:\n\n```\ntftp\u003e mode octet\ntftp\u003e trace\nTrace mode on.\ntftp\u003e verbose\nVerbose mode on.\ntftp\u003e put blink.bin\nsent WRQ \u003cfile: blink.bin, mode: octet \u003c\u003e\u003e\nreceived ACK \u003cblock: 0\u003e\nsent DATA \u003cblock: 1, size: 512\u003e\nreceived ACK \u003cblock: 1\u003e\nsent DATA \u003cblock: 2, size: 512\u003e\nreceived ACK \u003cblock: 2\u003e\nsent DATA \u003cblock: 3, size: 512\u003e\nreceived ACK \u003cblock: 3\u003e\nsent DATA \u003cblock: 4, size: 512\u003e\nreceived ACK \u003cblock: 4\u003e\nsent DATA \u003cblock: 5, size: 42\u003e\nreceived ACK \u003cblock: 5\u003e\ntftp\u003e\n```\n\n##### Linux TFTP Note\n\nSome __Linux__ distributions, like __Fedora/RedHat__, require you to load the `ip_conntrack_tftp` module. If you don't, the TFTP client won't be able to acknowledge (__ACK__) the incoming packets. Other distributions, such as __Arch__, don't require this step. \n\nTo load `ip_conntrack_tftp`, run the following:\n\n```\n$ sudo modprobe ip_conntrack_tftp\n```\n\n## Enabling Remote Reset and Reprogram Capabilities\n\nThe [AthenaEthernetReset](#supporting-libraries) library is a requirement for your program if you want to support remotely enabling binary uploads. [A README is provided](https://github.com/embeddedartistry/AthenaEthernetReset/blob/master/README.md) and there is an [example sketch showing the usage of the library](https://github.com/embeddedartistry/AthenaEthernetReset/blob/master/examples/AthenaResetServer/AthenaResetServer.ino).\n\nThe following steps must be used to implement a remote upload capability for your device:\n\n1. Flash the bootloader to the device\n2. Program network settings for the device using the [AthenaEEPROM](#supporting-libraries) library or examples\n3. Include the AthenaEthernetReset library in your application\n\t1. Create a reset server and specify a port\n\t2. Call `.begin()` on the server object in `setup()`\n\t3. Call `.check()` on the server object in `loop()`\n4. Trigger a reset using curl or a web browser\n\t1. URL Format: `http://{ip}:{port}/{password}/reprogram`\n\t\t1. Example: `curl 192.168.1.128:8080/athena/reprogram`\n\t\t2. Note that the `reset` endpoint does not provide a reprogramming opportunity.\n\t2. The device will respond with:\n\t\t1. \"Arduino will reset for reprogramming in 2 seconds\"\n\t3. You must use the \"password\" programmed via the AthenaEEPROM library to successfully enter the programming mode. The default value is `athena`.\n5. Follow the [TFTP Upload](#flashing-applications-via-tftp) instructions to send a new binary to the device\n\n### Reprogramming Without The Reset Server Library\n\nIf you don't want to use the EthernetReset server (because you have your own web server), you can trigger update mode manually with the following function calls:\n\n```\nEEPROM.enableUpdateMode(); // in AthenaEEPROM library\nwatchdogReset(); // from avr/wdt.h\n```\n\nAfter the device resets, it will wait for a firmware update over TFTP or Serial. This mode will not time out. If the device is manually reset, it will boot once more into the image currently installed on the board.\n\n## Changing the Ethernet CS Pin\n\nThe bootloader is programmed to use the default CS pin to talk to the Ethernet controller. If your board is using a custom pin, you can change the pin that the bootloader will use by programming the EEPROM:\n\n```\nEEPROM.setEthernetCSPin(53); // Uses Arduino pin number\n```\n\n## Enabling Ethernet Reset Behavior\n\nBy default, the bootloader does not know about a reset pin. If your hardware requires the bootloader to perform a reset during system boot, you can specify a reset pin using the EEPROM:\n\n```\nEEPROM.setEthernetResetPin(53); // Uses Arduino pin number\n```\n\n## Troubleshooting\n\nIf you're having problems connecting to the device, check out [docs/Debugging.md](docs/Debugging.md) for troubleshooting tips.\n\nIf you see an error like the one below, you only have placeholder git-lfs files. Please see the [git-lfs](#git-lfs) section above for instructions.\n\n```\navrdude: ERROR: No valid record found in Intel Hex file \"C:\\Users\\XXX\\Documents\\Arduino\\hardware\\athena-bootloader-11.1.8\\avr/bootloaders/athena/athena_debug2560_w5500.hex\"\navrdude: read from file 'C:\\Users\\XXX\\Documents\\Arduino\\hardware\\athena-bootloader-11.1.8\\avr/bootloaders/athena/athena_debug2560_w5500.hex' failed\nError while burning bootloader.\n```\n\nIf you see an error like the one below, your submodules are not populated. Please see the instructions on [Getting the Bootloader](#getting-the-bootloader).\n\n```\nInvalid library found in C:\\Users\\XXX\\Documents\\Arduino\\hardware\\athena-bootloader-11.1.8\\avr\\libraries\\AthenaEEPROM: no headers files (.h) found in C:\\Users\\XXX\\Documents\\Arduino\\hardware\\athena-bootloader-11.1.8\\avr\\libraries\\AthenaEEPROM\nInvalid library found in C:\\Users\\XXX\\Documents\\Arduino\\hardware\\athena-bootloader-11.1.8\\avr\\libraries\\AthenaEthernetReset: no headers files (.h) found in C:\\Users\\XXX\\Documents\\Arduino\\hardware\\athena-bootloader-11.1.8\\avr\\libraries\\AthenaEthernetReset\nInvalid library found in C:\\Users\\XXX\\Documents\\Arduino\\libraries\\Archive: no headers files (.h) found in C:\\Users\\XXX\\Documents\\Arduino\\libraries\\Archive\n```\n\n## EEPROM Requirements\n\nAthena uses the Arduino EEPROM to store values needed by the bootloader and AthenaEthernetReset server. If you are using the default EEPROM library for our own purposes, please make sure to start writing after `NETEEPROM_END`, available in `AthenaEEPROM_defs.h`:\n\n```\n#define NETEEPROM_START 0\n#define NETEEPROM_END   (NETEEPROM_START + 70)\n```\n\nFor more information, see the [AthenaEEPROM library](#supporting-libraries).\n\nIf you use the [AthenaEEPROM](#supporting-libraries) library included with the Athena bootloader, then offsets will be handled for you automatically and you will not need to adjust your code. Note, however, that the full EEPROM space is not available.\n\n## Test Binaries\n\nFor testing purposes, you can find a __blink__ sketch in binary form inside the [`extras/tests/blink`](extras/tests/blink) folder. \n\nThe __fade__ sketch in the [`extras/tests/fade`](extras/tests/fade) folder will also give you a view of what a failed upload looks like. This sketch fails because it is written in plain __C__ and not in __Arduino__. That way it lacks some \"signatures\" the bootloader uses to validate _Arduino_ sketches. \n\n## Supporting Libraries\n\nSupporting libraries are included with the bootloader. These libraries are meant to facilitate interacting with the Athena bootloader from Arduino applications.\n\nThese libraries are packaged with the bootloader and will automatically detected by the Arduino IDE when an Athena board configuration is used. If you are using a custom board configuration, you may also want to install these libraries separately so that they are available even when an Athena board configuration is not selected.\n\n* [AthenaEEPROM](https://github.com/embeddedartistry/AthenaEEPROM) (found at `avr/libraries/AthenaEEPROM`) is a patched EEPROM library that protect the memory space used by the Athena bootloader. This library also enables you to read/write the bootloader network settings.\n\t- Use this library in place of the default EEPROM library to prevent settings from being overwritten\n* [AthenaEthernetReset](https://github.com/embeddedartistry/AthenaEthernetReset) (found at `avr/libraries/AthenaEthernetReset`) is a library that can be used to create an HTTP server in an application that enables you to:\n\t- Remotely restart the Arduino application\n\t- Restart into the bootloader in programming mode, which waits for the a binary over TFTP\n\nThe [AthenaEthernetReset](https://github.com/embeddedartistry/AthenaEthernetReset/) library is a requirement for your program if you want to support remotely enabling binary uploads. [A README is provided](https://github.com/embeddedartistry/AthenaEthernetReset/blob/master/README.md) and there is an [example sketch showing the usage of the library](https://github.com/embeddedartistry/AthenaEthernetReset/blob/master/examples/AthenaResetServer/AthenaResetServer.ino).\n\n## Useful References\n\n* [AVR Beginners](http://avrbeginners.net) is an excellent resource for anyone working on this bootloader who is new to the AVR architecture\n\n## Acknowledgments\n\nThe Embedded Artistry version of the Athena bootloader is derived from [loathingkernel/ariadne-bootloader](https://github.com/loathingKernel/ariadne-bootloader). Credit goes to its maintainer, [Stelios Tsampas](https://github.com/loathingKernel).\n\nThe Ariadne bootloader was built upon these open source projects:\n\n* [TFTP-Bootloader][23] (The original base for this project)\n* [Optiboot][24] (Bootloader for the __ATmega328__)\n* [Arduino-stk500v2-bootloader][25] (Bootloader for the __ATmega2560__)\n\n### Contributors\n\n* [AkhileshThorat](https://github.com/AkhileshThorat)\n\nThe following contributors were listed in the [original project](https://github.com/loathingKernel/ariadne-bootloader) README:\n\n* [mharizanov][26] (Commenting some of the initial *Arduino* code, enabling Stelios to take on the project)\n* [follower][27] (Sketches served as a starting point for the included __AthenaEEPROM__ and __AthenaEthernetReset__ libraries)\n* [Arjen Hiemstra](https://github.com/arjenhiemstra) (Provided support for W5200 and W5500)\n* [per1234](https://github.com/per1234) (Testing and tech support in Arduino Forums)\n\n### Donors \n\nThe following donors were listed in the [original project](https://github.com/loathingKernel/ariadne-bootloader) README:\n\n* Hachi Manzur (AVRISP mkII programmer, testing)\n\n## License\n\nAthena is released under the [GPLv2, GNU General Public License][99].\n\n[2]: http://www.atmel.com/dyn/products/tools_card.asp?tool_id=2726\n[3]: http://www.ladyada.net/make/usbtinyisp/\n[4]: http://arduino.cc/en/Hacking/ParallelProgrammer\n[5]: http://arduino.cc/en/Tutorial/ArduinoISP\n[6]: http://www.atmel.com/tools/AVRISPMKII.aspx\n[7]: https://www.olimex.com/Products/AVR/Programmers/AVR-ISP-MK2/\n[8]: http://www.gammon.com.au/forum/?id=11635\n[9]: https://github.com/codebendercc/Athena-Bootloader#configuring-your-router-for-remote-flashing\n[10]: http://youtu.be/KCHqhV6xPMg\n[11]: http://en.wikipedia.org/wiki/Port_forwarding\n[12]: http://portforward.com/english/routers/port_forwarding/\n[13]: http://codebender.cc\n[17]: http://www.arduino.cc/en/Main/ArduinoBoardEthernet\n[18]: http://www.arduino.cc/en/Main/ArduinoBoardUno\n[19]: http://www.arduino.cc/en/Main/ArduinoBoardDuemilanove\n[20]: http://arduino.cc/en/Main/arduinoBoardMega2560\n[21]: http://imall.iteadstudio.com/im120410001.html\n[22]: https://www.sparkfun.com/products/10536\n[23]: https://github.com/arduino/TFTP-Bootloader\n[24]: https://code.google.com/p/optiboot/\n[25]: https://github.com/msproul/Arduino-stk500v2-bootloader\n[26]: https://github.com/mharizanov\n[27]: https://github.com/follower\n[28]: https://wiki.dfrobot.com/X-Board_Relay_SKU_DFR0222_\n[99]: https://www.gnu.org/licenses/gpl-2.0.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fembeddedartistry%2Fathena-bootloader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fembeddedartistry%2Fathena-bootloader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fembeddedartistry%2Fathena-bootloader/lists"}