This repository contains a project that demonstrates how to integrate FreeRTOS modular software libraries with the hardware capabilities of Espressif SoCs and the enhanced security capabilities. The project contains reference implementations that demonstrate IoT application tasks that run concurrently and communicate with enhanced security with AWS IoT. The implementation also shows how to perform over-the-air firmware updates that use the AWS IoT OTA service and the secure bootloader capabilities of Secure Boot V2.
The reference implementation is tested to run on the following IoT development boards:
- ESP32
- ESP32-C3
- ESP32-S3
See the Featured IoT Reference Integration page on FreeRTOS.org for more details about the DS peripheral, Secure Boot and OTA.
To clone using HTTPS:
git clone https://github.com/FreeRTOS/iot-reference-esp32.git --recurse-submodules
Using SSH:
git clone git@github.com:FreeRTOS/iot-reference-esp32.git --recurse-submodules
If you have downloaded the repo without using the --recurse-submodules argument, you should run:
git submodule update --init --recursive
This repository currently supports 3 demos implemented as FreeRTOS tasks, each of which utilize the same MQTT connection. The demos use the coreMQTT library, while the coreMQTT-Agent library is employed to manage thread safety for the MQTT connection. The demos are the following:
- ota_over_mqtt_demo: This demo uses the AWS IoT OTA service for FreeRTOS to configure and create OTA updates. The OTA client software on the ESP32-C3 follows the Modular Over the Air Updates design and runs in the background within a FreeRTOS agent (or daemon) task. A new firmware image is first signed and uploaded to the OTA service, and the project is then configured to store the corresponding public key certificate. The demo subscribes to, and listens on, an OTA job topic in order to be notified of an OTA update. Upon receiving notification of a pending OTA update, the device downloads the firmware patch and performs code signature verification of the downloaded image by using the public key certificate. On successful verification, the device reboots and the updated image is activated. The OTA client then performs a self-test on the updated image to check for its integrity.
- sub_pub_unsub_demo: The demo creates tasks which subscribe to a topic on AWS IoT Core, publish a constant string to the same topic, receive their publish (since they are subscribed to the topic they publish to), and then unsubscribe from the topic in a loop.
- temp_sub_pub_and_led_control_demo: This demo creates a task which subscribes to a topic on AWS IoT Core. This task then reads the temperature from the onboard temperature sensor, publishes this information in JSON format to the same topic, and then receives this publish (since it is subscribed to the same topic it just published to) in a loop. This demo also enables a user to send a JSON packet back to the device to turn an LED off or on.
All three demos can be selected to run together concurrently as separate tasks.
To get started and run the demos, follow the Getting Started Guide.
See CONTRIBUTING for more information.
Example source code under ./main/ is licensed under the MIT-0 License. See the LICENSE file. For all other source code licenses including components/, see source header documentation.