Skip to content

andrewpollack/esp-workspace

Repository files navigation

ESP Workspace

Personal ESP32 monorepo using ESP-IDF. Multiple firmware projects share a single SDK.

Setup (macOS Apple Silicon)

brew install cmake ninja python
make esp-idf                       # Clone and pin ESP-IDF
cd esp-idf && ./install.sh         # Install toolchains (one-time)
make secrets                       # Create secrets.cmake for WiFi

Edit secrets.cmake with your WiFi credentials:

set(WIFI_SSID "your_network")
set(WIFI_PASSWORD "your_password")

Usage

Activate ESP-IDF environment (or use direnv with .envrc):

source ./esp-idf/export.sh

Build and flash from any project directory:

idf.py build
idf.py flash monitor

Create a new project:

idf.py create-project esp32-my-project
cd esp32-my-project
idf.py set-target esp32

Structure

  • esp-idf/ - SDK (gitignored, pinned via esp-idf.commit)
  • esp32-*/ - Standalone projects
  • common/ - Shared components
    • logging/ - Log wrapper (log_info, log_warn, log_error)
    • wifi/ - WiFi connection (credentials from secrets.cmake)

Set mDNS hostname per project in CMakeLists.txt:

set(MDNS_HOSTNAME "my-device")

Shared component layout:

common/my_component/
├── CMakeLists.txt
├── include/my_component.h
└── my_component.c

Include in a project's CMakeLists.txt:

set(EXTRA_COMPONENT_DIRS ${CMAKE_CURRENT_LIST_DIR}/../common)

References

About

Personal ESP32 monorepo using ESP-IDF. Multiple firmware projects share a single SDK.

Resources

Stars

Watchers

Forks