Skip to content

esp32-devel

esp32-devel turns xmake into an ESP32 SDK: the cross toolchain, the build rules, the flashing and a blink template, in one install.

PayloadWhat it provides
toolchains/esp32the cross toolchain of the selected board (risc-v)
rules/applinks against the prebuilt esp-idf libs, builds the bootable image, flashes on xmake install
includes/boardthe board/port/baud options and the sdk package binding
templates/c/esp32.blinkxmake create -t esp32.blink
modules/private/*the board table, the sdk recipe reader and the flasher

Supported board: esp32c3. The application is linked against the prebuilt esp-idf libraries the same way Arduino and PlatformIO do — there is no esp-idf source build — and the entry point is the esp-idf native void app_main(void).

Install

sh
$ xmake addon --install esp32-devel

It depends on serial-tools, which is installed with it.

Create and build a project

sh
$ xmake create -t esp32.blink -l c blink
$ cd blink
$ xmake f --board=esp32c3
$ xmake

The build produces the elf plus the three flashable images: the bootloader, the partition table and the application.

Flash and monitor

sh
$ xmake install                    # flash it, the serial port is auto-detected
$ xmake run                        # flash it and then open the serial monitor
$ xmake f --port=/dev/ttyUSB0 --baud=460800

Use it in your own project

lua
add_addons("esp32-devel")
includes("@addon/esp32-devel/board")

target("blink")
    add_rules("@addon/esp32-devel/app")
    add_files("src/*.c")
OptionDefaultDescription
--boardesp32c3the target board
--portauto-detectedthe serial port
--baud460800the flashing baud rate
--monitor_baud115200the serial monitor baud rate

Known gaps

The xtensa boards (esp32/esp32s3) are not supported yet.