This post shows how to build and run the Mender MCU client on ESP-IDF v6, using ESP32-S3-DevKitC.
Note: ESP-IDF support in Mender MCU is still being developed and isn’t officially supported yet, so some features might be missing.
Prerequisites and requirements:
- ESP32-S3-DevKitC, connected over USB
- ESP-IDF v6.0 or later
mender-artifact4.2.0 or later in yourPATH- The build uses it to create the Mender Artifact. See the downloads page
- A hosted Mender account (US or EU) and a tenant token
- Found under your user menu → My organization → Organization token
- Wi-Fi SSID and password
Get the sources
Once you have all the requirements in place, clone the esp-idf branch of mender-mcu-integration:
git clone -b esp-idf https://github.com/mendersoftware/mender-mcu-integration
cd mender-mcu-integration
Configure
Create sdkconfig.defaults.esp32s3 with your Wi-Fi credentials, tenant token and Artifact name:
CONFIG_MENDER_APP_WIFI_SSID="<your SSID>"
CONFIG_MENDER_APP_WIFI_PSK="<your password>"
CONFIG_MENDER_SERVER_TENANT_TOKEN="<paste your tenant token here>"
CONFIG_MENDER_ARTIFACT_NAME="release-1"
If you’re using EU hosted Mender, also add CONFIG_MENDER_SERVER_HOST_EU=y.
Build and flash
Activate the ESP-IDF environment, then prepare the device by erasing its flash:
idf.py erase-flash
Build, flash and open the monitor:
idf.py build flash monitor
The build also creates the Mender Artifact, build/mender-mcu-freertos-example.mender. Press Ctrl-] to exit the monitor.
Once the device is on Wi-Fi, it should show up as pending in hosted Mender. Accept it, and it will start checking for deployments and sending inventory.
Deploy an update
Open the menuconfig:
idf.py menuconfig
Under Component config → Mender client → Mender Artifact generation, change Name of the artifact, e.g. to release-2. This is also where you’ll find the rest of the client settings. Save, exit and rebuild:
idf.py build
Upload build/mender-mcu-freertos-example.mender to hosted Mender and deploy it to your device. The device reboots into the new image and commits the update once it has reconnected to the server. If it never gets that far, it rolls back to the previous image on the next reboot.
To follow the update, start idf.py monitor before creating the deployment; starting it mid-update resets the board.
We’d love to get your feedback!