Giter VIP home page Giter VIP logo

esp-fw's Introduction

esp32-toolkit-lib

ESP32 firmware build lib

Aim is to provide core features to quickly develop ESP32 firmware for various diy projects, as well as a modular architecture to extend firmware's features .

Workspace setup

Remote development

Gitpod workspace is meant to work out of the box pre-configuration and tools already installed.

Just prefix this repository url with gitpod.io/# to launch a fully configured remote workspace.

Local development

  • Download workspace artifact
  • Extract workspace which includes source and project configuration
  • Inside workspace root dir, create following symlinks
    ln -s lib/esp32-toolkit-lib/.config/platformio.ini platformio.ini
    ln -s lib/esp32-toolkit-lib/.config/.gitmodules .gitmodules
    ln -s lib/esp32-toolkit-lib/.config/scripts/replace_fs.py replace_fs.py
    mkdir src && ln -s ../lib/esp32-toolkit-lib/examples/firmware-main.cpp src/main.cpp

An installation of platformIO is required.

Using python package installer pip :

    python -m pip install --upgrade pip
    pip install --upgrade platformio

Wifi configuration

before uploading firmware and filesystem images, wifi settings must be customized in data/config.json file

{
    wifiSSID: "changeme",
    wifiPWD: "changeme"
}

Build

firmware

pio run -e esp32-latest

resulting build file located at .pio/build/esp32-latest/firmware.bin

filesystem image

pio run -t buildfs -e esp32-latest

resulting image file located at .pio/build/esp32-latest/spiffs.bin

Upload

First time, device must be updated manually using serial upload, then it can be updated directly using OTA method.

Serial

Upload 2 previous image files (firmware.bin and spiffs.bin) to the board.

  • firmware: pio run -e esp32-latest -t upload
  • filesystem image: pio run -e esp32-latest -t uploadfs

OTA

If wifi settings were correctly set in config.json file, device can be updated directly using Web updater available at: http://<board IP>/update

(device ip address is automatically displayed over serial interface on each boot).

In web interface, select either firmware and firmware.bin file to update firmware, or filesystem and spiffs.bin image file to update filesystem,

Device Monitoring

Serial monitoring can be done from console:

cat /dev/ttyUSB0

make sure your user has access to serial interface by adding him to the correct group.

Key features and embedded libraries

The lib makes use of the following libs:

  • latest arduino-esp32 framework (docs): mandatory to use littleFS (not available to date in PIO)
  • littleFS filesystem with strong advantage (over SPIFFS) to support directories.
  • ArduinoJson: support for JSON

Architecture

The firmware architecture is made of different modules and services. A module inherits the FirmwareModule class and can overrides setup, loop methods to provide its own implementation. In a similar way, a service provides a custom implementation of another service such as WebSocketService.

Core modules

The firmware can embedd several core modules which implements main device features:

  • network: provides wifi connectivity in both AP (Access Point) and STA (Client) modes
  • filesystem: LittleFS
  • webserver
  • WebSockets Service
  • OTA service

Custom modules

On top of these core modules, firmware can be easily extended through custom modules to provide additional features (such as specific sensor support, ...). To get included in the main update loop, a custom module inherits the FirmwareModule class. As C++ allows multiple inheritance, it can also inherit a service to make use of it.

For instance a module requiring acceess to websockets, will inherit both FirmwareModule and WebSocketService which will forward received message to process them.

Purpose of this project

  • ready to code workspace (available as build artifacts)
  • as less as boilerplate code possible
  • fully automated build process
  • easy to maintain and customize

esp-fw's People

Contributors

etienne-85 avatar

Watchers

 avatar

esp-fw's Issues

Misc

  • use symlinks instead of copying (platformio.ini and main.cpp) during workspace generation

  • try using pio ci to build project and target different firmware source version

esp32 dashboard service

Create a new service as firmware module to provide dashboard monitoring:

  • implement logging over network to notify dashboard UI
  • implement dedicated dashboard websocket or rest API to handle requests coming from client (browser)
  • extends firmware modules to embed state and information relevant for UI

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.