Dagger
Search

esp-idf

The idf.py command-line tool provides a front-end to easily manage your project builds, deployment, debugging and more. It manages CMake, Ninja and esptool.py.

Installation

dagger install github.com/alanmosely/daggerverse/esp-idf@v0.0.6

Entrypoint

Return Type
EspIdf !
Arguments
NameTypeDefault ValueDescription
adfImageRepoString !"alanmosely/esp-adf"Image repository used when adf_version is a bare tag
Example
dagger -m github.com/alanmosely/daggerverse/esp-idf@1a706a2d19c4c52a983cdb6d2e33f71ab5d442f4 call \
 --adf-image-repo string
func (m *MyModule) Example(adfImageRepo string) *dagger.EspIdf  {
	return dag.
			Espidf(adfImageRepo)
}
@function
def example(adfimagerepo: str) -> dagger.EspIdf:
	return (
		dag.esp_idf(adfimagerepo)
	)
@func()
example(adfImageRepo: string): EspIdf {
	return dag
		.espIdf(adfImageRepo)
}

Types

EspIdf 🔗

build() 🔗

Execute “idf.py build” and return the build output directory

Export the artifacts locally with: dagger call build –project-dir . export –path ./build

Return Type
Directory !
Arguments
NameTypeDefault ValueDescription
projectDirDirectory !-

The directory containing the ESP-IDF project

adfVersionString null

The Espressif ADF image tag or full image reference to use; if set, idf_version is ignored

idfVersionString !"v5.1"

The version of the Espressif IDF Docker image to use

targetString null

The chip to build for, e.g. esp32s3; runs “idf.py set-target” first

Example
dagger -m github.com/alanmosely/daggerverse/esp-idf@1a706a2d19c4c52a983cdb6d2e33f71ab5d442f4 call \
 --adf-image-repo string build --project-dir DIR_PATH --idf-version string
func (m *MyModule) Example(adfImageRepo string, projectDir *dagger.Directory, idfVersion string) *dagger.Directory  {
	return dag.
			Espidf(adfImageRepo).
			Build(projectDir, idfVersion)
}
@function
def example(adfimagerepo: str, projectdir: dagger.Directory, idfversion: str) -> dagger.Directory:
	return (
		dag.esp_idf(adfimagerepo)
		.build(projectdir, idfversion)
	)
@func()
example(adfImageRepo: string, projectDir: Directory, idfVersion: string): Directory {
	return dag
		.espIdf(adfImageRepo)
		.build(projectDir, idfVersion)
}

config() 🔗

Execute “idf.py menuconfig” interactively and return the resulting sdkconfig

Requires a TTY (run via “dagger call” in a terminal). Dagger terminal sessions are ephemeral, so the saved sdkconfig is staged on a cache volume and returned as a file. Export it back into your project with: dagger call config –project-dir . export –path ./sdkconfig

Return Type
File !
Arguments
NameTypeDefault ValueDescription
projectDirDirectory !-

The directory containing the ESP-IDF project

adfVersionString null

The Espressif ADF image tag or full image reference to use; if set, idf_version is ignored

idfVersionString !"v5.1"

The version of the Espressif IDF Docker image to use

targetString null

The chip to configure for, e.g. esp32s3; runs “idf.py set-target” first

Example
dagger -m github.com/alanmosely/daggerverse/esp-idf@1a706a2d19c4c52a983cdb6d2e33f71ab5d442f4 call \
 --adf-image-repo string config --project-dir DIR_PATH --idf-version string
func (m *MyModule) Example(adfImageRepo string, projectDir *dagger.Directory, idfVersion string) *dagger.File  {
	return dag.
			Espidf(adfImageRepo).
			Config(projectDir, idfVersion)
}
@function
def example(adfimagerepo: str, projectdir: dagger.Directory, idfversion: str) -> dagger.File:
	return (
		dag.esp_idf(adfimagerepo)
		.config(projectdir, idfversion)
	)
@func()
example(adfImageRepo: string, projectDir: Directory, idfVersion: string): File {
	return dag
		.espIdf(adfImageRepo)
		.config(projectDir, idfVersion)
}

docs() 🔗

Execute “idf.py docs” from the official Espressif IDF Docker image

Return Type
String !
Arguments
NameTypeDefault ValueDescription
projectDirDirectory !-

The directory containing the ESP-IDF project

idfVersionString !"v5.1"

The version of the Espressif IDF Docker image to use

