A minimal DFU firmware for ESP8266 devices to allow OTA update for "over 50% size" firmware
Changelog
·
ESP_DFU_Firmware Bug
·
Request Feature
- Table of Contents
- About The Project
- Quick start
- Features
- Config options
- Roadmap
- Contributing
- License
- Contact
- Acknowledgements
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!
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.
The actual version is designed to work with PlatformIO on an Unix ( Linux / MacOS ) environment.
- ESP-01 (ESP8266 80MHz, 80KB RAM, 1MB Flash) Chinese clone
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
This command create a new subdirectory called ESP_DFU_Firmware
$ git submodule add https://github.com/dianlight/ESP_DFU_Firmware.git
- [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
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! )
- I2C
All standard options can ben configured from "calling" project in the [esp_dfu]
section:
The relative path to the ESP_DFU_Firmware project. If you follow the Quick start instruction is ./ESP_DFU_Firmware
Number of seconds between the OTA of the DFU firmware and the ready running on MCU. For ESP-01 35
secons should be ok
Build dlags used to configure the DFU Firmware. Passwd in the form -D<FLAG>=<VALUE>
Debug message the Serial of the MCU
The name fo mDNS of the decide. It used to connect and upload the DFU and for register after DFU boot.
The messagge to display when DFU is running
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.
Display status on display during the OTA process. The value is the display type/connection
- SSD1306 I2C ( on ESP-01 the pin used are GPIO0->SDA, GPIO1->SDC)
- SH1106 I2C ( on ESP-01 the pin used are GPIO0->SDA, GPIO1->SDC)
- SSD1306 SPI
- SH1106 SPI
If a I2C display is used is the address of the Display.
See the open issues for a list of proposed features (and known issues).
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.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the GPL3 License. See LICENSE
for more information.
Project Link: https://github.com/dianlight/ESP_DFU_Firmware