GithubHelp home page GithubHelp logo

esp_dfu_firmware's Introduction

Contributors Forks Stargazers Issues MIT License LinkedIn


Esp8266_DFU_Firmware

A minimal DFU firmware for ESP8266 devices to allow OTA update for "over 50% size" firmware
Changelog · ESP_DFU_Firmware Bug · Request Feature

Buy Me A Coffee

Table of Contents

About The Project

ESP8266 MCU are fantastic microcontrollers with a lot of features but one limit can be very ugly. If you use OTA firmware update only the half of the memory can be used.

This is a minimal DFU firmware to allow ESP OTA update for big firmware!

How it work

The basic concept is quite simple. The OTA ESP copies the new firmware to the "free" part of the flash and then on boot "overwrites" the previous one before do the real flash booting.

So the basic requirement is that there is enough free Flash to load the new firmware before booting.... so only the 50% of the flash can be used!

Problem: If on an ESP with 1Mb of memory your firmware is bigger than 500Kb the OTA goes wrong and you need to use serial programmer.

Solution: Before running your firmware OTA, a smaller firmware OTA was run with only the code strictly necessary, effectively freeing up space for the larger firmware OTA.

Built With and for

The actual version is designed to work with PlatformIO on an Unix ( Linux / MacOS ) environment.

Tested Hardware

  • ESP-01 (ESP8266 80MHz, 80KB RAM, 1MB Flash) Chinese clone

Quick start

The project is meant to be used as a module for another project. The advice is to insert it as git submodule.

Currently only integration with PlatformIO has been developed and tested!

Platform IO integration

  • In your project directory checkout DFU project as module
    $ git submodule add https://github.com/dianlight/ESP_DFU_Firmware.git
    This command create a new subdirectory called ESP_DFU_Firmware
  • [Optional] Configure your DFU firmware editing ${your ptoject dir}/ESP_DFU_Firmware/include/Config.h @See Config
  • Modify platform.ini in your project
    • Add a new section and configure it @See Config
    [esp_dfu]
    custom_dfu_project_dir = ./ESP_DFU_Firmware
    custom_dfu_wait_time = 34
    custom_dfu_build_flags =
      ;-DSERIAL_DEBUG
      -DMDNS_NAME=smarttemp 
      "-DMESSAGE=OTA in progress..."
      -DUSE_WIFIMANAGER  
      ; Display are 0=SSD1306Wire | 1=SH1106Wire | 2=SSD1306Spi | 3=SH1106SPi
      -DUSE_DISPLAY=1 
      -DI2C_OLED_ADDRESS=0x3C
    
    • Add the script to your [env:..] under extra_script
    extra_scripts = 
      ${esp_dfu.custom_dfu_project_dir}/integrations/pio/dfu_trigger.py

Features

This are a list of features implemented in the DFU project

  • WiFi autoconnect ( use the last successfull connection )
  • mDNS autoregister
  • WifiManager integration [Optional]
  • Display [Optional]
    • I2C
      • SSD1306 based OLED ( Untested! )
      • SH1106 based OLED
    • SPI
      • SSD1306 based OLED ( Untested! )
      • SH1106 based OLED ( Untested! )

Config options

All standard options can ben configured from "calling" project in the [esp_dfu] section:

custom_dfu_project_dir (REQUIRED)

The relative path to the ESP_DFU_Firmware project. If you follow the Quick start instruction is ./ESP_DFU_Firmware

custom_dfu_wait_time (DEFAULT 35)

Number of seconds between the OTA of the DFU firmware and the ready running on MCU. For ESP-01 35 secons should be ok

`custom_dfu_build_flags' (DEFAULT see below)

Build dlags used to configure the DFU Firmware. Passwd in the form -D<FLAG>=<VALUE>

SERIAL_DEBUG (OPTIONAL)

Debug message the Serial of the MCU

MDNS_NAME (REQUIRED)

The name fo mDNS of the decide. It used to connect and upload the DFU and for register after DFU boot.

MESSAGE (DEFAULT Ready for OTA:)

The messagge to display when DFU is running

USE_WIFIMANAGER (OPTIONAL)

Use the WiFiManager system if no WiFi can be connected after the boot. I use some Flash size but is usefull to UNBRICK your device if there was WiFi issue during update process.

USE_DISPLAY (OPTIONAL)

Display status on display during the OTA process. The value is the display type/connection

  1. SSD1306 I2C ( on ESP-01 the pin used are GPIO0->SDA, GPIO1->SDC)
  2. SH1106 I2C ( on ESP-01 the pin used are GPIO0->SDA, GPIO1->SDC)
  3. SSD1306 SPI
  4. SH1106 SPI

I2C_OLED_ADDRESS (DEFAULT 0x3C)

If a I2C display is used is the address of the Display.

Roadmap

See the open issues for a list of proposed features (and known issues).

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the GPL3 License. See LICENSE for more information.

Contact

Project Link: https://github.com/dianlight/ESP_DFU_Firmware

esp_dfu_firmware's People

Contributors

dianlight avatar

Watchers

 avatar  avatar  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.