Getting Started with the M5StickC and FreeRTOS

1. Setup Development Environment

1.1 Setting Up the Toolchain on Windows

1.1.1 Download Toolchain

1.1.2 Install MSYS2

  • Unzip the file ‘’ to the root directory of ‘Drive C:’, you will find ‘msys32’ folder

1.1.3 Creat folder

  • Run ‘C:/msys32/mingw32.exe’, enter command menu, and create esp directory by inputting ‘mkdir -p ~/esp’

1.2 Install ESP-IDF

1.2.1 Clone ESP-IDF

1.2.2 Set ESP-IDF environment variables on Windows

  • Create a script file ‘’ in ‘C:/msys32/etc/profile.d’, and add the code: export IDF_PATH="C:/msys32/home/terryyao/esp/esp-idf" Please refer to the actual path of ESP-IDF in your PC

1.2.3 Verify environment

  • Enter ‘printenv IDF_PATH’ to verify

1.3 Install Python Packages

  • Input ‘python -m pip install --user -r $IDF_PATH/requirements.txt’

1.4 Test Demo

  • Program a demo to test, for example ‘hello_world’

1.4.1 Enter the esp directory

  • Enter the esp directory and input ‘cd ~/esp’

1.4.2 Copy the example of 'hello_world' to esp directory

  • Input ‘cp -r $IDF_PATH/examples/get-started/hello_world ./’

1.4.3 Enter ‘hello_world’ example

  • input ‘cd ~/esp/hello_world’

1.4.4 Connect M5StickC with PC, start to configure

  • Input ’make menuconfig’, enter Configuration menu:
  • Once you see above screen, means ESP-IDF set up well. Exit

2. Download and Configure FreeRTOS

2.1 Install FreeRTOS

2.2 Get M5StickC code

2.2.1 Enter Development Board Menu

  • Input ‘cd amazon-freertos/vendors/espressif/boards/’

2.2.2 Download M5StickC code

2.2.3 Use 'AWS CLI' to run AWS IoT commands

  • Input 'easy_install awscli' to install the AWS CLI

2.2.4 Configure AWS CLI

  • Visit IAM console to get AWS Access Key ID, and AWS Secret Access Key for an IAM user
  • Run ‘aws configure’ to set parameters
  • Create two files, ‘config’ and ‘credentials’, in C:/msys32/home/user/.aws

2.2.5 Install boto3 Python module

  • Input ‘easy_install boto3’

2.2.6 Configure network

  • Open ‘demos/common/tools/aws_config_quick_start/configure.json’ to configure ‘thing_name’, ‘wifi_ssid’, ‘wifi_password’, ‘wifi_security’, as below
  • Enter ‘demos/common/tools/aws_config_quick_start’ folder, input ‘python setup’
  • Enter ‘demos/espressif/esp32_devkitc_esp_wrover_kit/make’, input ‘make menuconfig’

  • To start compiling, you need to block IDF_PATH by inputting ‘unset IDF_PATH’

2.2.7 Enter M5StickC Menu

  • Input ‘cd m5stickc/aws_demos’

2.2.8 Burn-in

  • Input ‘make flash monitor’, then select default

2.2.9 Succeed!

On This Page