Amazon FreeRTOS
User Guide

Installing the Initial Firmware

To update firmware, you must install an initial version of the firmware that uses the OTA agent library to listen for OTA update jobs. The OTA demo application contains the code for the initial firmware and the firmware update.

This tutorial assumes you have followed the instructions in:

To download the Amazon FreeRTOS OTA demo code

  1. Browse to the AWS IoT console and from the navigation pane, choose Software.

  2. Under Amazon FreeRTOS Device Software, choose Configure download.

  3. From the list of software configurations, choose Connect to AWS IoT - Microchip. Choose the configuration name, not the Download link.


    The OTA Updates feature is currently in beta.

  4. Under Libraries, choose Add another library, and then choose OTA Updates.

  5. Choose Create and download.

To build the OTA update demo application

  1. Extract the .zip file you just downloaded.

  2. Follow the instructions in Getting Started with Amazon FreeRTOS to import the aws_demos project into the MPLAB X IDE, configure your AWS IoT endpoint, your Wi-Fi SSID and password, and a private key and certificate for your board.

  3. Open aws_demos/application_code/source/aws_demo_runner.c and comment out the call to vStartMQTTEchoDemo() and its extern declaration. Uncomment the call to vStartOTAUpdateDemoTask() and its extern declaration.

  4. Build the project and make sure it compiles without errors.

  5. Run a terminal emulator and connect to your board using the following settings:

    • Baud rate: 115200

    • Data bits: 8

    • Parity: None

    • Stop bits: 1

  6. Run the project on your board to make sure it can connect to Wi-Fi and the AWS IoT MQTT message broker.

The terminal emulator should display text like the following:

AWS Validate: no valid signature in descr: 0xbd000000 AWS Validate: no valid signature in descr: 0xbd100000 >AWS Launch: No Map performed. Running directly from address: 0x9d000020? AWS Launch: wait for app at: 0x9d000020 WILC1000: Initializing... 0 0 >[None] Seed for randomizer: 3931037713 1 0 [None] Random numbers: 00006193 000058FF 000033B5 00000D5F Chip ID 1503a0 Firmware ver : 4.2.1 Min driver ver : 4.2.1 Curr driver ver: 4.2.1 WILC1000: Initialization successful! Start Wi-Fi Connection... Wi-Fi Connected 2 7243 [IP-task] vDHCPProcess: offer c0a82b6fip 3 7284 [IP-task] vDHCPProcess: offer c0a82b6fip 4 7284 [IP-task] IP Address: 5 7284 [IP-task] Subnet Mask: 6 7284 [IP-task] Gateway Address: 7 7284 [IP-task] DNS Server Address: 8 7286 [OTA] OTA demo version 0.9.0 9 7286 [OTA] Creating MQTT Client... 10 7286 [OTA] Connecting to broker... 11 7286 [OTA] Sending command to MQTT task. 12 7286 [MQTT] Received message 10000 from queue.

To burn the demo application onto your board

  1. Open the "aws_demos" project in MPLAB X IDE.

  2. Open lib/ota/portable/microchip/curiosity_pic32mzef/aws_codesign_keys.h.

  3. Paste the "ecdsasigner.crt" created earlier onto signingcredentialSIGNING_CERTIFICATE_PEM. Following the same format as aws_clientcredential_keys.h, each line pasted must end with the new line character, '\n', and each line must have quotes around it.

    For example, your certificate should look similar to the following:

    "-----BEGIN CERTIFICATE-----\n" "MIIBXTCCAQOgAwIBAgIJAM4DeybZcTwKMAoGCCqGSM49BAMCMCExHzAdBgNVBAMM\n" "FnRlc3Rf62lnbmVyQGFtYXpvbi5jb20wHhcNMTcxMTAzMTkxODM1WhcNMTgxMTAz\n" "MTkxODM2WjAhMR8wHQYDVQBBZZZ0ZXN0X3NpZ25lckBhbWF6b24uY29tMFkwEwYH\n" "KoZIzj0CAQYIKoZIzj0DAQcDQgAERavZfvwL1X+E4dIF7dbkVMUn4IrJ1CAsFkc8\n" "gZxPzn683H40XMKltDZPEwr9ng78w9+QYQg7ygnr2stz8yhh06MkMCIwCwYDVR0P\n" "BAQDAgeAMBMGA1UdJQQMMAoGCCsGAQUFBwMDMAoGCCqGSM49BAMCA0gAMEUCIF0R\n" "r5cb7rEUNtWOvGd05MacrgOABfSoVYvBOK9fP63WAqt5h3BaS123coKSGg84twlq\n" "TkO/pV/xEmyZmZdV+HxV/OM=\n" "-----END CERTIFICATE-----\n";
  4. Paste the "ecdsasigner.key" created earlier onto signingcredentialSIGNING_PRIVATE_KEY_PEM. Following the same format as aws_clientcredential_keys.h, each line pasted must end in a new line escape character, "\n", and each line must have quotes around it.

  5. Rebuild the aws_demos project and make sure it compiles without errors.

  6. Click on the from the top tool bar.

  7. After the programming process is complete, disconnect the ICD 4 debugger and reset the board. Reconnect your terminal emulator to make sure the output is the same as when you debugged the demo with MPLAB X IDE.