ESPStartup is a startup orchestration library for ESP32 applications built with ESPToolKit. It lets you split boot logic into ordered sections, validate step dependencies, and move deferred initialization to ESPWorker.
- Section-based startup flow (
core,network,datetime, or custom). - Dependency ordering via
.after("step")with validation. - Optional parallel init inside a section for independent or explicitly safe steps.
- Blocking first section, deferred sections run in
ESPWorker. - Readiness gates for deferred sections.
- Snapshot and JSON export helpers for diagnostics.
- PlatformIO: add
https://github.com/ESPToolKit/esp-startup.gittolib_deps. - Arduino IDE: install as ZIP from this repository.
Dependencies:
ESPWorkerArduinoJson
Use a single public include:
#include <ESPStartup.h>#include <ESPStartup.h>
#include <ESPWorker.h>
ESPWorker worker;
ESPStartup startup;
void setup() {
worker.init(ESPWorker::Config{});
ESPStartupConfig cfg{};
cfg.worker = &worker;
cfg.enableParallelInit = true;
cfg.onReady = []() { Serial.println("startup ready"); };
cfg.onFailed = []() { Serial.println("startup failed"); };
startup.configure(cfg);
startup.init({"core", "network"});
startup.addTo("core", "logger", []() { return true; }).parallelSafe();
startup.addTo("core", "storage", []() { return true; }); // no deps => auto parallel eligible
startup.addTo("network", "wifi", []() { return true; }).after("logger");
startup.start();
}startup.section("network").readiness(
[]() { return networkIsConnected(); },
[](TickType_t waitTicks) { vTaskDelay(waitTicks); }
);If no wait callback is supplied, ESPStartup uses vTaskDelay(waitTicks).
- Parallelism is section-scoped only.
- A step is parallel-eligible if it has no dependencies, or it is marked with
.parallelSafe(true). - If parallel init is enabled and a wave has 2+ eligible steps,
ESPStartupConfig::workeris required. - On failure, ESPStartup stops scheduling new steps, waits for already-started parallel steps, then returns failure.
bool configure(const ESPStartupConfig& config)bool init(std::initializer_list<const char*> sectionNames = {})SectionHandle section(const char* sectionName)StepHandle addTo(const char* sectionName, const char* stepName, const StepCallback& callback)StepHandle add(const char* stepName, const StepCallback& callback)StepHandle::parallelSafe(bool enabled = true)bool start()void stop()StartupStatusSnapshot snapshot() constJsonDocument snapshotJson() const
ESPStartupConfig fields:
ESPWorker* workerTickType_t waitTicksconst char* workerNamesize_t workerStackSizeBytesbool enableParallelInitstd::function<void()> onStartedstd::function<void()> onReadystd::function<void()> onFailedstd::function<void()> onDeferredFailurestd::function<void(const StartupStatusSnapshot&)> onSnapshot
- Step names must be unique.
- Missing dependencies fail startup validation.
- Dependency cycles fail startup validation.
- A step cannot depend on a step in a future section.
examples/Basic- basic multi-section startup flow.examples/SectionReadiness- delayed section execution with readiness checks.examples/ParallelInit- parallel init of independent and safe steps.
MIT - see LICENSE.md.
- Repositories: https://github.com/orgs/ESPToolKit/repositories
- Discord: https://discord.gg/WG8sSqAy
- Support: https://ko-fi.com/esptoolkit
- Website: https://www.esptoolkit.hu/