Now that Mender is running on your device, let's deploy new firmware. We will make a simple change to the Zephyr application by modifying the "Hello World" message, build a new firmware image, and use Mender to deliver this update OTA to the ESP32-S3 board.
We will increment the "version" of our firmware by changing the Artifact name, create a Mender Artifact for the new firmware, upload it to the server, and create a deployment for our device. The device will download the update, install it, and reboot into the new firmware. MCUboot will swap the new image into place, the device will run the new firmware and mark the update as successful.
Let's introduce a simple change to the firmware to recognize the new version. The example mender-mcu-integration project prints a "Hello World" message upon startup, which we will change.
Open the source code of the application. In the workspace, open mender-mcu-integration/src/main.c
in a text editor. Change the line
printf("Hello World! %s\n", CONFIG_BOARD_TARGET);
to
printf("Hello updated World! %s\n", CONFIG_BOARD_TARGET);
Ensure you save your changes to the source code.
Now, compile the modified firmware. We will use the same build directory for simplicity. In the terminal, set the new version and rerun the west build:
export ARTIFACT_NAME="release-2"
west build --domain mender-mcu-integration -- -DCONFIG_MENDER_ARTIFACT_NAME=\"$ARTIFACT_NAME\"
Note: We donβt need to pass any other parameters to the west build
command since they were cached from the last build. We use the --domain
parameter to rebuild only the application (not the bootloader).
The build system will recompile any changed source files and produce a new zephyr.signed.bin
and generate the Mender Artifact together with the binary. Since we changed the code and the artifact name setting, both the binary and the Artifact will represent "version 2" of our firmware.
Do not flash the device manually. We will let Mender deliver this update. The new binary image is in the build directory (e.g., build/mender-mcu-integration/zephyr/zephyr.signed.bin
).
With our Artifact ready, we'll now use the Mender server to deploy it to the device. We'll do this using the hosted Mender web interface:
demo-v2.mender
file or click to browse and select it. You can give the release a name when prompted, but sticking with the default is fine. After uploading, you should see a new release entry (e.g., "demo-v2") in the Releases list."Hello updated World!"
appear after the reboot, confirming the code change.Congratulations β you have successfully deployed a new firmware to your microcontroller via Mender! π After the deployment finishes, your device will run the new application code you provided. The update was applied in a robust manner: if the new firmware had failed to start, MCUboot would have rolled back to the previous version automatically on reboot. The new firmware is now permanent because everything went well and the client confirmed the update.
You can repeat the process to iterate on your firmware. For example, try changing the message again or toggling an LED, then create a new artifact (e.g. "release-v3") and deploy it. Each time, ensure the Artifact name and device type are set correctly.
In this get started guide, we prepared a Zephyr-based microcontroller for OTA updates with Mender and successfully performed an update. We covered:
For now, you can continue exploring by:
With microcontroller support, Mender extends robust OTA updates to a new class of devices, enabling unified update management across both Linux and constrained edge devices. Happy updating!
Β© 2025 Northern.tech AS