Example
dagger -m github.com/alanmosely/daggerverse/esp-idf@1a706a2d19c4c52a983cdb6d2e33f71ab5d442f4 call \
 --adf-image-repo string docs --project-dir DIR_PATH --idf-version string
func (m *MyModule) Example(ctx context.Context, adfImageRepo string, projectDir *dagger.Directory, idfVersion string) string  {
	return dag.
			Espidf(adfImageRepo).
			Docs(ctx, projectDir, idfVersion)
}
@function
async def example(adfimagerepo: str, projectdir: dagger.Directory, idfversion: str) -> str:
	return await (
		dag.esp_idf(adfimagerepo)
		.docs(projectdir, idfversion)
	)
@func()
async example(adfImageRepo: string, projectDir: Directory, idfVersion: string): Promise<string> {
	return dag
		.espIdf(adfImageRepo)
		.docs(projectDir, idfVersion)
}

flash() 🔗

Execute “idf.py flash” from the official Espressif IDF or ADF Docker image using the rfc2217 protocol to connect to the host machine’s serial port

Requires an RFC2217 server running on the host that forwards the device’s serial port (on Windows, download and run https://raw.githubusercontent.com/alanmosely/daggerverse/refs/heads/master/esp-idf/src/main/resources/run_esp_rfc2217_server.py), see: https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-guides/tools/idf-docker-image.html#using-remote-serial-port

Return Type
String !
Arguments
NameTypeDefault ValueDescription
projectDirDirectory !-

The directory containing the ESP-IDF project

adfVersionString null

The Espressif ADF image tag or full image reference to use; if set, idf_version is ignored

idfVersionString !"v5.1"

The version of the Espressif IDF Docker image to use

serialHostString !"host.docker.internal"

RFC2217 host for serial forwarding

serialPortInteger !4000

RFC2217 port for serial forwarding

cleanBoolean !false

Run ‘idf.py fullclean’ before building

targetString null

The chip to build for, e.g. esp32s3; runs “idf.py set-target” first

Example
dagger -m github.com/alanmosely/daggerverse/esp-idf@1a706a2d19c4c52a983cdb6d2e33f71ab5d442f4 call \
 --adf-image-repo string flash --project-dir DIR_PATH --idf-version string --serial-host string --serial-port integer --clean boolean
func (m *MyModule) Example(ctx context.Context, adfImageRepo string, projectDir *dagger.Directory, idfVersion string, serialHost string, serialPort int, clean bool) string  {
	return dag.
			Espidf(adfImageRepo).
			Flash(ctx, projectDir, idfVersion, serialHost, serialPort, clean)
}
@function
async def example(adfimagerepo: str, projectdir: dagger.Directory, idfversion: str, serialhost: str, serialport: int, clean: bool) -> str:
	return await (
		dag.esp_idf(adfimagerepo)
		.flash(projectdir, idfversion, serialhost, serialport, clean)
	)
@func()
async example(adfImageRepo: string, projectDir: Directory, idfVersion: string, serialHost: string, serialPort: number, clean: boolean): Promise<string> {
	return dag
		.espIdf(adfImageRepo)
		.flash(projectDir, idfVersion, serialHost, serialPort, clean)
}

run() 🔗

Execute idf.py from the Espressif IDF or ADF Docker image, by default building the project

Return Type
String !
Arguments
NameTypeDefault ValueDescription
projectDirDirectory !-

The directory containing the ESP-IDF project

adfVersionString null

The Espressif ADF image tag or full image reference to use; if set, idf_version is ignored

idfVersionString !"v5.1"

The version of the Espressif IDF Docker image to use

idfArgs[String ! ] null

The arguments to pass to idf.py

targetString null

The chip to build for, e.g. esp32s3; runs “idf.py set-target” first

Example
dagger -m github.com/alanmosely/daggerverse/esp-idf@1a706a2d19c4c52a983cdb6d2e33f71ab5d442f4 call \
 --adf-image-repo string run --project-dir DIR_PATH --idf-version string
func (m *MyModule) Example(ctx context.Context, adfImageRepo string, projectDir *dagger.Directory, idfVersion string) string  {
	return dag.
			Espidf(adfImageRepo).
			Run(ctx, projectDir, idfVersion)
}
@function
async def example(adfimagerepo: str, projectdir: dagger.Directory, idfversion: str) -> str:
	return await (
		dag.esp_idf(adfimagerepo)
		.run(projectdir, idfversion)
	)
@func()
async example(adfImageRepo: string, projectDir: Directory, idfVersion: string): Promise<string> {
	return dag
		.espIdf(adfImageRepo)
		.run(projectDir, idfVersion)
}